-
-
Notifications
You must be signed in to change notification settings - Fork 430
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(youtube/settings): fix non functional back button in settings (#2178
- Loading branch information
1 parent
65ae4bf
commit 1fec3e0
Showing
10 changed files
with
85 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -60,14 +60,17 @@ class SettingsPatch : BytecodePatch( | |
} | ||
} ?: return SetThemeFingerprint.toErrorResult() | ||
|
||
// set the theme based on the preference of the device | ||
|
||
// Modify the license activity and remove all existing layout code. | ||
// Must modify an existing activity and cannot add a new activity to the manifest, | ||
// as that fails for root installations. | ||
LicenseActivityFingerprint.result!!.apply licenseActivity@{ | ||
mutableMethod.apply { | ||
fun buildSettingsActivityInvokeString( | ||
registers: String = "p0", | ||
classDescriptor: String = SETTINGS_ACTIVITY_DESCRIPTOR, | ||
methodName: String = "initializeSettings", | ||
parameters: String = [email protected] | ||
parameters: String = "Landroid/app/Activity;" | ||
) = getSetThemeInstructionString(registers, classDescriptor, methodName, parameters) | ||
|
||
// initialize the settings | ||
|
@@ -77,9 +80,6 @@ class SettingsPatch : BytecodePatch( | |
return-void | ||
""" | ||
) | ||
|
||
// set the current theme | ||
addInstruction(0, buildSettingsActivityInvokeString(methodName = "setTheme")) | ||
} | ||
|
||
// remove method overrides | ||
|
@@ -88,14 +88,13 @@ class SettingsPatch : BytecodePatch( | |
} | ||
} | ||
|
||
|
||
return PatchResultSuccess() | ||
} | ||
|
||
internal companion object { | ||
private const val INTEGRATIONS_PACKAGE = "app/revanced/integrations" | ||
|
||
private const val SETTINGS_ACTIVITY_DESCRIPTOR = "L$INTEGRATIONS_PACKAGE/settingsmenu/ReVancedSettingActivity;" | ||
|
||
private const val THEME_HELPER_DESCRIPTOR = "L$INTEGRATIONS_PACKAGE/utils/ThemeHelper;" | ||
private const val SET_THEME_METHOD_NAME = "setTheme" | ||
|
||
|
@@ -110,6 +109,15 @@ class SettingsPatch : BytecodePatch( | |
fun renameIntentsTargetPackage(newPackage: String) { | ||
SettingsResourcePatch.overrideIntentsTargetPackage = newPackage | ||
} | ||
|
||
/** | ||
* Creates an intent to open ReVanced settings of the given name | ||
*/ | ||
fun createReVancedSettingsIntent(settingsName: String) = Preference.Intent( | ||
"com.google.android.youtube", | ||
settingsName, | ||
"com.google.android.libraries.social.licenses.LicenseActivity" | ||
) | ||
} | ||
|
||
/** | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file removed
BIN
-200 Bytes
...in/resources/settings/drawable-ldrtl-xxxhdpi/quantum_ic_arrow_back_white_24.png
Binary file not shown.
Binary file removed
BIN
-194 Bytes
src/main/resources/settings/drawable-xxxhdpi/quantum_ic_arrow_back_white_24.png
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 0 additions & 4 deletions
4
src/main/resources/settings/layout/revanced_settings_toolbar.xml
This file was deleted.
Oops, something went wrong.
33 changes: 31 additions & 2 deletions
33
src/main/resources/settings/layout/revanced_settings_with_toolbar.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,33 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<merge> | ||
<include layout="@layout/revanced_settings_with_toolbar_layout"/> | ||
<merge xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:app="http://schemas.android.com/apk/res-auto"> | ||
|
||
<LinearLayout | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
android:fitsSystemWindows="true" | ||
android:orientation="vertical" | ||
android:transitionGroup="true"> | ||
|
||
<FrameLayout | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:background="@color/yt_white1" | ||
android:elevation="4dp"> | ||
|
||
<android.support.v7.widget.Toolbar | ||
android:id="@+id/revanced_toolbar" | ||
android:layout_width="match_parent" | ||
android:layout_height="?attr/actionBarSize" | ||
android:background="?attr/ytBrandBackgroundSolid" | ||
app:navigationIcon="@drawable/yt_outline_arrow_left_black_24" | ||
app:title="@string/revanced_settings" /> | ||
</FrameLayout> | ||
|
||
<FrameLayout | ||
android:id="@+id/revanced_settings_fragments" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" /> | ||
|
||
</LinearLayout> | ||
</merge> |
5 changes: 0 additions & 5 deletions
5
src/main/resources/settings/layout/revanced_settings_with_toolbar_layout.xml
This file was deleted.
Oops, something went wrong.