Finish merge
This commit is contained in:
parent
04401899f4
commit
e8d56c85cc
5 changed files with 19 additions and 17 deletions
|
|
@ -8,6 +8,7 @@ import android.view.View;
|
||||||
|
|
||||||
import app.revanced.extension.music.settings.preference.ReVancedPreferenceFragment;
|
import app.revanced.extension.music.settings.preference.ReVancedPreferenceFragment;
|
||||||
import app.revanced.extension.shared.Logger;
|
import app.revanced.extension.shared.Logger;
|
||||||
|
import app.revanced.extension.shared.ResourceType;
|
||||||
import app.revanced.extension.shared.Utils;
|
import app.revanced.extension.shared.Utils;
|
||||||
import app.revanced.extension.shared.settings.BaseActivityHook;
|
import app.revanced.extension.shared.settings.BaseActivityHook;
|
||||||
|
|
||||||
|
|
@ -37,7 +38,7 @@ public class GoogleApiActivityHook extends BaseActivityHook {
|
||||||
protected void customizeActivityTheme(Activity activity) {
|
protected void customizeActivityTheme(Activity activity) {
|
||||||
// Override the default YouTube Music theme to increase start padding of list items.
|
// Override the default YouTube Music theme to increase start padding of list items.
|
||||||
// Custom style located in resources/music/values/style.xml
|
// Custom style located in resources/music/values/style.xml
|
||||||
activity.setTheme(Utils.getResourceIdentifier("Theme.ReVanced.YouTubeMusic.Settings", "style"));
|
activity.setTheme(Utils.getResourceIdentifier(ResourceType.STYLE, "Theme.ReVanced.YouTubeMusic.Settings"));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -45,7 +46,7 @@ public class GoogleApiActivityHook extends BaseActivityHook {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected int getContentViewResourceId() {
|
protected int getContentViewResourceId() {
|
||||||
return Utils.getResourceIdentifier("revanced_music_settings_with_toolbar", "layout");
|
return Utils.getResourceIdentifier(ResourceType.LAYOUT, "revanced_music_settings_with_toolbar");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,7 @@ import android.widget.TextView;
|
||||||
import android.widget.Toolbar;
|
import android.widget.Toolbar;
|
||||||
|
|
||||||
import app.revanced.extension.shared.Logger;
|
import app.revanced.extension.shared.Logger;
|
||||||
|
import app.revanced.extension.shared.ResourceType;
|
||||||
import app.revanced.extension.shared.Utils;
|
import app.revanced.extension.shared.Utils;
|
||||||
import app.revanced.extension.shared.settings.preference.ToolbarPreferenceFragment;
|
import app.revanced.extension.shared.settings.preference.ToolbarPreferenceFragment;
|
||||||
|
|
||||||
|
|
@ -55,7 +56,7 @@ public abstract class BaseActivityHook extends Activity {
|
||||||
|
|
||||||
activity.getFragmentManager()
|
activity.getFragmentManager()
|
||||||
.beginTransaction()
|
.beginTransaction()
|
||||||
.replace(Utils.getResourceIdentifier("revanced_settings_fragments", "id"), fragment)
|
.replace(Utils.getResourceIdentifier(ResourceType.ID, "revanced_settings_fragments"), fragment)
|
||||||
.commit();
|
.commit();
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
Logger.printException(() -> "initialize failure", ex);
|
Logger.printException(() -> "initialize failure", ex);
|
||||||
|
|
@ -70,7 +71,7 @@ public abstract class BaseActivityHook extends Activity {
|
||||||
// Replace dummy placeholder toolbar.
|
// Replace dummy placeholder toolbar.
|
||||||
// This is required to fix submenu title alignment issue with Android ASOP 15+
|
// This is required to fix submenu title alignment issue with Android ASOP 15+
|
||||||
ViewGroup toolBarParent = activity.findViewById(
|
ViewGroup toolBarParent = activity.findViewById(
|
||||||
Utils.getResourceIdentifier("revanced_toolbar_parent", "id"));
|
Utils.getResourceIdentifier(ResourceType.ID, "revanced_toolbar_parent"));
|
||||||
ViewGroup dummyToolbar = Utils.getChildViewByResourceName(toolBarParent, "revanced_toolbar");
|
ViewGroup dummyToolbar = Utils.getChildViewByResourceName(toolBarParent, "revanced_toolbar");
|
||||||
toolbarLayoutParams = dummyToolbar.getLayoutParams();
|
toolbarLayoutParams = dummyToolbar.getLayoutParams();
|
||||||
toolBarParent.removeView(dummyToolbar);
|
toolBarParent.removeView(dummyToolbar);
|
||||||
|
|
@ -82,7 +83,7 @@ public abstract class BaseActivityHook extends Activity {
|
||||||
toolbar.setBackgroundColor(getToolbarBackgroundColor());
|
toolbar.setBackgroundColor(getToolbarBackgroundColor());
|
||||||
toolbar.setNavigationIcon(getNavigationIcon());
|
toolbar.setNavigationIcon(getNavigationIcon());
|
||||||
toolbar.setNavigationOnClickListener(getNavigationClickListener(activity));
|
toolbar.setNavigationOnClickListener(getNavigationClickListener(activity));
|
||||||
toolbar.setTitle(Utils.getResourceIdentifier("revanced_settings_title", "string"));
|
toolbar.setTitle(Utils.getResourceIdentifier(ResourceType.STRING, "revanced_settings_title"));
|
||||||
|
|
||||||
final int margin = Utils.dipToPixels(16);
|
final int margin = Utils.dipToPixels(16);
|
||||||
toolbar.setTitleMarginStart(margin);
|
toolbar.setTitleMarginStart(margin);
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,7 @@ import android.widget.Toolbar;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
|
|
||||||
import app.revanced.extension.shared.Logger;
|
import app.revanced.extension.shared.Logger;
|
||||||
|
import app.revanced.extension.shared.ResourceType;
|
||||||
import app.revanced.extension.shared.Utils;
|
import app.revanced.extension.shared.Utils;
|
||||||
import app.revanced.extension.shared.settings.BaseActivityHook;
|
import app.revanced.extension.shared.settings.BaseActivityHook;
|
||||||
|
|
||||||
|
|
@ -116,7 +117,7 @@ public class ToolbarPreferenceFragment extends AbstractPreferenceFragment {
|
||||||
@SuppressLint("UseCompatLoadingForDrawables")
|
@SuppressLint("UseCompatLoadingForDrawables")
|
||||||
public static Drawable getBackButtonDrawable() {
|
public static Drawable getBackButtonDrawable() {
|
||||||
final int backButtonResource = Utils.getResourceIdentifier(
|
final int backButtonResource = Utils.getResourceIdentifier(
|
||||||
"revanced_settings_toolbar_arrow_left", "drawable");
|
ResourceType.DRAWABLE, "revanced_settings_toolbar_arrow_left");
|
||||||
Drawable drawable = Utils.getContext().getResources().getDrawable(backButtonResource);
|
Drawable drawable = Utils.getContext().getResources().getDrawable(backButtonResource);
|
||||||
customizeBackButtonDrawable(drawable);
|
customizeBackButtonDrawable(drawable);
|
||||||
return drawable;
|
return drawable;
|
||||||
|
|
|
||||||
|
|
@ -6,13 +6,10 @@ import android.content.Context;
|
||||||
import android.content.res.Configuration;
|
import android.content.res.Configuration;
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
import android.preference.PreferenceFragment;
|
import android.preference.PreferenceFragment;
|
||||||
import android.util.TypedValue;
|
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
|
||||||
import android.widget.TextView;
|
|
||||||
import android.widget.Toolbar;
|
import android.widget.Toolbar;
|
||||||
|
|
||||||
import app.revanced.extension.shared.Logger;
|
import app.revanced.extension.shared.ResourceType;
|
||||||
import app.revanced.extension.shared.Utils;
|
import app.revanced.extension.shared.Utils;
|
||||||
import app.revanced.extension.shared.settings.AppLanguage;
|
import app.revanced.extension.shared.settings.AppLanguage;
|
||||||
import app.revanced.extension.shared.settings.BaseActivityHook;
|
import app.revanced.extension.shared.settings.BaseActivityHook;
|
||||||
|
|
@ -53,7 +50,7 @@ public class LicenseActivityHook extends BaseActivityHook {
|
||||||
final var theme = Utils.isDarkModeEnabled()
|
final var theme = Utils.isDarkModeEnabled()
|
||||||
? "Theme.YouTube.Settings.Dark"
|
? "Theme.YouTube.Settings.Dark"
|
||||||
: "Theme.YouTube.Settings";
|
: "Theme.YouTube.Settings";
|
||||||
activity.setTheme(Utils.getResourceIdentifier(theme, "style"));
|
activity.setTheme(Utils.getResourceIdentifier(ResourceType.STYLE, theme));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -61,7 +58,7 @@ public class LicenseActivityHook extends BaseActivityHook {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected int getContentViewResourceId() {
|
protected int getContentViewResourceId() {
|
||||||
return Utils.getResourceIdentifier("revanced_settings_with_toolbar", "layout");
|
return Utils.getResourceIdentifier(ResourceType.LAYOUT, "revanced_settings_with_toolbar");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -28,11 +28,13 @@ private val settingsResourcePatch = resourcePatch {
|
||||||
dependsOn(
|
dependsOn(
|
||||||
resourceMappingPatch,
|
resourceMappingPatch,
|
||||||
settingsPatch(
|
settingsPatch(
|
||||||
IntentPreference(
|
listOf(
|
||||||
titleKey = "revanced_settings_title",
|
IntentPreference(
|
||||||
summaryKey = null,
|
titleKey = "revanced_settings_title",
|
||||||
intent = newIntent("revanced_settings_intent"),
|
summaryKey = null,
|
||||||
) to "settings_headers",
|
intent = newIntent("revanced_settings_intent"),
|
||||||
|
) to "settings_headers"
|
||||||
|
),
|
||||||
preferences
|
preferences
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue