chore: Lint code

This commit is contained in:
inotia00 2025-03-26 15:08:28 +09:00
parent a764e3aea3
commit 9d37e31a24
16 changed files with 35 additions and 41 deletions

View File

@ -108,13 +108,13 @@ public class FlyoutPatch {
if (REPLACE_FLYOUT_MENU_DISMISS_QUEUE.get() && if (REPLACE_FLYOUT_MENU_DISMISS_QUEUE.get() &&
textView.getParent() instanceof ViewGroup clickAbleArea) { textView.getParent() instanceof ViewGroup clickAbleArea) {
runOnMainThreadDelayed(() -> { runOnMainThreadDelayed(() -> {
textView.setText(str("revanced_replace_flyout_menu_dismiss_queue_watch_on_youtube_label")); textView.setText(str("revanced_replace_flyout_menu_dismiss_queue_watch_on_youtube_label"));
imageView.setImageResource(getIdentifier("yt_outline_youtube_logo_icon_vd_theme_24", ResourceType.DRAWABLE, clickAbleArea.getContext())); imageView.setImageResource(getIdentifier("yt_outline_youtube_logo_icon_vd_theme_24", ResourceType.DRAWABLE, clickAbleArea.getContext()));
clickAbleArea.setOnClickListener(view -> { clickAbleArea.setOnClickListener(view -> {
clickView(touchOutSideViewRef.get()); clickView(touchOutSideViewRef.get());
VideoUtils.openInYouTube(); VideoUtils.openInYouTube();
}); });
}, 0L }, 0L
); );
} }
} }
@ -126,14 +126,14 @@ public class FlyoutPatch {
textView.getParent() instanceof ViewGroup clickAbleArea textView.getParent() instanceof ViewGroup clickAbleArea
) { ) {
runOnMainThreadDelayed(() -> { runOnMainThreadDelayed(() -> {
textView.setText(str("playback_rate_title")); textView.setText(str("playback_rate_title"));
imageView.setImageResource(getIdentifier("yt_outline_play_arrow_half_circle_black_24", ResourceType.DRAWABLE, clickAbleArea.getContext())); imageView.setImageResource(getIdentifier("yt_outline_play_arrow_half_circle_black_24", ResourceType.DRAWABLE, clickAbleArea.getContext()));
imageView.setColorFilter(cf); imageView.setColorFilter(cf);
clickAbleArea.setOnClickListener(view -> { clickAbleArea.setOnClickListener(view -> {
clickView(touchOutSideViewRef.get()); clickView(touchOutSideViewRef.get());
VideoUtils.showPlaybackSpeedFlyoutMenu(); VideoUtils.showPlaybackSpeedFlyoutMenu();
}); });
}, 0L }, 0L
); );
} }
} }

View File

@ -9,7 +9,6 @@ import androidx.annotation.Nullable;
import org.apache.commons.lang3.BooleanUtils; import org.apache.commons.lang3.BooleanUtils;
import java.util.Arrays;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
import java.util.Map; import java.util.Map;

View File

@ -37,7 +37,7 @@ public class FullscreenAdsPatch {
* Therefore, make sure that the dialog contains the ads at the beginning of the Method * Therefore, make sure that the dialog contains the ads at the beginning of the Method
* *
* @param bytes proto buffer array * @param bytes proto buffer array
* @param type dialog type (similar to {@link Enum#ordinal()}) * @param type dialog type (similar to {@link Enum#ordinal()})
*/ */
public static void checkDialog(byte[] bytes, int type) { public static void checkDialog(byte[] bytes, int type) {
if (!HIDE_FULLSCREEN_ADS) { if (!HIDE_FULLSCREEN_ADS) {

View File

@ -2,7 +2,6 @@ package app.revanced.extension.shared.patches;
import static java.lang.Boolean.FALSE; import static java.lang.Boolean.FALSE;
import static java.lang.Boolean.TRUE; import static java.lang.Boolean.TRUE;
import static app.revanced.extension.shared.utils.Utils.newSpanUsingStylingOfAnotherSpan; import static app.revanced.extension.shared.utils.Utils.newSpanUsingStylingOfAnotherSpan;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;

View File

@ -2,8 +2,8 @@ package app.revanced.extension.shared.patches;
import android.net.Uri; import android.net.Uri;
import app.revanced.extension.shared.utils.Logger;
import app.revanced.extension.shared.settings.BaseSettings; import app.revanced.extension.shared.settings.BaseSettings;
import app.revanced.extension.shared.utils.Logger;
@SuppressWarnings("unused") @SuppressWarnings("unused")
public final class WatchHistoryPatch { public final class WatchHistoryPatch {

View File

@ -149,7 +149,7 @@ public abstract class AbstractPreferenceFragment extends PreferenceFragment {
* Updates all Preferences values and their availability using the current values in {@link Setting}. * Updates all Preferences values and their availability using the current values in {@link Setting}.
*/ */
protected void updateUIToSettingValues() { protected void updateUIToSettingValues() {
updatePreferenceScreen(getPreferenceScreen(), true,true); updatePreferenceScreen(getPreferenceScreen(), true, true);
} }
/** /**
@ -246,7 +246,7 @@ public abstract class AbstractPreferenceFragment extends PreferenceFragment {
/** /**
* Updates a UI Preference with the {@link Setting} that backs it. * Updates a UI Preference with the {@link Setting} that backs it.
* *
* @param syncSetting If the UI should be synced {@link Setting} <-> Preference * @param syncSetting If the UI should be synced {@link Setting} <-> Preference
* @param applySettingToPreference If true, then apply {@link Setting} -> Preference. * @param applySettingToPreference If true, then apply {@link Setting} -> Preference.
* If false, then apply {@link Setting} <- Preference. * If false, then apply {@link Setting} <- Preference.
*/ */

View File

@ -608,10 +608,10 @@ public class Utils {
* <br> * <br>
* Be aware the on start action can be called multiple times for some situations, * Be aware the on start action can be called multiple times for some situations,
* such as the user switching apps without dismissing the dialog then switching back to this app. * such as the user switching apps without dismissing the dialog then switching back to this app.
*<br> * <br>
* This method is only useful during app startup and multiple patches may show their own dialog, * This method is only useful during app startup and multiple patches may show their own dialog,
* and the most important dialog can be called last (using a delay) so it's always on top. * and the most important dialog can be called last (using a delay) so it's always on top.
*<br> * <br>
* For all other situations it's better to not use this method and * For all other situations it's better to not use this method and
* call {@link AlertDialog#show()} on the dialog. * call {@link AlertDialog#show()} on the dialog.
*/ */

View File

@ -6,7 +6,6 @@ import app.revanced.extension.shared.patches.components.ByteArrayFilterGroup;
import app.revanced.extension.shared.patches.components.ByteArrayFilterGroupList; import app.revanced.extension.shared.patches.components.ByteArrayFilterGroupList;
import app.revanced.extension.shared.patches.components.Filter; import app.revanced.extension.shared.patches.components.Filter;
import app.revanced.extension.shared.patches.components.StringFilterGroup; import app.revanced.extension.shared.patches.components.StringFilterGroup;
import app.revanced.extension.shared.settings.BooleanSetting;
import app.revanced.extension.youtube.settings.Settings; import app.revanced.extension.youtube.settings.Settings;
@SuppressWarnings("unused") @SuppressWarnings("unused")

View File

@ -6,7 +6,6 @@ import app.revanced.extension.shared.settings.Setting.Availability
import app.revanced.extension.shared.utils.Logger import app.revanced.extension.shared.utils.Logger
import app.revanced.extension.youtube.settings.Settings import app.revanced.extension.youtube.settings.Settings
import org.apache.commons.lang3.StringUtils import org.apache.commons.lang3.StringUtils
import kotlin.Boolean
@Suppress("unused") @Suppress("unused")
object ChangeStartPagePatch { object ChangeStartPagePatch {
@ -44,7 +43,7 @@ object ChangeStartPagePatch {
} }
appLaunched = true appLaunched = true
Logger.printDebug{ "Changing browseId to $browseId" } Logger.printDebug { "Changing browseId to $browseId" }
return browseId return browseId
} }

View File

@ -39,7 +39,7 @@ public final class DownloadActionsPatch {
* <p> * <p>
* Appears to always be called from the main thread. * Appears to always be called from the main thread.
*/ */
public static boolean inAppVideoDownloadButtonOnClick(@Nullable Map<Object, Object> map,Object offlineVideoEndpointOuterClass, public static boolean inAppVideoDownloadButtonOnClick(@Nullable Map<Object, Object> map, Object offlineVideoEndpointOuterClass,
@Nullable String videoId) { @Nullable String videoId) {
try { try {
if (OVERRIDE_VIDEO_DOWNLOAD_BUTTON && StringUtils.isNotEmpty(videoId)) { if (OVERRIDE_VIDEO_DOWNLOAD_BUTTON && StringUtils.isNotEmpty(videoId)) {

View File

@ -119,9 +119,9 @@ public class GeneralPatch {
Settings.DISABLE_LAYOUT_UPDATES.get(); Settings.DISABLE_LAYOUT_UPDATES.get();
/** /**
* @param key Keys to be added to the header of CronetBuilder. * @param key Keys to be added to the header of CronetBuilder.
* @param value Values to be added to the header of CronetBuilder. * @param value Values to be added to the header of CronetBuilder.
* @return Empty value if setting is enabled. * @return Empty value if setting is enabled.
*/ */
public static String disableLayoutUpdates(String key, String value) { public static String disableLayoutUpdates(String key, String value) {
if (DISABLE_LAYOUT_UPDATES && StringUtils.equalsAny(key, REQUEST_HEADER_KEYS)) { if (DISABLE_LAYOUT_UPDATES && StringUtils.equalsAny(key, REQUEST_HEADER_KEYS)) {

View File

@ -43,8 +43,8 @@ public final class OpenChannelOfLiveAvatarPatch {
/** /**
* Injection point. * Injection point.
* *
* @param playbackStartDescriptorMap map containing information about PlaybackStartDescriptor * @param playbackStartDescriptorMap map containing information about PlaybackStartDescriptor
* @param newlyLoadedVideoId id of the current video * @param newlyLoadedVideoId id of the current video
*/ */
public static void fetchChannelId(@NonNull Map<Object, Object> playbackStartDescriptorMap, String newlyLoadedVideoId) { public static void fetchChannelId(@NonNull Map<Object, Object> playbackStartDescriptorMap, String newlyLoadedVideoId) {
try { try {

View File

@ -2,7 +2,6 @@ package app.revanced.extension.youtube.patches.misc;
import app.revanced.extension.shared.settings.BooleanSetting; import app.revanced.extension.shared.settings.BooleanSetting;
import app.revanced.extension.youtube.settings.Settings; import app.revanced.extension.youtube.settings.Settings;
import app.revanced.extension.youtube.shared.PlayerType;
import app.revanced.extension.youtube.shared.ShortsPlayerState; import app.revanced.extension.youtube.shared.ShortsPlayerState;
@SuppressWarnings("unused") @SuppressWarnings("unused")

View File

@ -1,5 +1,7 @@
package app.revanced.extension.youtube.patches.player; package app.revanced.extension.youtube.patches.player;
import static app.revanced.extension.youtube.patches.player.ActionButtonsPatch.ActionButton.REMIX;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.ArrayUtils;
@ -8,8 +10,6 @@ import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import static app.revanced.extension.youtube.patches.player.ActionButtonsPatch.ActionButton.*;
import app.revanced.extension.shared.settings.BooleanSetting; import app.revanced.extension.shared.settings.BooleanSetting;
import app.revanced.extension.shared.utils.Logger; import app.revanced.extension.shared.utils.Logger;
import app.revanced.extension.shared.utils.Utils; import app.revanced.extension.shared.utils.Utils;
@ -106,8 +106,8 @@ public class ActionButtonsPatch {
/** /**
* Injection point. * Injection point.
* *
* @param list Type list of litho components * @param list Type list of litho components
* @param identifier Identifier of litho components * @param identifier Identifier of litho components
*/ */
public static List<Object> hideActionButtonByIndex(@Nullable List<Object> list, @Nullable String identifier) { public static List<Object> hideActionButtonByIndex(@Nullable List<Object> list, @Nullable String identifier) {
try { try {

View File

@ -24,7 +24,6 @@ import java.util.concurrent.atomic.AtomicBoolean;
import app.revanced.extension.shared.settings.BaseSettings; import app.revanced.extension.shared.settings.BaseSettings;
import app.revanced.extension.shared.settings.BooleanSetting; import app.revanced.extension.shared.settings.BooleanSetting;
import app.revanced.extension.shared.settings.IntegerSetting; import app.revanced.extension.shared.settings.IntegerSetting;
import app.revanced.extension.shared.settings.StringSetting;
import app.revanced.extension.shared.utils.Logger; import app.revanced.extension.shared.utils.Logger;
import app.revanced.extension.shared.utils.ResourceUtils; import app.revanced.extension.shared.utils.ResourceUtils;
import app.revanced.extension.shared.utils.Utils; import app.revanced.extension.shared.utils.Utils;
@ -471,8 +470,8 @@ public class PlayerPatch {
* Used in YouTube 20.05.46+. * Used in YouTube 20.05.46+.
*/ */
public static void disableAutoPlayerPopupPanels(@NonNull String newlyLoadedChannelId, @NonNull String newlyLoadedChannelName, public static void disableAutoPlayerPopupPanels(@NonNull String newlyLoadedChannelId, @NonNull String newlyLoadedChannelName,
@NonNull String newlyLoadedVideoId, @NonNull String newlyLoadedVideoTitle, @NonNull String newlyLoadedVideoId, @NonNull String newlyLoadedVideoTitle,
final long newlyLoadedVideoLength, boolean newlyLoadedLiveStreamValue) { final long newlyLoadedVideoLength, boolean newlyLoadedLiveStreamValue) {
if (Settings.DISABLE_AUTO_PLAYER_POPUP_PANELS.get() && newVideoStarted.compareAndSet(false, true)) { if (Settings.DISABLE_AUTO_PLAYER_POPUP_PANELS.get() && newVideoStarted.compareAndSet(false, true)) {
Utils.runOnMainThreadDelayed(() -> newVideoStarted.compareAndSet(true, false), 3000L); Utils.runOnMainThreadDelayed(() -> newVideoStarted.compareAndSet(true, false), 3000L);
} }

View File

@ -47,7 +47,7 @@ public class SeekbarColorPatch {
/** /**
* Empty seekbar gradient, if hide seekbar in feed is enabled. * Empty seekbar gradient, if hide seekbar in feed is enabled.
*/ */
private static final int[] HIDDEN_SEEKBAR_GRADIENT_COLORS = { 0x0, 0x0 }; private static final int[] HIDDEN_SEEKBAR_GRADIENT_COLORS = {0x0, 0x0};
/** /**
* Default YouTube seekbar color brightness. * Default YouTube seekbar color brightness.