Migrate to nonTransitiveRClass
This commit is contained in:
parent
bdd4039785
commit
41497b5f91
25 changed files with 70 additions and 78 deletions
|
@ -223,7 +223,7 @@ private constructor(private val mContext: Context) : ThemeStorePrefKeys, ThemeSt
|
|||
fun primaryColor(context: Context): Int {
|
||||
return prefs(context).getInt(
|
||||
ThemeStorePrefKeys.KEY_PRIMARY_COLOR,
|
||||
resolveColor(context, R.attr.colorPrimary, Color.parseColor("#455A64"))
|
||||
resolveColor(context, androidx.appcompat.R.attr.colorPrimary, Color.parseColor("#455A64"))
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -240,7 +240,7 @@ private constructor(private val mContext: Context) : ThemeStorePrefKeys, ThemeSt
|
|||
} else {
|
||||
prefs(context).getInt(
|
||||
ThemeStorePrefKeys.KEY_ACCENT_COLOR,
|
||||
resolveColor(context, R.attr.colorAccent, Color.parseColor("#263238"))
|
||||
resolveColor(context, androidx.appcompat.R.attr.colorAccent, Color.parseColor("#263238"))
|
||||
)
|
||||
}
|
||||
return if (isWindowBackgroundDark(context) && desaturatedColor) ColorUtil.desaturateColor(
|
||||
|
@ -254,7 +254,7 @@ private constructor(private val mContext: Context) : ThemeStorePrefKeys, ThemeSt
|
|||
fun wallpaperColor(context: Context, isDarkMode: Boolean): Int {
|
||||
return prefs(context).getInt(
|
||||
if (isDarkMode) ThemeStorePrefKeys.KEY_WALLPAPER_COLOR_DARK else ThemeStorePrefKeys.KEY_WALLPAPER_COLOR_LIGHT,
|
||||
resolveColor(context, R.attr.colorAccent, Color.parseColor("#263238"))
|
||||
resolveColor(context, androidx.appcompat.R.attr.colorAccent, Color.parseColor("#263238"))
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
@ -5,7 +5,6 @@ import android.view.Menu;
|
|||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.widget.Toolbar;
|
||||
import code.name.monkey.appthemehelper.ATHActivity;
|
||||
import code.name.monkey.appthemehelper.R;
|
||||
import code.name.monkey.appthemehelper.util.ATHUtil;
|
||||
import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper;
|
||||
|
||||
|
@ -16,7 +15,7 @@ public class ATHToolbarActivity extends ATHActivity {
|
|||
|
||||
public static int getToolbarBackgroundColor(@Nullable Toolbar toolbar) {
|
||||
if (toolbar != null) {
|
||||
return ATHUtil.INSTANCE.resolveColor(toolbar.getContext(), R.attr.colorSurface);
|
||||
return ATHUtil.INSTANCE.resolveColor(toolbar.getContext(), com.google.android.material.R.attr.colorSurface);
|
||||
}
|
||||
return Color.BLACK;
|
||||
}
|
||||
|
|
|
@ -42,12 +42,12 @@ class ATESeekBarPreference @JvmOverloads constructor(
|
|||
|
||||
override fun onBindViewHolder(view: PreferenceViewHolder) {
|
||||
super.onBindViewHolder(view)
|
||||
val seekBar = view.findViewById(R.id.seekbar) as SeekBar
|
||||
val seekBar = view.findViewById(androidx.preference.R.id.seekbar) as SeekBar
|
||||
TintHelper.setTintAuto(
|
||||
seekBar, // Set MD3 accent if MD3 is enabled or in-app accent otherwise
|
||||
ThemeStore.accentColor(context), false
|
||||
)
|
||||
(view.findViewById(R.id.seekbar_value) as TextView).apply {
|
||||
(view.findViewById(androidx.preference.R.id.seekbar_value) as TextView).apply {
|
||||
appendUnit(editableText)
|
||||
doAfterTextChanged {
|
||||
appendUnit(it)
|
||||
|
|
|
@ -29,8 +29,6 @@ import androidx.preference.DialogPreference;
|
|||
|
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
|
||||
|
||||
import code.name.monkey.appthemehelper.R;
|
||||
|
||||
/**
|
||||
* @author Karim Abou Zeid (kabouzeid)
|
||||
*/
|
||||
|
@ -64,7 +62,7 @@ public class ATEPreferenceDialogFragment extends DialogFragment implements Dialo
|
|||
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
||||
FragmentActivity context = this.getActivity();
|
||||
MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(context,
|
||||
R.style.ThemeOverlay_MaterialComponents_Dialog_Alert)
|
||||
com.google.android.material.R.style.ThemeOverlay_MaterialComponents_Dialog_Alert)
|
||||
.setTitle(this.mPreference.getDialogTitle())
|
||||
.setIcon(this.mPreference.getDialogIcon())
|
||||
.setMessage(this.mPreference.getDialogMessage())
|
||||
|
|
|
@ -14,8 +14,8 @@ object MaterialValueHelper {
|
|||
@ColorInt
|
||||
fun getPrimaryTextColor(context: Context?, dark: Boolean): Int {
|
||||
return if (dark) {
|
||||
ContextCompat.getColor(context!!, R.color.primary_text_default_material_light)
|
||||
} else ContextCompat.getColor(context!!, R.color.primary_text_default_material_dark)
|
||||
ContextCompat.getColor(context!!, androidx.appcompat.R.color.primary_text_default_material_light)
|
||||
} else ContextCompat.getColor(context!!, androidx.appcompat.R.color.primary_text_default_material_dark)
|
||||
}
|
||||
|
||||
@SuppressLint("PrivateResource")
|
||||
|
@ -23,8 +23,8 @@ object MaterialValueHelper {
|
|||
@ColorInt
|
||||
fun getSecondaryTextColor(context: Context?, dark: Boolean): Int {
|
||||
return if (dark) {
|
||||
ContextCompat.getColor(context!!, R.color.secondary_text_default_material_light)
|
||||
} else ContextCompat.getColor(context!!, R.color.secondary_text_default_material_dark)
|
||||
ContextCompat.getColor(context!!, androidx.appcompat.R.color.secondary_text_default_material_light)
|
||||
} else ContextCompat.getColor(context!!, androidx.appcompat.R.color.secondary_text_default_material_dark)
|
||||
}
|
||||
|
||||
@SuppressLint("PrivateResource")
|
||||
|
@ -32,8 +32,8 @@ object MaterialValueHelper {
|
|||
@ColorInt
|
||||
fun getPrimaryDisabledTextColor(context: Context?, dark: Boolean): Int {
|
||||
return if (dark) {
|
||||
ContextCompat.getColor(context!!, R.color.primary_text_disabled_material_light)
|
||||
} else ContextCompat.getColor(context!!, R.color.primary_text_disabled_material_dark)
|
||||
ContextCompat.getColor(context!!, androidx.appcompat.R.color.primary_text_disabled_material_light)
|
||||
} else ContextCompat.getColor(context!!, androidx.appcompat.R.color.primary_text_disabled_material_dark)
|
||||
}
|
||||
|
||||
@SuppressLint("PrivateResource")
|
||||
|
@ -41,7 +41,7 @@ object MaterialValueHelper {
|
|||
@ColorInt
|
||||
fun getSecondaryDisabledTextColor(context: Context?, dark: Boolean): Int {
|
||||
return if (dark) {
|
||||
ContextCompat.getColor(context!!, R.color.secondary_text_disabled_material_light)
|
||||
} else ContextCompat.getColor(context!!, R.color.secondary_text_disabled_material_dark)
|
||||
ContextCompat.getColor(context!!, androidx.appcompat.R.color.secondary_text_disabled_material_light)
|
||||
} else ContextCompat.getColor(context!!, androidx.appcompat.R.color.secondary_text_disabled_material_dark)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -265,7 +265,7 @@ public final class TintHelper {
|
|||
// Ripples for the above views (e.g. when you tap and hold a switch or checkbox)
|
||||
RippleDrawable rd = (RippleDrawable) view.getBackground();
|
||||
@SuppressLint("PrivateResource") final int unchecked = ContextCompat.getColor(view.getContext(),
|
||||
isDark ? R.color.ripple_material_dark : R.color.ripple_material_light);
|
||||
isDark ? androidx.appcompat.R.color.ripple_material_dark : androidx.appcompat.R.color.ripple_material_light);
|
||||
final int checked = ColorUtil.INSTANCE.adjustAlpha(color, 0.4f);
|
||||
final ColorStateList sl = new ColorStateList(
|
||||
new int[][]{
|
||||
|
@ -373,7 +373,7 @@ public final class TintHelper {
|
|||
private static int getDefaultRippleColor(@NonNull Context context, boolean useDarkRipple) {
|
||||
// Light ripple is actually translucent black, and vice versa
|
||||
return ContextCompat.getColor(context, useDarkRipple ?
|
||||
R.color.ripple_material_light : R.color.ripple_material_dark);
|
||||
androidx.appcompat.R.color.ripple_material_light : androidx.appcompat.R.color.ripple_material_dark);
|
||||
}
|
||||
|
||||
@NonNull
|
||||
|
|
|
@ -39,7 +39,6 @@ import androidx.core.graphics.drawable.DrawableCompat;
|
|||
import java.lang.reflect.Field;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import code.name.monkey.appthemehelper.R;
|
||||
import code.name.monkey.appthemehelper.ThemeStore;
|
||||
|
||||
public final class ToolbarContentTintHelper {
|
||||
|
@ -122,7 +121,7 @@ public final class ToolbarContentTintHelper {
|
|||
public static void setOverflowButtonColor(@NonNull Activity activity,
|
||||
final @ColorInt int color) {
|
||||
final String overflowDescription = activity
|
||||
.getString(R.string.abc_action_menu_overflow_description);
|
||||
.getString(androidx.appcompat.R.string.abc_action_menu_overflow_description);
|
||||
final ViewGroup decorView = (ViewGroup) activity.getWindow().getDecorView();
|
||||
final ViewTreeObserver viewTreeObserver = decorView.getViewTreeObserver();
|
||||
viewTreeObserver.addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
|
||||
|
@ -283,7 +282,7 @@ public final class ToolbarContentTintHelper {
|
|||
}
|
||||
|
||||
public static void colorBackButton(@NonNull Toolbar toolbar) {
|
||||
int color = ATHUtil.INSTANCE.resolveColor(toolbar.getContext(), R.attr.colorControlNormal);
|
||||
int color = ATHUtil.INSTANCE.resolveColor(toolbar.getContext(), androidx.appcompat.R.attr.colorControlNormal);
|
||||
final PorterDuffColorFilter colorFilter = new PorterDuffColorFilter(color, PorterDuff.Mode.MULTIPLY);
|
||||
for (int i = 0; i < toolbar.getChildCount(); i++) {
|
||||
final View backButton = toolbar.getChildAt(i);
|
||||
|
@ -564,7 +563,7 @@ public final class ToolbarContentTintHelper {
|
|||
private static void setOverflowButtonColor(final Activity activity,
|
||||
final PorterDuffColorFilter colorFilter) {
|
||||
final String overflowDescription = activity
|
||||
.getString(R.string.abc_action_menu_overflow_description);
|
||||
.getString(androidx.appcompat.R.string.abc_action_menu_overflow_description);
|
||||
final ViewGroup decorView = (ViewGroup) activity.getWindow().getDecorView();
|
||||
final ViewTreeObserver viewTreeObserver = decorView.getViewTreeObserver();
|
||||
viewTreeObserver.addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
|
||||
|
@ -596,9 +595,9 @@ public final class ToolbarContentTintHelper {
|
|||
private static void tintShareIconIfPresent(int color, MenuItem item) {
|
||||
if (item.getActionView() != null) {
|
||||
final View actionView = item.getActionView();
|
||||
final View expandActivitiesButton = actionView.findViewById(R.id.expand_activities_button);
|
||||
final View expandActivitiesButton = actionView.findViewById(com.google.android.material.R.id.expand_activities_button);
|
||||
if (expandActivitiesButton != null) {
|
||||
final ImageView image = expandActivitiesButton.findViewById(R.id.image);
|
||||
final ImageView image = expandActivitiesButton.findViewById(com.google.android.material.R.id.image);
|
||||
if (image != null) {
|
||||
final Drawable drawable = image.getDrawable();
|
||||
final Drawable wrapped = DrawableCompat.wrap(drawable);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue