@@ -35,6 +35,7 @@ public class MediaPreferences extends BravePreferenceFragment
35
35
"hide_youtube_recommended_content" ;
36
36
private static final String PREF_HIDE_YOUTUBE_DISTRACTING_ELEMENTS =
37
37
"hide_youtube_distracting_elements" ;
38
+ private static final String PREF_HIDE_YOUTUBE_SHORTS = "hide_youtube_shorts" ;
38
39
39
40
private FilterListAndroidHandler mFilterListAndroidHandler ;
40
41
@@ -91,6 +92,11 @@ public void onActivityCreated(Bundle savedInstanceState) {
91
92
if (hideYoutubeDistractingElementsPref != null ) {
92
93
hideYoutubeDistractingElementsPref .setOnPreferenceChangeListener (this );
93
94
}
95
+ ChromeSwitchPreference hideYoutubeShortsPref =
96
+ (ChromeSwitchPreference ) findPreference (PREF_HIDE_YOUTUBE_SHORTS );
97
+ if (hideYoutubeShortsPref != null ) {
98
+ hideYoutubeShortsPref .setOnPreferenceChangeListener (this );
99
+ }
94
100
95
101
if (mFilterListAndroidHandler != null ) {
96
102
mFilterListAndroidHandler .isFilterListEnabled (
@@ -107,6 +113,13 @@ public void onActivityCreated(Bundle savedInstanceState) {
107
113
hideYoutubeDistractingElementsPref .setChecked (isEnabled );
108
114
}
109
115
});
116
+ mFilterListAndroidHandler .isFilterListEnabled (
117
+ FilterListConstants .HIDE_YOUTUBE_SHORTS_UUID ,
118
+ isEnabled -> {
119
+ if (hideYoutubeShortsPref != null ) {
120
+ hideYoutubeShortsPref .setChecked (isEnabled );
121
+ }
122
+ });
110
123
}
111
124
}
112
125
@@ -139,6 +152,11 @@ public boolean onPreferenceChange(Preference preference, Object newValue) {
139
152
FilterListConstants .HIDE_YOUTUBE_DISTRACTING_ELEMENTS_UUID ,
140
153
(boolean ) newValue );
141
154
}
155
+ } else if (PREF_HIDE_YOUTUBE_SHORTS .equals (key )) {
156
+ if (mFilterListAndroidHandler != null ) {
157
+ mFilterListAndroidHandler .enableFilter (
158
+ FilterListConstants .HIDE_YOUTUBE_SHORTS_UUID , (boolean ) newValue );
159
+ }
142
160
}
143
161
144
162
if (shouldRelaunch ) {
0 commit comments