Fix always minimizing to popup player

This commit is contained in:
Stypox 2021-01-28 14:33:12 +01:00
parent cafc64534b
commit 4f828fbe00
No known key found for this signature in database
GPG Key ID: 4BDF1B40A49FDD23
2 changed files with 10 additions and 22 deletions

View File

@ -2012,7 +2012,8 @@ public final class Player implements
changePopupWindowFlags(IDLE_WINDOW_FLAGS);
// Remove running notification when user does not want minimization to background or popup
if (PlayerHelper.isMinimizeOnExitDisabled(context) && videoPlayerSelected()) {
if (PlayerHelper.getMinimizeOnExitAction(context) == MINIMIZE_ON_EXIT_MODE_NONE
&& videoPlayerSelected()) {
NotificationUtil.getInstance().cancelNotificationAndStopForeground(service);
} else {
NotificationUtil.getInstance().createNotificationIfNeededAndUpdate(this, false);
@ -3822,11 +3823,14 @@ public final class Player implements
switch (getMinimizeOnExitAction(context)) {
case MINIMIZE_ON_EXIT_MODE_BACKGROUND:
useVideoSource(false);
break;
case MINIMIZE_ON_EXIT_MODE_POPUP:
setRecovery();
NavigationHelper.playOnPopupPlayer(getParentActivity(), playQueue, true);
break;
case MINIMIZE_ON_EXIT_MODE_NONE: default:
pause();
break;
}
}
}

View File

@ -251,33 +251,17 @@ public final class PlayerHelper {
@MinimizeMode
public static int getMinimizeOnExitAction(@NonNull final Context context) {
final String defaultAction = context.getString(R.string.minimize_on_exit_none_key);
final String popupAction = context.getString(R.string.minimize_on_exit_popup_key);
final String backgroundAction = context.getString(R.string.minimize_on_exit_background_key);
final String action = getPreferences(context)
.getString(context.getString(R.string.minimize_on_exit_key), defaultAction);
if (action.equals(popupAction)) {
.getString(context.getString(R.string.minimize_on_exit_key), "");
if (action.equals(context.getString(R.string.minimize_on_exit_popup_key))) {
return MINIMIZE_ON_EXIT_MODE_POPUP;
} else if (action.equals(backgroundAction)) {
return MINIMIZE_ON_EXIT_MODE_BACKGROUND;
} else {
} else if (action.equals(context.getString(R.string.minimize_on_exit_none_key))) {
return MINIMIZE_ON_EXIT_MODE_NONE;
} else {
return MINIMIZE_ON_EXIT_MODE_BACKGROUND; // default
}
}
public static boolean isMinimizeOnExitToPopup(@NonNull final Context context) {
return getMinimizeOnExitAction(context) == MINIMIZE_ON_EXIT_MODE_POPUP;
}
public static boolean isMinimizeOnExitToBackground(@NonNull final Context context) {
return getMinimizeOnExitAction(context) == MINIMIZE_ON_EXIT_MODE_BACKGROUND;
}
public static boolean isMinimizeOnExitDisabled(@NonNull final Context context) {
return getMinimizeOnExitAction(context) == MINIMIZE_ON_EXIT_MODE_NONE;
}
@AutoplayType
public static int getAutoplayType(@NonNull final Context context) {
final String type = getPreferences(context).getString(