mirror of
https://github.com/TeamNewPipe/NewPipe
synced 2024-12-03 23:40:30 +01:00
-Added toggle to allow main video player to switch to popup player when onstop is called.
-Fixed player state not recovering when player is stopped during multiwindow mode. -Updated gradle to 3.1.2.
This commit is contained in:
parent
2a45a13f73
commit
4fc37a7321
@ -208,10 +208,17 @@ public final class MainVideoPlayer extends AppCompatActivity
|
||||
protected void onStop() {
|
||||
if (DEBUG) Log.d(TAG, "onStop() called");
|
||||
super.onStop();
|
||||
playerImpl.destroy();
|
||||
|
||||
PlayerHelper.setScreenBrightness(getApplicationContext(),
|
||||
getWindow().getAttributes().screenBrightness);
|
||||
|
||||
isInMultiWindow = false;
|
||||
|
||||
if (playerImpl == null) return;
|
||||
if (PlayerHelper.isMinimizeOnExitEnabled(this)) {
|
||||
playerImpl.onFullScreenButtonClicked();
|
||||
} else {
|
||||
playerImpl.destroy();
|
||||
}
|
||||
}
|
||||
|
||||
/*//////////////////////////////////////////////////////////////////////////
|
||||
|
@ -173,6 +173,10 @@ public class PlayerHelper {
|
||||
return isAutoQueueEnabled(context, false);
|
||||
}
|
||||
|
||||
public static boolean isMinimizeOnExitEnabled(@NonNull final Context context) {
|
||||
return isMinimizeOnExitEnabled(context, false);
|
||||
}
|
||||
|
||||
@NonNull
|
||||
public static SeekParameters getSeekParameters(@NonNull final Context context) {
|
||||
return isUsingInexactSeek(context, false) ?
|
||||
@ -249,7 +253,6 @@ public class PlayerHelper {
|
||||
* System font scaling:
|
||||
* Very small - 0.25f, Small - 0.5f, Normal - 1.0f, Large - 1.5f, Very Large - 2.0f
|
||||
* */
|
||||
@NonNull
|
||||
public static float getCaptionScale(@NonNull final Context context) {
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) return 1f;
|
||||
|
||||
@ -322,4 +325,8 @@ public class PlayerHelper {
|
||||
return sp.getFloat(context.getString(R.string.screen_brightness_key), screenBrightness);
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean isMinimizeOnExitEnabled(@NonNull final Context context, final boolean b) {
|
||||
return getPreferences(context).getBoolean(context.getString(R.string.minimize_on_exit_key), b);
|
||||
}
|
||||
}
|
||||
|
@ -24,6 +24,7 @@
|
||||
<string name="auto_queue_key" translatable="false">auto_queue_key</string>
|
||||
<string name="screen_brightness_key" translatable="false">screen_brightness_key</string>
|
||||
<string name="screen_brightness_timestamp_key" translatable="false">screen_brightness_timestamp_key</string>
|
||||
<string name="minimize_on_exit_key" translatable="false">minimize_on_exit_key</string>
|
||||
|
||||
<string name="default_resolution_key" translatable="false">default_resolution</string>
|
||||
<string name="default_resolution_value" translatable="false">360p</string>
|
||||
|
@ -74,6 +74,8 @@
|
||||
<string name="popup_remember_size_pos_summary">Remember last size and position of popup</string>
|
||||
<string name="use_inexact_seek_title">Use fast inexact seek</string>
|
||||
<string name="use_inexact_seek_summary">Inexact seek allows the player to seek to positions faster with reduced precision</string>
|
||||
<string name="minimize_on_exit_title">Minimize on exit</string>
|
||||
<string name="minimize_on_exit_summary">Experimental. Switch to play on popup player when exiting main video player</string>
|
||||
<string name="download_thumbnail_title">Load thumbnails</string>
|
||||
<string name="download_thumbnail_summary">Disable to stop all thumbnails from loading and save on data and memory usage. Changing this will clear both in-memory and on-disk image cache.</string>
|
||||
<string name="thumbnail_cache_wipe_complete_notice">Image cache wiped</string>
|
||||
|
@ -113,5 +113,11 @@
|
||||
android:key="@string/use_inexact_seek_key"
|
||||
android:summary="@string/use_inexact_seek_summary"
|
||||
android:title="@string/use_inexact_seek_title"/>
|
||||
|
||||
<SwitchPreference
|
||||
android:defaultValue="false"
|
||||
android:key="@string/minimize_on_exit_key"
|
||||
android:title="@string/minimize_on_exit_title"
|
||||
android:summary="@string/minimize_on_exit_summary"/>
|
||||
</PreferenceCategory>
|
||||
</PreferenceScreen>
|
||||
|
Loading…
Reference in New Issue
Block a user