mirror of
https://github.com/inotia00/revanced-patches.git
synced 2025-06-13 13:47:42 +02:00
feat(YouTube): Support version 19.44.39
This commit is contained in:
@ -18,6 +18,7 @@ public class SponsorBlockSettings {
|
||||
public void settingsImported(@Nullable Context context) {
|
||||
SegmentCategory.loadAllCategoriesFromSettings();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void settingsExported(@Nullable Context context) {
|
||||
}
|
||||
|
@ -2,7 +2,6 @@ package app.revanced.extension.music.utils;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.content.Context;
|
||||
import android.util.TypedValue;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.FrameLayout;
|
||||
|
||||
|
@ -64,14 +64,14 @@ public class GmsCoreSupport {
|
||||
// Use a delay to allow the activity to finish initializing.
|
||||
// Otherwise, if device is in dark mode the dialog is shown with wrong color scheme.
|
||||
Utils.runOnMainThreadDelayed(() ->
|
||||
// Do not set cancelable to false, to allow using back button to skip the action,
|
||||
// just in case the battery change can never be satisfied.
|
||||
new AlertDialog.Builder(context)
|
||||
.setIconAttribute(android.R.attr.alertDialogIcon)
|
||||
.setTitle(str("gms_core_dialog_title"))
|
||||
.setMessage(str(dialogMessageRef))
|
||||
.setPositiveButton(str(positiveButtonTextRef), onPositiveClickListener)
|
||||
.show(),
|
||||
// Do not set cancelable to false, to allow using back button to skip the action,
|
||||
// just in case the battery change can never be satisfied.
|
||||
new AlertDialog.Builder(context)
|
||||
.setIconAttribute(android.R.attr.alertDialogIcon)
|
||||
.setTitle(str("gms_core_dialog_title"))
|
||||
.setMessage(str(dialogMessageRef))
|
||||
.setPositiveButton(str(positiveButtonTextRef), onPositiveClickListener)
|
||||
.show(),
|
||||
100
|
||||
);
|
||||
}
|
||||
|
@ -74,6 +74,11 @@ public class PlayerPatch {
|
||||
|
||||
// region [Ambient mode control] patch
|
||||
|
||||
/**
|
||||
* Constant found in: androidx.window.embedding.DividerAttributes
|
||||
*/
|
||||
private static final int DIVIDER_ATTRIBUTES_COLOR_SYSTEM_DEFAULT = -16777216;
|
||||
|
||||
public static boolean bypassAmbientModeRestrictions(boolean original) {
|
||||
return (!Settings.BYPASS_AMBIENT_MODE_RESTRICTIONS.get() && original) || Settings.DISABLE_AMBIENT_MODE.get();
|
||||
}
|
||||
@ -82,6 +87,14 @@ public class PlayerPatch {
|
||||
return !Settings.DISABLE_AMBIENT_MODE_IN_FULLSCREEN.get();
|
||||
}
|
||||
|
||||
public static int getFullScreenBackgroundColor(int originalColor) {
|
||||
if (Settings.DISABLE_AMBIENT_MODE_IN_FULLSCREEN.get()) {
|
||||
return DIVIDER_ATTRIBUTES_COLOR_SYSTEM_DEFAULT;
|
||||
}
|
||||
|
||||
return originalColor;
|
||||
}
|
||||
|
||||
// endregion
|
||||
|
||||
// region [Change player flyout menu toggles] patch
|
||||
@ -424,6 +437,35 @@ public class PlayerPatch {
|
||||
return !Settings.HIDE_PLAYER_PREVIOUS_NEXT_BUTTON.get() && previousOrNextButtonVisible;
|
||||
}
|
||||
|
||||
private static final int playerControlPreviousButtonTouchAreaId =
|
||||
ResourceUtils.getIdIdentifier("player_control_previous_button_touch_area");
|
||||
private static final int playerControlNextButtonTouchAreaId =
|
||||
ResourceUtils.getIdIdentifier("player_control_next_button_touch_area");
|
||||
|
||||
public static void hidePreviousNextButtons(View parentView) {
|
||||
if (!Settings.HIDE_PLAYER_PREVIOUS_NEXT_BUTTON.get()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Must use a deferred call to main thread to hide the button.
|
||||
// Otherwise the layout crashes if set to hidden now.
|
||||
Utils.runOnMainThread(() -> {
|
||||
hideView(parentView, playerControlPreviousButtonTouchAreaId);
|
||||
hideView(parentView, playerControlNextButtonTouchAreaId);
|
||||
});
|
||||
}
|
||||
|
||||
private static void hideView(View parentView, int resourceId) {
|
||||
View nextPreviousButton = parentView.findViewById(resourceId);
|
||||
|
||||
if (nextPreviousButton == null) {
|
||||
Logger.printException(() -> "Could not find player previous / next button");
|
||||
return;
|
||||
}
|
||||
|
||||
Utils.hideViewByRemovingFromParentUnderCondition(true, nextPreviousButton);
|
||||
}
|
||||
|
||||
public static boolean hideMusicButton() {
|
||||
return Settings.HIDE_PLAYER_YOUTUBE_MUSIC_BUTTON.get();
|
||||
}
|
||||
|
@ -1,5 +1,10 @@
|
||||
package app.revanced.extension.youtube.patches.shorts;
|
||||
|
||||
import static app.revanced.extension.shared.utils.ResourceUtils.getString;
|
||||
import static app.revanced.extension.shared.utils.Utils.dpToPx;
|
||||
import static app.revanced.extension.youtube.patches.components.ShortsCustomActionsFilter.isShortsFlyoutMenuVisible;
|
||||
import static app.revanced.extension.youtube.utils.ExtendedUtils.isSpoofingToLessThan;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.content.Context;
|
||||
import android.graphics.ColorFilter;
|
||||
@ -10,13 +15,26 @@ import android.graphics.drawable.Drawable;
|
||||
import android.graphics.drawable.GradientDrawable;
|
||||
import android.graphics.drawable.StateListDrawable;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.view.*;
|
||||
import android.view.Gravity;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.ScrollView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
import app.revanced.extension.shared.settings.BooleanSetting;
|
||||
import app.revanced.extension.shared.utils.Logger;
|
||||
import app.revanced.extension.shared.utils.ResourceUtils;
|
||||
@ -26,17 +44,6 @@ import app.revanced.extension.youtube.settings.Settings;
|
||||
import app.revanced.extension.youtube.shared.ShortsPlayerState;
|
||||
import app.revanced.extension.youtube.utils.ThemeUtils;
|
||||
import app.revanced.extension.youtube.utils.VideoUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
import static app.revanced.extension.shared.utils.ResourceUtils.getString;
|
||||
import static app.revanced.extension.shared.utils.Utils.dpToPx;
|
||||
import static app.revanced.extension.youtube.patches.components.ShortsCustomActionsFilter.isShortsFlyoutMenuVisible;
|
||||
import static app.revanced.extension.youtube.utils.ExtendedUtils.isSpoofingToLessThan;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public final class CustomActionsPatch {
|
||||
|
@ -34,6 +34,7 @@ public class SponsorBlockSettings {
|
||||
SegmentCategory.loadAllCategoriesFromSettings();
|
||||
SponsorBlockSettingsPreference.updateSegmentCategories();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void settingsExported(@Nullable Context context) {
|
||||
showExportWarningIfNeeded(context);
|
||||
|
Reference in New Issue
Block a user