Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Magnify button #10521

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -196,9 +196,9 @@ dependencies {
// Or you can use a commit you pushed to GitHub by just replacing TeamNewPipe with your GitHub
// name and the commit hash with the commit hash of the (pushed) commit you want to test
// This works thanks to JitPack: https://jitpack.io/
implementation 'com.github.TeamNewPipe:nanojson:1d9e1aea9049fc9f85e68b43ba39fe7be1c1f751'
implementation 'com.github.TeamNewPipe:NewPipeExtractor:289db1178ab66694c23893e6a487d4708343c47b'
implementation 'com.github.TeamNewPipe:NoNonsense-FilePicker:5.0.0'
implementation 'com.github.teamnewpipe:nanojson:1d9e1aea9049fc9f85e68b43ba39fe7be1c1f751'
implementation 'com.github.teamnewpipe:NewPipeExtractor:289db1178ab66694c23893e6a487d4708343c47b'
implementation 'com.github.teamnewpipe:NoNonsense-FilePicker:5.0.0'

/** Checkstyle **/
checkstyle "com.puppycrawl.tools:checkstyle:${checkstyleVersion}"
Expand Down
1 change: 0 additions & 1 deletion app/src/main/java/org/schabi/newpipe/RouterActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -550,7 +550,6 @@ private List<AdapterChoiceItem> getChoicesForService(final StreamingService serv
final AdapterChoiceItem popupPlayer = new AdapterChoiceItem(
getString(R.string.popup_player_key), getString(R.string.popup_player),
R.drawable.ic_picture_in_picture);

final List<AdapterChoiceItem> returnedItems = new ArrayList<>();
returnedItems.add(showInfo); // Always present

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
public abstract class BaseDescriptionFragment extends BaseFragment {
private final CompositeDisposable descriptionDisposables = new CompositeDisposable();
protected FragmentDescriptionBinding binding;

@Override
public View onCreateView(@NonNull final LayoutInflater inflater,
@Nullable final ViewGroup container,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public final class PlayQueueActivity extends AppCompatActivity
private static final int MENU_ID_AUDIO_TRACK = 71;

private Player player;

private boolean isFullscreen = false;
private boolean serviceBound;
private ServiceConnection serviceConnection;

Expand All @@ -78,6 +78,8 @@ public final class PlayQueueActivity extends AppCompatActivity

private Menu menu;

private ImageButton fullscreenButton;

////////////////////////////////////////////////////////////////////////////
// Activity Lifecycle
////////////////////////////////////////////////////////////////////////////
Expand All @@ -96,6 +98,13 @@ protected void onCreate(final Bundle savedInstanceState) {
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setTitle(R.string.title_activity_play_queue);
}
fullscreenButton = findViewById(R.id.magnify_button);
fullscreenButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(final View view) {
toggleFullscreen();
}
});

serviceConnection = getServiceConnection();
bind();
Expand Down Expand Up @@ -527,6 +536,38 @@ public void onServiceStopped() {
finish();
}

private void toggleFullscreen() {
if (isFullscreen) {
// Code to exit fullscreen mode
getWindow().getDecorView().setSystemUiVisibility(
View.SYSTEM_UI_FLAG_VISIBLE
);

// If you're using an ActionBar, show it
if (getSupportActionBar() != null) {
getSupportActionBar().show();
}
fullscreenButton.setImageResource(R.drawable.ic_fullscreen);
fullscreenButton.setContentDescription(getString(R.string.fullscreen));
} else {
// Code to enter fullscreen mode
getWindow().getDecorView().setSystemUiVisibility(
View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_FULLSCREEN
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
);

// If you're using an ActionBar, hide it
if (getSupportActionBar() != null) {
getSupportActionBar().hide();
fullscreenButton.setImageResource(R.drawable.ic_fullscreen_exit);
fullscreenButton.setContentDescription(getString(R.string.fullscreen));
}
}
isFullscreen = !isFullscreen;
}
////////////////////////////////////////////////////////////////////////////
// Binding Service Helper
////////////////////////////////////////////////////////////////////////////
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ public static boolean globalScreenOrientationLocked(final Context context) {
// 0: Screen orientation is locked
// if the accelerometer sensor is missing completely, assume locked orientation
return android.provider.Settings.System.getInt(
context.getContentResolver(), Settings.System.ACCELEROMETER_ROTATION, 0) == 0
context.getContentResolver(), Settings.System.ACCELEROMETER_ROTATION, 1) == 0
|| !context.getPackageManager()
.hasSystemFeature(PackageManager.FEATURE_SENSOR_ACCELEROMETER);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ protected void setupElementsVisibility() {

closeItemsList();
showHideKodiButton();
binding.fullScreenButton.setVisibility(View.GONE);
binding.fullScreenButton.setVisibility(View.VISIBLE);
setupScreenRotationButton();
binding.resizeTextView.setVisibility(View.VISIBLE);
binding.getRoot().findViewById(R.id.metadataView).setVisibility(View.VISIBLE);
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions app/src/main/res/layout-large-land/fragment_video_detail.xml
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,15 @@
android:layout_height="match_parent"
android:descendantFocusability="afterDescendants" />

<ImageButton
android:id="@+id/magnify_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical|end"
android:contentDescription="@string/toggle_fullscreen"
android:background="?attr/selectableItemBackground"
android:scaleType="center"
android:src="@drawable/ic_fullscreen_exit" />
</FrameLayout>

</org.schabi.newpipe.views.CustomCollapsingToolbarLayout>
Expand Down
11 changes: 11 additions & 0 deletions app/src/main/res/layout/fragment_video_detail.xml
Original file line number Diff line number Diff line change
Expand Up @@ -140,12 +140,23 @@
tools:progress="40"
tools:visibility="visible" />


<!-- Player will be inserted here in realtime -->
<FrameLayout
android:id="@+id/player_placeholder"
android:layout_width="match_parent"
android:layout_height="match_parent" />

<ImageButton
android:id="@+id/magnify_button"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_gravity="center_vertical|end"
android:contentDescription="@string/toggle_fullscreen"
android:background="?attr/selectableItemBackground"
android:scaleType="center"
android:src="@drawable/ic_fullscreen" />

</FrameLayout>
</org.schabi.newpipe.views.CustomCollapsingToolbarLayout>

Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values/settings_keys.xml
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
</string-array>

<string name="start_main_player_fullscreen_key">start_main_player_fullscreen_key</string>

<string name="fullscreen_key">fullscreen_key</string>
<string name="autoplay_key">autoplay_key</string>
<string name="autoplay_value">@string/autoplay_wifi_key</string>
<string name="autoplay_always_key">autoplay_always_key</string>
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -466,6 +466,7 @@
<string name="caption_none">No Captions</string>
<string name="resize_fit">Fit</string>
<string name="resize_fill">Fill</string>
<string name="fullscreen">Fullscreen</string>
<string name="resize_zoom">Zoom</string>
<string name="caption_auto_generated">Auto-generated</string>
<!-- Caption Settings -->
Expand Down