mirror of
https://github.com/inotia00/revanced-patches.git
synced 2025-06-12 21:27:43 +02:00
feat(YouTube - Fullscreen components): Remove Force fullscreen
setting
This commit is contained in:
@ -5,8 +5,6 @@ import static app.revanced.extension.shared.utils.Utils.hideViewByRemovingFromPa
|
||||
import static app.revanced.extension.shared.utils.Utils.hideViewUnderCondition;
|
||||
import static app.revanced.extension.youtube.utils.ExtendedUtils.validateValue;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.pm.ActivityInfo;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.util.TypedValue;
|
||||
import android.view.View;
|
||||
@ -20,7 +18,6 @@ import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.coordinatorlayout.widget.CoordinatorLayout;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.Objects;
|
||||
|
||||
import app.revanced.extension.shared.settings.BaseSettings;
|
||||
@ -328,37 +325,6 @@ public class PlayerPatch {
|
||||
Utils.runOnMainThreadDelayed(() -> isScreenOn = false, Settings.KEEP_LANDSCAPE_MODE_TIMEOUT.get());
|
||||
}
|
||||
|
||||
private static WeakReference<Activity> watchDescriptorActivityRef = new WeakReference<>(null);
|
||||
private static volatile boolean isLandScapeVideo = true;
|
||||
|
||||
public static void setWatchDescriptorActivity(Activity activity) {
|
||||
watchDescriptorActivityRef = new WeakReference<>(activity);
|
||||
}
|
||||
|
||||
public static boolean forceFullscreen(boolean original) {
|
||||
if (!Settings.FORCE_FULLSCREEN.get())
|
||||
return original;
|
||||
|
||||
Utils.runOnMainThreadDelayed(PlayerPatch::setOrientation, 1000);
|
||||
return true;
|
||||
}
|
||||
|
||||
private static void setOrientation() {
|
||||
final Activity watchDescriptorActivity = watchDescriptorActivityRef.get();
|
||||
final int requestedOrientation = isLandScapeVideo
|
||||
? ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE
|
||||
: watchDescriptorActivity.getRequestedOrientation();
|
||||
|
||||
watchDescriptorActivity.setRequestedOrientation(requestedOrientation);
|
||||
}
|
||||
|
||||
public static void setVideoPortrait(int width, int height) {
|
||||
if (!Settings.FORCE_FULLSCREEN.get())
|
||||
return;
|
||||
|
||||
isLandScapeVideo = width > height;
|
||||
}
|
||||
|
||||
// endregion
|
||||
|
||||
// region [Hide comments component] patch
|
||||
|
@ -353,7 +353,6 @@ public class Settings extends BaseSettings {
|
||||
|
||||
public static final BooleanSetting DISABLE_LANDSCAPE_MODE = new BooleanSetting("revanced_disable_landscape_mode", FALSE, true);
|
||||
public static final BooleanSetting ENABLE_COMPACT_CONTROLS_OVERLAY = new BooleanSetting("revanced_enable_compact_controls_overlay", FALSE, true);
|
||||
public static final BooleanSetting FORCE_FULLSCREEN = new BooleanSetting("revanced_force_fullscreen", FALSE, true);
|
||||
public static final BooleanSetting KEEP_LANDSCAPE_MODE = new BooleanSetting("revanced_keep_landscape_mode", FALSE, true);
|
||||
public static final LongSetting KEEP_LANDSCAPE_MODE_TIMEOUT = new LongSetting("revanced_keep_landscape_mode_timeout", 3000L, true);
|
||||
|
||||
|
@ -49,7 +49,6 @@ public class ReVancedSettingsPreference extends ReVancedPreferenceFragment {
|
||||
ChangeHeaderPreferenceLinks();
|
||||
ExternalDownloaderPreferenceLinks();
|
||||
FullScreenPanelPreferenceLinks();
|
||||
LayoutOverrideLinks();
|
||||
MiniPlayerPreferenceLinks();
|
||||
NavigationPreferenceLinks();
|
||||
RYDPreferenceLinks();
|
||||
@ -93,16 +92,6 @@ public class ReVancedSettingsPreference extends ReVancedPreferenceFragment {
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Enable/Disable Layout Override Preference
|
||||
*/
|
||||
private static void LayoutOverrideLinks() {
|
||||
enableDisablePreferences(
|
||||
ExtendedUtils.isTablet(),
|
||||
Settings.FORCE_FULLSCREEN
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Enable/Disable Preferences not working in tablet layout
|
||||
*/
|
||||
@ -139,17 +128,6 @@ public class ReVancedSettingsPreference extends ReVancedPreferenceFragment {
|
||||
Settings.HIDE_QUICK_ACTIONS_SAVE_TO_PLAYLIST_BUTTON,
|
||||
Settings.HIDE_QUICK_ACTIONS_SHARE_BUTTON
|
||||
);
|
||||
|
||||
enableDisablePreferences(
|
||||
Settings.DISABLE_LANDSCAPE_MODE.get(),
|
||||
Settings.FORCE_FULLSCREEN
|
||||
);
|
||||
|
||||
enableDisablePreferences(
|
||||
Settings.FORCE_FULLSCREEN.get(),
|
||||
Settings.DISABLE_LANDSCAPE_MODE
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user