Skip to content

Commit 75d1548

Browse files
authored
chore: Merge branch dev to main (#5428)
2 parents 7fdd90a + c921e31 commit 75d1548

File tree

96 files changed

+1812
-1720
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

96 files changed

+1812
-1720
lines changed

CHANGELOG.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,38 @@
1+
## [5.31.2-dev.5](https://github.com/ReVanced/revanced-patches/compare/v5.31.2-dev.4...v5.31.2-dev.5) (2025-07-14)
2+
3+
4+
### Bug Fixes
5+
6+
* **Spotify - Spoof client:** Fix login failing by spoofing login request in addition ([#5448](https://github.com/ReVanced/revanced-patches/issues/5448)) ([4e59ddc](https://github.com/ReVanced/revanced-patches/commit/4e59ddc62388d09f71b89593fc8b76933d9facea))
7+
8+
## [5.31.2-dev.4](https://github.com/ReVanced/revanced-patches/compare/v5.31.2-dev.3...v5.31.2-dev.4) (2025-07-13)
9+
10+
11+
### Bug Fixes
12+
13+
* **YouTube - Settings:** Back button/gesture closes search instead of exiting ([#5418](https://github.com/ReVanced/revanced-patches/issues/5418)) ([134b278](https://github.com/ReVanced/revanced-patches/commit/134b278baa7b90d2c4b06200cabacabf55ebc055))
14+
15+
## [5.31.2-dev.3](https://github.com/ReVanced/revanced-patches/compare/v5.31.2-dev.2...v5.31.2-dev.3) (2025-07-13)
16+
17+
18+
### Bug Fixes
19+
20+
* **YouTube - Disable double tap actions:** Remove old incompatible targets ([857053e](https://github.com/ReVanced/revanced-patches/commit/857053e29b72ded10a84b0ac693fa107705342d9))
21+
22+
## [5.31.2-dev.2](https://github.com/ReVanced/revanced-patches/compare/v5.31.2-dev.1...v5.31.2-dev.2) (2025-07-12)
23+
24+
25+
### Bug Fixes
26+
27+
* **YouTube - Hide layout components:** Show correct custom header logo if 'Hide YouTube Doodles' is enabled ([#5431](https://github.com/ReVanced/revanced-patches/issues/5431)) ([20cc141](https://github.com/ReVanced/revanced-patches/commit/20cc141e61f75de1a1749247c4f4aed167dee8ea))
28+
29+
## [5.31.2-dev.1](https://github.com/ReVanced/revanced-patches/compare/v5.31.1...v5.31.2-dev.1) (2025-07-12)
30+
31+
32+
### Bug Fixes
33+
34+
* **YouTube - Hide layout components:** Hide quick actions does not work ([#5423](https://github.com/ReVanced/revanced-patches/issues/5423)) ([9c66729](https://github.com/ReVanced/revanced-patches/commit/9c6672946d44001e106bdac9041e2d79ef3f6ab2))
35+
136
## [5.31.1](https://github.com/ReVanced/revanced-patches/compare/v5.31.0...v5.31.1) (2025-07-11)
237

338

Lines changed: 66 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,101 @@
11
package app.revanced.extension.youtube.patches;
22

3+
import android.graphics.drawable.Drawable;
4+
35
import androidx.annotation.Nullable;
46

57
import java.util.Objects;
68

9+
import app.revanced.extension.shared.Logger;
710
import app.revanced.extension.shared.Utils;
811
import app.revanced.extension.youtube.settings.Settings;
912

1013
@SuppressWarnings("unused")
1114
public class ChangeHeaderPatch {
1215

1316
public enum HeaderLogo {
14-
DEFAULT(null),
15-
REGULAR("ytWordmarkHeader"),
16-
PREMIUM("ytPremiumWordmarkHeader"),
17-
REVANCED("revanced_header_logo"),
18-
REVANCED_MINIMAL("revanced_header_logo_minimal"),
19-
CUSTOM("custom_header");
17+
DEFAULT(null, null),
18+
REGULAR("ytWordmarkHeader", "yt_ringo2_wordmark_header"),
19+
PREMIUM("ytPremiumWordmarkHeader", "yt_ringo2_premium_wordmark_header"),
20+
REVANCED("revanced_header_logo", "revanced_header_logo"),
21+
REVANCED_MINIMAL("revanced_header_logo_minimal", "revanced_header_logo_minimal"),
22+
CUSTOM("custom_header", "custom_header");
2023

2124
@Nullable
22-
private final String resourceName;
25+
private final String attributeName;
26+
@Nullable
27+
private final String drawableName;
2328

24-
HeaderLogo(@Nullable String resourceName) {
25-
this.resourceName = resourceName;
29+
HeaderLogo(@Nullable String attributeName, @Nullable String drawableName) {
30+
this.attributeName = attributeName;
31+
this.drawableName = drawableName;
2632
}
2733

2834
/**
2935
* @return The attribute id of this header logo, or NULL if the logo should not be replaced.
3036
*/
3137
@Nullable
3238
private Integer getAttributeId() {
33-
if (resourceName == null) {
39+
if (attributeName == null) {
40+
return null;
41+
}
42+
43+
final int identifier = Utils.getResourceIdentifier(attributeName, "attr");
44+
if (identifier == 0) {
45+
// Identifier is zero if custom header setting was included in imported settings
46+
// and a custom image was not included during patching.
47+
Logger.printDebug(() -> "Could not find attribute: " + drawableName);
48+
Settings.HEADER_LOGO.resetToDefault();
3449
return null;
3550
}
3651

37-
final int identifier = Utils.getResourceIdentifier(resourceName, "attr");
38-
// Identifier is zero if custom header setting was included in imported settings
39-
// and a custom image was not included during patching.
40-
return identifier == 0 ? null : identifier;
52+
return identifier;
4153
}
42-
}
4354

44-
@Nullable
45-
private static final Integer headerLogoResource = Settings.HEADER_LOGO.get().getAttributeId();
55+
@Nullable
56+
public Drawable getDrawable() {
57+
if (drawableName == null) {
58+
return null;
59+
}
60+
61+
String drawableFullName = drawableName + (Utils.isDarkModeEnabled()
62+
? "_dark"
63+
: "_light");
64+
65+
final int identifier = Utils.getResourceIdentifier(drawableFullName, "drawable");
66+
if (identifier == 0) {
67+
Logger.printDebug(() -> "Could not find drawable: " + drawableFullName);
68+
Settings.HEADER_LOGO.resetToDefault();
69+
return null;
70+
}
71+
return Utils.getContext().getDrawable(identifier);
72+
}
73+
}
4674

4775
/**
4876
* Injection point.
4977
*/
5078
public static int getHeaderAttributeId(int original) {
51-
return Objects.requireNonNullElse(headerLogoResource, original);
79+
return Objects.requireNonNullElse(Settings.HEADER_LOGO.get().getAttributeId(), original);
80+
}
81+
82+
public static Drawable getDrawable(Drawable original) {
83+
Drawable logo = Settings.HEADER_LOGO.get().getDrawable();
84+
if (logo != null) {
85+
return logo;
86+
}
87+
88+
// TODO: If 'Hide Doodles' is enabled, this will force the regular logo regardless
89+
// what account the user has. This can be improved the next time a Doodle is
90+
// active and the attribute id is passed to this method so the correct
91+
// regular/premium logo is returned.
92+
logo = HeaderLogo.REGULAR.getDrawable();
93+
if (logo != null) {
94+
return logo;
95+
}
96+
97+
// Should never happen.
98+
Logger.printException(() -> "Could not find regular header logo resource");
99+
return original;
52100
}
53101
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import app.revanced.extension.youtube.settings.Settings;
44

55
@SuppressWarnings("unused")
6-
public final class DisableChapterSkipDoubleTapPatch {
6+
public final class DisableDoubleTapActionsPatch {
77

88
/**
99
* Injection point.

extensions/youtube/src/main/java/app/revanced/extension/youtube/patches/components/LayoutComponentsFilter.java

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,14 @@
44

55
import android.graphics.drawable.Drawable;
66
import android.view.View;
7+
import android.widget.ImageView;
78

89
import androidx.annotation.Nullable;
910

1011
import app.revanced.extension.shared.Logger;
1112
import app.revanced.extension.shared.Utils;
1213
import app.revanced.extension.youtube.StringTrieSearch;
14+
import app.revanced.extension.youtube.patches.ChangeHeaderPatch;
1315
import app.revanced.extension.youtube.settings.Settings;
1416
import app.revanced.extension.youtube.shared.NavigationBar;
1517
import app.revanced.extension.youtube.shared.PlayerType;
@@ -30,7 +32,7 @@ public final class LayoutComponentsFilter extends Filter {
3032
);
3133

3234
private final StringTrieSearch exceptions = new StringTrieSearch();
33-
private final StringFilterGroup inFeedSurvey;
35+
private final StringFilterGroup surveys;
3436
private final StringFilterGroup notifyMe;
3537
private final StringFilterGroup singleItemInformationPanel;
3638
private final StringFilterGroup expandableMetadata;
@@ -108,8 +110,8 @@ public LayoutComponentsFilter() {
108110
"chip_bar"
109111
);
110112

111-
inFeedSurvey = new StringFilterGroup(
112-
Settings.HIDE_FEED_SURVEY,
113+
surveys = new StringFilterGroup(
114+
Settings.HIDE_SURVEYS,
113115
"in_feed_survey",
114116
"slimline_survey",
115117
"feed_nudge"
@@ -284,17 +286,18 @@ public LayoutComponentsFilter() {
284286
forYouShelf,
285287
horizontalShelves,
286288
imageShelf,
287-
inFeedSurvey,
288289
infoPanel,
289290
latestPosts,
290291
medicalPanel,
291292
notifyMe,
292293
paidPromotion,
293294
playables,
295+
quickActions,
294296
relatedVideos,
295297
singleItemInformationPanel,
296298
subscribersCommunityGuidelines,
297299
subscriptionsChipBar,
300+
surveys,
298301
timedReactions,
299302
videoRecommendationLabels
300303
);
@@ -314,7 +317,7 @@ boolean isFiltered(@Nullable String identifier, String path, byte[] protobufBuff
314317

315318
// The groups are excluded from the filter due to the exceptions list below.
316319
// Filter them separately here.
317-
if (matchedGroup == notifyMe || matchedGroup == inFeedSurvey || matchedGroup == expandableMetadata) {
320+
if (matchedGroup == notifyMe || matchedGroup == surveys || matchedGroup == expandableMetadata) {
318321
return true;
319322
}
320323

@@ -436,13 +439,11 @@ public static void hideInRelatedVideos(View chipView) {
436439
/**
437440
* Injection point.
438441
*/
439-
@Nullable
440-
public static Drawable hideYoodles(Drawable animatedYoodle) {
441-
if (HIDE_DOODLES_ENABLED) {
442-
return null;
443-
}
444-
445-
return animatedYoodle;
442+
public static void setDoodleDrawable(ImageView imageView, Drawable original) {
443+
Drawable replacement = HIDE_DOODLES_ENABLED
444+
? ChangeHeaderPatch.getDrawable(original)
445+
: original;
446+
imageView.setImageDrawable(replacement);
446447
}
447448

448449
private static final boolean HIDE_SHOW_MORE_BUTTON_ENABLED = Settings.HIDE_SHOW_MORE_BUTTON.get();

extensions/youtube/src/main/java/app/revanced/extension/youtube/settings/LicenseActivityHook.java

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import android.app.Activity;
77
import android.content.Context;
88
import android.preference.PreferenceFragment;
9+
import android.util.TypedValue;
910
import android.view.ViewGroup;
1011
import android.widget.TextView;
1112
import android.widget.Toolbar;
@@ -24,12 +25,15 @@
2425
* This class is responsible for injecting our own fragment by replacing the LicenseActivity.
2526
*/
2627
@SuppressWarnings("unused")
27-
public class LicenseActivityHook {
28+
public class LicenseActivityHook extends Activity {
2829

2930
private static int currentThemeValueOrdinal = -1; // Must initially be a non-valid enum ordinal value.
3031

3132
private static ViewGroup.LayoutParams toolbarLayoutParams;
3233

34+
@SuppressLint("StaticFieldLeak")
35+
public static SearchViewController searchViewController;
36+
3337
public static void setToolbarLayoutParams(Toolbar toolbar) {
3438
if (toolbarLayoutParams != null) {
3539
toolbar.setLayoutParams(toolbarLayoutParams);
@@ -126,12 +130,13 @@ private static void createToolbar(Activity activity, PreferenceFragment fragment
126130
view -> view instanceof TextView);
127131
if (toolbarTextView != null) {
128132
toolbarTextView.setTextColor(Utils.getAppForegroundColor());
133+
toolbarTextView.setTextSize(TypedValue.COMPLEX_UNIT_SP, 20);
129134
}
130135
setToolbarLayoutParams(toolbar);
131136

132-
// Add Search Icon and EditText for ReVancedPreferenceFragment only.
137+
// Add Search bar only for ReVancedPreferenceFragment.
133138
if (fragment instanceof ReVancedPreferenceFragment) {
134-
SearchViewController.addSearchViewComponents(activity, toolbar, (ReVancedPreferenceFragment) fragment);
139+
searchViewController = SearchViewController.addSearchViewComponents(activity, toolbar, (ReVancedPreferenceFragment) fragment);
135140
}
136141

137142
toolBarParent.addView(toolbar, 0);

extensions/youtube/src/main/java/app/revanced/extension/youtube/settings/SearchViewController.java

Lines changed: 39 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import android.util.Pair;
1111
import android.view.MenuItem;
1212
import android.view.View;
13+
import android.view.inputmethod.EditorInfo;
1314
import android.view.inputmethod.InputMethodManager;
1415
import android.widget.ArrayAdapter;
1516
import android.widget.AutoCompleteTextView;
@@ -51,6 +52,7 @@ public class SearchViewController {
5152
private final Deque<String> searchHistory;
5253
private final AutoCompleteTextView autoCompleteTextView;
5354
private final boolean showSettingsSearchHistory;
55+
private int currentOrientation;
5456

5557
/**
5658
* Creates a background drawable for the SearchView with rounded corners.
@@ -83,8 +85,8 @@ public static int getSearchViewBackground() {
8385
/**
8486
* Adds search view components to the activity.
8587
*/
86-
public static void addSearchViewComponents(Activity activity, Toolbar toolbar, ReVancedPreferenceFragment fragment) {
87-
new SearchViewController(activity, toolbar, fragment);
88+
public static SearchViewController addSearchViewComponents(Activity activity, Toolbar toolbar, ReVancedPreferenceFragment fragment) {
89+
return new SearchViewController(activity, toolbar, fragment);
8890
}
8991

9092
private SearchViewController(Activity activity, Toolbar toolbar, ReVancedPreferenceFragment fragment) {
@@ -115,6 +117,9 @@ private SearchViewController(Activity activity, Toolbar toolbar, ReVancedPrefere
115117
searchView.getContext().getResources().getIdentifier(
116118
"android:id/search_src_text", null, null));
117119

120+
// Disable fullscreen keyboard mode.
121+
autoCompleteTextView.setImeOptions(autoCompleteTextView.getImeOptions() | EditorInfo.IME_FLAG_NO_EXTRACT_UI);
122+
118123
// Set background and query hint.
119124
searchView.setBackground(createBackgroundDrawable(toolbar.getContext()));
120125
searchView.setQueryHint(str("revanced_settings_search_hint"));
@@ -197,12 +202,14 @@ public boolean onQueryTextChange(String newText) {
197202
if (isSearchActive) {
198203
closeSearch();
199204
} else {
200-
activity.onBackPressed();
205+
activity.finish();
201206
}
202207
} catch (Exception ex) {
203208
Logger.printException(() -> "navigation click failure", ex);
204209
}
205210
});
211+
212+
monitorOrientationChanges();
206213
}
207214

208215
/**
@@ -285,6 +292,21 @@ private void updateSearchHistoryAdapter() {
285292
}
286293
}
287294

295+
private void monitorOrientationChanges() {
296+
currentOrientation = activity.getResources().getConfiguration().orientation;
297+
298+
searchView.getViewTreeObserver().addOnGlobalLayoutListener(() -> {
299+
int newOrientation = activity.getResources().getConfiguration().orientation;
300+
if (newOrientation != currentOrientation) {
301+
currentOrientation = newOrientation;
302+
if (autoCompleteTextView != null) {
303+
autoCompleteTextView.dismissDropDown();
304+
Logger.printDebug(() -> "Orientation changed, search history dismissed");
305+
}
306+
}
307+
});
308+
}
309+
288310
/**
289311
* Opens the search view and shows the keyboard.
290312
*/
@@ -313,7 +335,7 @@ private void openSearch() {
313335
/**
314336
* Closes the search view and hides the keyboard.
315337
*/
316-
private void closeSearch() {
338+
public void closeSearch() {
317339
isSearchActive = false;
318340
toolbar.getMenu().findItem(getResourceIdentifier(
319341
"action_search", "id")).setVisible(true);
@@ -326,6 +348,19 @@ private void closeSearch() {
326348
imm.hideSoftInputFromWindow(searchView.getWindowToken(), 0);
327349
}
328350

351+
public static boolean handleBackPress() {
352+
if (LicenseActivityHook.searchViewController != null
353+
&& LicenseActivityHook.searchViewController.isSearchExpanded()) {
354+
LicenseActivityHook.searchViewController.closeSearch();
355+
return true;
356+
}
357+
return false;
358+
}
359+
360+
public boolean isSearchExpanded() {
361+
return isSearchActive;
362+
}
363+
329364
/**
330365
* Custom ArrayAdapter for search history.
331366
*/

0 commit comments

Comments
 (0)