diff --git a/app/src/main/java/org/schabi/newpipe/player/MainVideoPlayer.java b/app/src/main/java/org/schabi/newpipe/player/MainVideoPlayer.java
index cbe269a7d..8a4fb62da 100644
--- a/app/src/main/java/org/schabi/newpipe/player/MainVideoPlayer.java
+++ b/app/src/main/java/org/schabi/newpipe/player/MainVideoPlayer.java
@@ -104,6 +104,7 @@ public final class MainVideoPlayer extends AppCompatActivity
@Nullable private PlayerState playerState;
private boolean isInMultiWindow;
+ private boolean isBackPressed;
/*//////////////////////////////////////////////////////////////////////////
// Activity LifeCycle
@@ -191,6 +192,12 @@ public final class MainVideoPlayer extends AppCompatActivity
}
}
+ @Override
+ public void onBackPressed() {
+ super.onBackPressed();
+ isBackPressed = true;
+ }
+
@Override
protected void onSaveInstanceState(Bundle outState) {
if (DEBUG) Log.d(TAG, "onSaveInstanceState() called");
@@ -211,9 +218,15 @@ public final class MainVideoPlayer extends AppCompatActivity
PlayerHelper.setScreenBrightness(getApplicationContext(),
getWindow().getAttributes().screenBrightness);
- isInMultiWindow = false;
+ if (playerImpl == null) return;
+ if (isBackPressed) {
+ playerImpl.destroy();
+ } else {
+ playerImpl.minimize();
+ }
- if (playerImpl != null) playerImpl.terminate();
+ isInMultiWindow = false;
+ isBackPressed = false;
}
/*//////////////////////////////////////////////////////////////////////////
@@ -443,7 +456,7 @@ public final class MainVideoPlayer extends AppCompatActivity
switchPopupButton.setOnClickListener(this);
}
- public void terminate() {
+ public void minimize() {
switch (PlayerHelper.getMinimizeOnExitAction(context)) {
case PlayerHelper.MinimizeMode.MINIMIZE_ON_EXIT_MODE_BACKGROUND:
onPlayBackgroundButtonClicked();
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index c1132ac65..5ca88bd6f 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -505,8 +505,8 @@
- Minimize on exit
- Action when exiting main video player — %s
+ Minimize on application switch
+ Action when switching to other application from main video player — %s
None
Minimize to background player
Minimize to popup player