1
0
mirror of https://github.com/TeamNewPipe/NewPipe synced 2025-10-31 07:13:00 +00:00

[Regression] Revert "Removed remember popup properties setting"

This reverts commit 314615bfef.
This commit is contained in:
Stypox
2020-11-15 22:15:00 +01:00
parent 4c7b5d44a0
commit 7476498823
67 changed files with 153 additions and 3 deletions

View File

@@ -1626,10 +1626,13 @@ public class VideoPlayerImpl extends VideoPlayer
updateScreenSize();
final boolean popupRememberSizeAndPos = PlayerHelper.isRememberingPopupDimensions(service);
final float defaultSize = service.getResources().getDimension(R.dimen.popup_default_width);
final SharedPreferences sharedPreferences =
PreferenceManager.getDefaultSharedPreferences(service);
popupWidth = sharedPreferences.getFloat(POPUP_SAVED_WIDTH, defaultSize);
popupWidth = popupRememberSizeAndPos
? sharedPreferences.getFloat(POPUP_SAVED_WIDTH, defaultSize)
: defaultSize;
popupHeight = getMinimumVideoHeight(popupWidth);
popupLayoutParams = new WindowManager.LayoutParams(
@@ -1643,8 +1646,10 @@ public class VideoPlayerImpl extends VideoPlayer
final int centerX = (int) (screenWidth / 2f - popupWidth / 2f);
final int centerY = (int) (screenHeight / 2f - popupHeight / 2f);
popupLayoutParams.x = sharedPreferences.getInt(POPUP_SAVED_X, centerX);
popupLayoutParams.y = sharedPreferences.getInt(POPUP_SAVED_Y, centerY);
popupLayoutParams.x = popupRememberSizeAndPos
? sharedPreferences.getInt(POPUP_SAVED_X, centerX) : centerX;
popupLayoutParams.y = popupRememberSizeAndPos
? sharedPreferences.getInt(POPUP_SAVED_Y, centerY) : centerY;
checkPopupPositionBounds();

View File

@@ -210,6 +210,10 @@ public final class PlayerHelper {
return isBrightnessGestureEnabled(context, true);
}
public static boolean isRememberingPopupDimensions(@NonNull final Context context) {
return isRememberingPopupDimensions(context, true);
}
public static boolean isAutoQueueEnabled(@NonNull final Context context) {
return isAutoQueueEnabled(context, false);
}
@@ -390,6 +394,12 @@ public final class PlayerHelper {
.getBoolean(context.getString(R.string.brightness_gesture_control_key), b);
}
private static boolean isRememberingPopupDimensions(@NonNull final Context context,
final boolean b) {
return getPreferences(context)
.getBoolean(context.getString(R.string.popup_remember_size_pos_key), b);
}
private static boolean isUsingInexactSeek(@NonNull final Context context) {
return getPreferences(context)
.getBoolean(context.getString(R.string.use_inexact_seek_key), false);