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

fix(YouTube - Searchbar): Hide searchbar in RYD and Sponsorblock sections #13

Merged
merged 1 commit into from
May 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import android.preference.PreferenceManager;
import android.preference.PreferenceScreen;
import android.preference.SwitchPreference;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import android.widget.Toolbar;
Expand All @@ -29,6 +30,7 @@
import app.revanced.integrations.youtube.settings.Settings;

/** @noinspection deprecation*/
@SuppressWarnings("deprecation")
public class ReturnYouTubeDislikePreferenceFragment extends PreferenceFragment {

/**
Expand Down Expand Up @@ -163,6 +165,12 @@ public void onCreate(Bundle savedInstanceState) {
return false;
});
aboutCategory.addPreference(aboutWebsitePreference);

// remove the search bar
View searchBar = getActivity().findViewById(getIdIdentifier("search_view"));
if (searchBar != null) {
searchBar.setVisibility(View.GONE);
}
} catch (Exception ex) {
Logger.printException(() -> "onCreate failure", ex);
}
Expand All @@ -177,4 +185,23 @@ public void onDetach() {
toolbarTextView.setText(ResourceUtils.getString("revanced_extended_settings_title"));
}

@Override
public void onResume() {
super.onResume();
// Hide the search bar
View searchBar = getActivity().findViewById(getIdIdentifier("search_view"));
if (searchBar != null) {
searchBar.setVisibility(View.GONE);
}
}

@Override
public void onPause() {
super.onPause();
// Show the search bar
View searchBar = getActivity().findViewById(getIdIdentifier("search_view"));
if (searchBar != null) {
searchBar.setVisibility(View.VISIBLE);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import android.text.Html;
import android.text.InputType;
import android.util.TypedValue;
import android.view.View;
import android.view.ViewGroup;
import android.widget.EditText;
import android.widget.TextView;
Expand All @@ -35,6 +36,7 @@

import java.util.Objects;

import app.revanced.integrations.R;
import app.revanced.integrations.shared.settings.Setting;
import app.revanced.integrations.shared.settings.preference.ResettableEditTextPreference;
import app.revanced.integrations.shared.utils.Logger;
Expand Down Expand Up @@ -177,11 +179,37 @@ public void onCreate(Bundle savedInstanceState) {
addAboutCategory(context, preferenceScreen);

updateUI();

// remove the search bar
View searchBar = getActivity().findViewById(getIdIdentifier("search_view"));
if (searchBar != null) {
searchBar.setVisibility(View.GONE);
}
} catch (Exception ex) {
Logger.printException(() -> "onCreate failure", ex);
}
}

@Override
public void onResume() {
super.onResume();
// Hide the search bar
View searchBar = getActivity().findViewById(getIdIdentifier("search_view"));
if (searchBar != null) {
searchBar.setVisibility(View.GONE);
}
}

@Override
public void onPause() {
super.onPause();
// Show the search bar
View searchBar = getActivity().findViewById(getIdIdentifier("search_view"));
if (searchBar != null) {
searchBar.setVisibility(View.VISIBLE);
}
}

@Override
public void onDetach() {
super.onDetach();
Expand Down
Loading