mirror of
https://github.com/TeamNewPipe/NewPipe
synced 2025-11-13 21:47:11 +00: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:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user