Fix always minimizing to popup player

pull/5502/head
Stypox 2021-01-28 14:33:12 +01:00
rodzic cafc64534b
commit 4f828fbe00
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4BDF1B40A49FDD23
2 zmienionych plików z 10 dodań i 22 usunięć

Wyświetl plik

@ -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;
}
}
}

Wyświetl plik

@ -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(