Skip to content
This repository has been archived by the owner on Oct 26, 2024. It is now read-only.

Commit

Permalink
fix: Add setting
Browse files Browse the repository at this point in the history
  • Loading branch information
LisoUseInAIKyrios committed Oct 25, 2024
1 parent dabbc3d commit c2cddaf
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import androidx.annotation.Nullable;

import app.revanced.integrations.youtube.patches.playback.speed.CustomPlaybackSpeedPatch;
import app.revanced.integrations.youtube.settings.Settings;

/**
* Abuse LithoFilter for {@link CustomPlaybackSpeedPatch}.
Expand All @@ -13,32 +14,33 @@ public final class PlaybackSpeedMenuFilterPatch extends Filter {
* Old litho based speed selection menu.
*/
public static volatile boolean isOldPlaybackSpeedMenuVisible;

/**
* 0.05x speed selection menu.
*/
public static volatile boolean isPlaybackRateSelectorMenuVisible;

private final StringFilterGroup playbackRateSelector;
private final StringFilterGroup playbackRateSelectorGroup;

public PlaybackSpeedMenuFilterPatch() {
// 0.05x speed menu.
playbackRateSelector = new StringFilterGroup(
null,
// 0.05x litho speed menu.
playbackRateSelectorGroup = new StringFilterGroup(
Settings.CUSTOM_SPEED_MENU,
"playback_rate_selector_menu_sheet.eml-js"
);

// Old litho based speed menu.
var oldPlaybackMenu = new StringFilterGroup(
null,
Settings.CUSTOM_SPEED_MENU,
"playback_speed_sheet_content.eml-js");

addPathCallbacks(playbackRateSelector, oldPlaybackMenu);
addPathCallbacks(playbackRateSelectorGroup, oldPlaybackMenu);
}

@Override
boolean isFiltered(@Nullable String identifier, String path, byte[] protobufBufferArray,
StringFilterGroup matchedGroup, FilterContentType contentType, int contentIndex) {
if (matchedGroup == playbackRateSelector) {
if (matchedGroup == playbackRateSelectorGroup) {
isPlaybackRateSelectorMenuVisible = true;
} else {
isOldPlaybackSpeedMenuVisible = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ public static void onFlyoutMenuCreate(RecyclerView recyclerView) {
return;
}
} catch (Exception ex) {
Logger.printException(() -> "isPlaybackRateSelectorMenuVisible failure failure: ", ex);
Logger.printException(() -> "isPlaybackRateSelectorMenuVisible failure", ex);
}

try {
Expand All @@ -134,7 +134,7 @@ public static void onFlyoutMenuCreate(RecyclerView recyclerView) {
}
}
} catch (Exception ex) {
Logger.printException(() -> "isOldPlaybackSpeedMenuVisible failure: ", ex);
Logger.printException(() -> "isOldPlaybackSpeedMenuVisible failure", ex);
}
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,13 @@ public class Settings extends BaseSettings {
public static final BooleanSetting REMEMBER_VIDEO_QUALITY_LAST_SELECTED = new BooleanSetting("revanced_remember_video_quality_last_selected", FALSE);
public static final IntegerSetting VIDEO_QUALITY_DEFAULT_WIFI = new IntegerSetting("revanced_video_quality_default_wifi", -2);
public static final IntegerSetting VIDEO_QUALITY_DEFAULT_MOBILE = new IntegerSetting("revanced_video_quality_default_mobile", -2);
// Speed
public static final BooleanSetting REMEMBER_PLAYBACK_SPEED_LAST_SELECTED = new BooleanSetting("revanced_remember_playback_speed_last_selected", FALSE);
public static final BooleanSetting CUSTOM_SPEED_MENU = new BooleanSetting("revanced_custom_speed_menu", TRUE);
public static final FloatSetting PLAYBACK_SPEED_DEFAULT = new FloatSetting("revanced_playback_speed_default", 1.0f);
public static final StringSetting CUSTOM_PLAYBACK_SPEEDS = new StringSetting("revanced_custom_playback_speeds",
"0.25\n0.5\n0.75\n0.9\n0.95\n1.0\n1.05\n1.1\n1.25\n1.5\n1.75\n2.0\n3.0\n4.0\n5.0", true);

@Deprecated // Patch is obsolete and no longer works with 19.09+
public static final BooleanSetting HDR_AUTO_BRIGHTNESS = new BooleanSetting("revanced_hdr_auto_brightness", TRUE);

Expand Down

0 comments on commit c2cddaf

Please sign in to comment.