removed Disable Tablet/TV settings in favor of Force Auto Fullscreen setting

This commit is contained in:
polymorphicshade 2021-03-06 15:44:54 -07:00
parent baba2032a3
commit d41bfa8567
7 changed files with 14 additions and 46 deletions

View file

@ -746,7 +746,7 @@ public final class VideoDetailFragment
// If we are in fullscreen mode just exit from it via first back press // If we are in fullscreen mode just exit from it via first back press
if (player != null && player.isFullscreen()) { if (player != null && player.isFullscreen()) {
if (!DeviceUtils.isTablet(activity, true)) { if (!DeviceUtils.isTablet(activity)) {
player.pause(); player.pause();
} }
restoreDefaultOrientation(); restoreDefaultOrientation();

View file

@ -3828,6 +3828,13 @@ public final class Player implements
final boolean videoInLandscapeButNotInFullscreen = final boolean videoInLandscapeButNotInFullscreen =
service.isLandscape() && !isFullscreen && videoPlayerSelected() && !isAudioOnly; service.isLandscape() && !isFullscreen && videoPlayerSelected() && !isAudioOnly;
if (prefs.getBoolean(
context.getString(R.string.force_auto_fullscreen_key), false)
&& videoInLandscapeButNotInFullscreen) {
toggleFullscreen();
return;
}
final boolean notPaused = currentState != STATE_COMPLETED && currentState != STATE_PAUSED; final boolean notPaused = currentState != STATE_COMPLETED && currentState != STATE_PAUSED;
if (parent != null if (parent != null
&& videoInLandscapeButNotInFullscreen && videoInLandscapeButNotInFullscreen

View file

@ -2,7 +2,6 @@ package org.schabi.newpipe.util;
import android.app.UiModeManager; import android.app.UiModeManager;
import android.content.Context; import android.content.Context;
import android.content.SharedPreferences;
import android.content.pm.PackageManager; import android.content.pm.PackageManager;
import android.content.res.Configuration; import android.content.res.Configuration;
import android.os.BatteryManager; import android.os.BatteryManager;
@ -11,10 +10,8 @@ import android.view.KeyEvent;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.core.content.ContextCompat; import androidx.core.content.ContextCompat;
import androidx.preference.PreferenceManager;
import org.schabi.newpipe.App; import org.schabi.newpipe.App;
import org.schabi.newpipe.R;
public final class DeviceUtils { public final class DeviceUtils {
@ -25,17 +22,6 @@ public final class DeviceUtils {
} }
public static boolean isTv(final Context context) { 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 (!forceCheck && prefs.getBoolean(context
.getString(R.string.disable_tv_ui_key), false)) {
return false;
}
if (isTV != null) { if (isTV != null) {
return isTV; return isTV;
} }
@ -67,17 +53,6 @@ public final class DeviceUtils {
} }
public static boolean isTablet(@NonNull final Context context) { 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 (!forceCheck && prefs.getBoolean(context
.getString(R.string.disable_tablet_ui_key), false)) {
return false;
}
return (context return (context
.getResources() .getResources()
.getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) .getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK)

View file

@ -700,8 +700,4 @@
<string name="extras">Dheeraad ah</string> <string name="extras">Dheeraad ah</string>
<string name="extras_todo_summary">Waxkabaddalada yaryar, macmilida, iyo fadhiyo dheeraad ah.</string> <string name="extras_todo_summary">Waxkabaddalada yaryar, macmilida, iyo fadhiyo dheeraad ah.</string>
<string name="experimental_settings">Fadhiga tijaabada ah</string> <string name="experimental_settings">Fadhiga tijaabada ah</string>
<string name="disable_tablet_ui_title">Xidh qaabka tablet-ka</string>
<string name="disable_tablet_ui_summary">Ha isticmaalin qaabka tablet-ka loogu talagalay. Tan waxaa loogu talagalay macmilo gaar ah kaliya. Waxaad u baahantahay inaad app-ka dib usoo kiciso si aad isbadalka u aragto.</string>
<string name="disable_tv_ui_title">Xidh qaabka TV-ga</string>
<string name="disable_tv_ui_summary">Ha isticmaalin qaabka tablet-ka loogu talagalay. Tan waxaa loogu talagalay macmilo gaar ah kaliya. Waxaad u baahantahay inaad app-ka dib usoo kiciso si aad isbadalka u aragto.</string>
</resources> </resources>

View file

@ -370,8 +370,7 @@
<!-- Extras --> <!-- Extras -->
<string name="enable_local_player_key" translatable="false">enable_local_player</string> <string name="enable_local_player_key" translatable="false">enable_local_player</string>
<string name="disable_tablet_ui_key" translatable="false">disable_tablet_ui</string> <string name="force_auto_fullscreen_key" translatable="false">force_auto_fullscreen</string>
<string name="disable_tv_ui_key" translatable="false">disable_tv_ui</string>
<string name="disable_error_reports_key" translatable="false">disable_error_reports</string> <string name="disable_error_reports_key" translatable="false">disable_error_reports</string>
<!-- Localizations --> <!-- Localizations -->

View file

@ -760,10 +760,8 @@
<string name="experimental_settings">Experimental Settings</string> <string name="experimental_settings">Experimental Settings</string>
<string name="enable_local_player_title">Enable Local Player (alpha)</string> <string name="enable_local_player_title">Enable Local Player (alpha)</string>
<string name="enable_local_player_summary">Use a built-in player for local playback. This is still in early development so there will probably be a lot of issues, including conflicts with the existing player.</string> <string name="enable_local_player_summary">Use a built-in player for local playback. This is still in early development so there will probably be a lot of issues, including conflicts with the existing player.</string>
<string name="disable_tablet_ui_title">Disable Tablet UI</string> <string name="force_auto_fullscreen_title">Force Auto Fullscreen</string>
<string name="disable_tablet_ui_summary">Ignore tablet layouts. This is intended for specific workarounds. You may need to restart the app to see the effects.</string> <string name="force_auto_fullscreen_summary">If enabled, when the device is set to landscape, force fullscreen mode even if the device is a tablet or TV.</string>
<string name="disable_tv_ui_title">Disable TV UI</string>
<string name="disable_tv_ui_summary">Ignore TV layouts. This is intended for specific workarounds. You may need to restart the app to see the effects.</string>
<string name="disable_error_reports_title">Disable Error Reporting</string> <string name="disable_error_reports_title">Disable Error Reporting</string>
<string name="disable_error_reports_summary">Prevent all error reporting screens from appearing. This may result in the app behaving unexpectedly. <b>USE AT YOUR OWN RISK!</b></string> <string name="disable_error_reports_summary">Prevent all error reporting screens from appearing. This may result in the app behaving unexpectedly. <b>USE AT YOUR OWN RISK!</b></string>
</resources> </resources>

View file

@ -23,16 +23,9 @@
<SwitchPreference <SwitchPreference
app:iconSpaceReserved="false" app:iconSpaceReserved="false"
android:defaultValue="false" android:defaultValue="false"
android:key="@string/disable_tablet_ui_key" android:key="@string/force_auto_fullscreen_key"
android:summary="@string/disable_tablet_ui_summary" android:summary="@string/force_auto_fullscreen_summary"
android:title="@string/disable_tablet_ui_title"/> android:title="@string/force_auto_fullscreen_title"/>
<SwitchPreference
app:iconSpaceReserved="false"
android:defaultValue="false"
android:key="@string/disable_tv_ui_key"
android:summary="@string/disable_tv_ui_summary"
android:title="@string/disable_tv_ui_title"/>
<SwitchPreference <SwitchPreference
app:iconSpaceReserved="false" app:iconSpaceReserved="false"