From 7d456c9a9c2529847567912c90aa07b7a3937242 Mon Sep 17 00:00:00 2001 From: polymorphicshade Date: Sat, 6 Mar 2021 14:42:48 -0700 Subject: [PATCH] fixed back button pausing fullscreen tablet videos --- .../fragments/detail/VideoDetailFragment.java | 2 +- .../java/org/schabi/newpipe/util/DeviceUtils.java | 12 ++++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/org/schabi/newpipe/fragments/detail/VideoDetailFragment.java b/app/src/main/java/org/schabi/newpipe/fragments/detail/VideoDetailFragment.java index a0b92a60d..f5c3ba100 100644 --- a/app/src/main/java/org/schabi/newpipe/fragments/detail/VideoDetailFragment.java +++ b/app/src/main/java/org/schabi/newpipe/fragments/detail/VideoDetailFragment.java @@ -746,7 +746,7 @@ public final class VideoDetailFragment // If we are in fullscreen mode just exit from it via first back press if (player != null && player.isFullscreen()) { - if (!DeviceUtils.isTablet(activity)) { + if (!DeviceUtils.isTablet(activity, true)) { player.pause(); } restoreDefaultOrientation(); diff --git a/app/src/main/java/org/schabi/newpipe/util/DeviceUtils.java b/app/src/main/java/org/schabi/newpipe/util/DeviceUtils.java index a51b8658e..64d3e875c 100644 --- a/app/src/main/java/org/schabi/newpipe/util/DeviceUtils.java +++ b/app/src/main/java/org/schabi/newpipe/util/DeviceUtils.java @@ -25,9 +25,13 @@ public final class DeviceUtils { } public static boolean isTv(final Context context) { + return isTv(context, false); + } + + public static boolean isTv(final Context context, final boolean forceCheck) { final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); - if (prefs.getBoolean(context + if (!forceCheck && prefs.getBoolean(context .getString(R.string.disable_tv_ui_key), false)) { return false; } @@ -63,9 +67,13 @@ public final class DeviceUtils { } public static boolean isTablet(@NonNull final Context context) { + return isTablet(context, false); + } + + public static boolean isTablet(@NonNull final Context context, final boolean forceCheck) { final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); - if (prefs.getBoolean(context + if (!forceCheck && prefs.getBoolean(context .getString(R.string.disable_tablet_ui_key), false)) { return false; }