feat(YouTube Music - Hide layout components): Add Hide search button setting https://github.com/inotia00/ReVanced_Extended/issues/2850

This commit is contained in:
inotia00
2025-03-24 20:51:43 +09:00
parent 98f2e99061
commit 6dfd88c75e
6 changed files with 53 additions and 4 deletions

View File

@ -9,13 +9,11 @@ import android.view.Window;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.LinearLayout;
import app.revanced.extension.music.settings.Settings;
import app.revanced.extension.shared.utils.ResourceUtils;
/**
* @noinspection ALL
*/
@SuppressWarnings("unused")
public class GeneralPatch {
@ -79,6 +77,13 @@ public class GeneralPatch {
}
}
public static void hideSearchButton(View view) {
if (Settings.HIDE_SEARCH_BUTTON.get()) {
LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(0, 0);
view.setLayoutParams(layoutParams);
}
}
public static boolean hideSoundSearchButton() {
return Settings.HIDE_SOUND_SEARCH_BUTTON.get();
}
@ -123,7 +128,7 @@ public class GeneralPatch {
* <p>
* The {@link AlertDialog#getButton(int)} method must be used after {@link AlertDialog#show()} is called.
* Otherwise {@link AlertDialog#getButton(int)} method will always return null.
* https://stackoverflow.com/a/4604145
* <a href="https://stackoverflow.com/a/4604145">Reference</a>
* <p>
* That's why {@link AlertDialog#show()} is absolutely necessary.
* Instead, use two tricks to hide Alertdialog.

View File

@ -109,6 +109,7 @@ public class Settings extends BaseSettings {
public static final BooleanSetting HIDE_NOTIFICATION_BUTTON = new BooleanSetting("revanced_hide_notification_button", FALSE, true);
public static final BooleanSetting HIDE_PLAYLIST_CARD_SHELF = new BooleanSetting("revanced_hide_playlist_card_shelf", FALSE, true);
public static final BooleanSetting HIDE_SAMPLE_SHELF = new BooleanSetting("revanced_hide_samples_shelf", FALSE, true);
public static final BooleanSetting HIDE_SEARCH_BUTTON = new BooleanSetting("revanced_hide_search_button", FALSE, true);
public static final BooleanSetting HIDE_SOUND_SEARCH_BUTTON = new BooleanSetting("revanced_hide_sound_search_button", FALSE, true);
public static final BooleanSetting HIDE_TAP_TO_UPDATE_BUTTON = new BooleanSetting("revanced_hide_tap_to_update_button", FALSE, true);
public static final BooleanSetting HIDE_VOICE_SEARCH_BUTTON = new BooleanSetting("revanced_hide_voice_search_button", FALSE, true);