feat(YouTube Music - Navigation bar components): Add Enable custom navigation bar color setting, Remove Set navigation bar to black setting

This commit is contained in:
inotia00
2025-01-18 20:13:37 +09:00
parent 109e23d426
commit 0fb493410e
5 changed files with 38 additions and 14 deletions

View File

@ -1,5 +1,6 @@
package app.revanced.extension.music.patches.navigation;
import static app.revanced.extension.shared.utils.StringRef.str;
import static app.revanced.extension.shared.utils.Utils.hideViewUnderCondition;
import android.graphics.Color;
@ -11,6 +12,7 @@ import androidx.annotation.NonNull;
import app.revanced.extension.music.patches.utils.PatchStatus;
import app.revanced.extension.music.settings.Settings;
import app.revanced.extension.shared.utils.ResourceUtils;
import app.revanced.extension.shared.utils.Utils;
@SuppressWarnings("unused")
public class NavigationPatch {
@ -20,10 +22,19 @@ public class NavigationPatch {
public static Enum<?> lastPivotTab;
public static int enableBlackNavigationBar() {
return Settings.ENABLE_BLACK_NAVIGATION_BAR.get()
? Color.BLACK
: colorGrey12;
public static int enableCustomNavigationBarColor() {
try {
if (Settings.ENABLE_CUSTOM_NAVIGATION_BAR_COLOR.get()) {
return Color.parseColor(Settings.ENABLE_CUSTOM_NAVIGATION_BAR_COLOR_VALUE.get());
}
} catch (Exception ex) {
Utils.showToastShort(str("revanced_custom_navigation_bar_color_value_invalid_invalid_toast"));
Utils.showToastShort(str("revanced_extended_reset_to_default_toast"));
app.revanced.extension.youtube.settings.Settings.ENABLE_CUSTOM_SEEKBAR_COLOR_VALUE.resetToDefault();
Settings.ENABLE_CUSTOM_NAVIGATION_BAR_COLOR_VALUE.resetToDefault();
}
return colorGrey12;
}
public static void hideNavigationLabel(TextView textview) {

View File

@ -117,6 +117,8 @@ public class Settings extends BaseSettings {
// PreferenceScreen: Navigation Bar
public static final BooleanSetting ENABLE_CUSTOM_NAVIGATION_BAR_COLOR = new BooleanSetting("revanced_enable_custom_navigation_bar_color", FALSE, true);
public static final StringSetting ENABLE_CUSTOM_NAVIGATION_BAR_COLOR_VALUE = new StringSetting("revanced_custom_navigation_bar_color_value", "#000000", true);
public static final BooleanSetting HIDE_NAVIGATION_HOME_BUTTON = new BooleanSetting("revanced_hide_navigation_home_button", FALSE, true);
public static final BooleanSetting HIDE_NAVIGATION_SAMPLES_BUTTON = new BooleanSetting("revanced_hide_navigation_samples_button", FALSE, true);
public static final BooleanSetting HIDE_NAVIGATION_EXPLORE_BUTTON = new BooleanSetting("revanced_hide_navigation_explore_button", FALSE, true);
@ -124,7 +126,6 @@ public class Settings extends BaseSettings {
public static final BooleanSetting HIDE_NAVIGATION_UPGRADE_BUTTON = new BooleanSetting("revanced_hide_navigation_upgrade_button", TRUE, true);
public static final BooleanSetting HIDE_NAVIGATION_BAR = new BooleanSetting("revanced_hide_navigation_bar", FALSE, true);
public static final BooleanSetting HIDE_NAVIGATION_LABEL = new BooleanSetting("revanced_hide_navigation_label", FALSE, true);
public static final BooleanSetting ENABLE_BLACK_NAVIGATION_BAR = new BooleanSetting("revanced_enable_black_navigation_bar", FALSE);
// PreferenceScreen: Player
@ -251,6 +252,7 @@ public class Settings extends BaseSettings {
CUSTOM_FILTER_STRINGS.key,
CUSTOM_PLAYBACK_SPEEDS.key,
DISABLE_MUSIC_VIDEO_IN_ALBUM_REDIRECT_TYPE.key,
ENABLE_CUSTOM_NAVIGATION_BAR_COLOR_VALUE.key,
EXTERNAL_DOWNLOADER_PACKAGE_NAME.key,
HIDE_ACCOUNT_MENU_FILTER_STRINGS.key,
SB_API_URL.key,

View File

@ -5,6 +5,7 @@ import static app.revanced.extension.music.settings.Settings.CHANGE_START_PAGE;
import static app.revanced.extension.music.settings.Settings.CUSTOM_FILTER_STRINGS;
import static app.revanced.extension.music.settings.Settings.CUSTOM_PLAYBACK_SPEEDS;
import static app.revanced.extension.music.settings.Settings.DISABLE_MUSIC_VIDEO_IN_ALBUM_REDIRECT_TYPE;
import static app.revanced.extension.music.settings.Settings.ENABLE_CUSTOM_NAVIGATION_BAR_COLOR_VALUE;
import static app.revanced.extension.music.settings.Settings.EXTERNAL_DOWNLOADER_PACKAGE_NAME;
import static app.revanced.extension.music.settings.Settings.HIDE_ACCOUNT_MENU_FILTER_STRINGS;
import static app.revanced.extension.music.settings.Settings.OPEN_DEFAULT_APP_SETTINGS;
@ -140,6 +141,7 @@ public class ReVancedPreferenceFragment extends PreferenceFragment {
} else if (settings.equals(BYPASS_IMAGE_REGION_RESTRICTIONS_DOMAIN)
|| settings.equals(CUSTOM_FILTER_STRINGS)
|| settings.equals(CUSTOM_PLAYBACK_SPEEDS)
|| settings.equals(ENABLE_CUSTOM_NAVIGATION_BAR_COLOR_VALUE)
|| settings.equals(HIDE_ACCOUNT_MENU_FILTER_STRINGS)
|| settings.equals(RETURN_YOUTUBE_USERNAME_YOUTUBE_DATA_API_V3_DEVELOPER_KEY)) {
ResettableEditTextPreference.showDialog(mActivity, stringSetting);