Migrate to nonTransitiveRClass
This commit is contained in:
parent
bdd4039785
commit
41497b5f91
25 changed files with 70 additions and 78 deletions
|
@ -43,7 +43,7 @@ class App : Application() {
|
|||
// default theme
|
||||
if (!ThemeStore.isConfigured(this, 3)) {
|
||||
ThemeStore.editTheme(this)
|
||||
.accentColorRes(R.color.md_deep_purple_A200)
|
||||
.accentColorRes(code.name.monkey.appthemehelper.R.color.md_deep_purple_A200)
|
||||
.coloredNavigationBar(true)
|
||||
.commit()
|
||||
}
|
||||
|
|
|
@ -18,17 +18,17 @@ class ErrorActivity : AppCompatActivity() {
|
|||
private val reportPrefix = "bug_report-"
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setContentView(R.layout.customactivityoncrash_default_error_activity)
|
||||
setContentView(cat.ereza.customactivityoncrash.R.layout.customactivityoncrash_default_error_activity)
|
||||
|
||||
val restartButton =
|
||||
findViewById<Button>(R.id.customactivityoncrash_error_activity_restart_button)
|
||||
findViewById<Button>(cat.ereza.customactivityoncrash.R.id.customactivityoncrash_error_activity_restart_button)
|
||||
|
||||
val config = CustomActivityOnCrash.getConfigFromIntent(intent)
|
||||
if (config == null) {
|
||||
finish()
|
||||
return
|
||||
}
|
||||
restartButton.setText(R.string.customactivityoncrash_error_activity_restart_app)
|
||||
restartButton.setText(cat.ereza.customactivityoncrash.R.string.customactivityoncrash_error_activity_restart_app)
|
||||
restartButton.setOnClickListener {
|
||||
CustomActivityOnCrash.restartApplication(
|
||||
this@ErrorActivity,
|
||||
|
@ -36,11 +36,11 @@ class ErrorActivity : AppCompatActivity() {
|
|||
)
|
||||
}
|
||||
val moreInfoButton =
|
||||
findViewById<Button>(R.id.customactivityoncrash_error_activity_more_info_button)
|
||||
findViewById<Button>(cat.ereza.customactivityoncrash.R.id.customactivityoncrash_error_activity_more_info_button)
|
||||
|
||||
moreInfoButton.setOnClickListener { //We retrieve all the error data and show it
|
||||
MaterialAlertDialogBuilder(this@ErrorActivity)
|
||||
.setTitle(R.string.customactivityoncrash_error_activity_error_details_title)
|
||||
.setTitle(cat.ereza.customactivityoncrash.R.string.customactivityoncrash_error_activity_error_details_title)
|
||||
.setMessage(
|
||||
CustomActivityOnCrash.getAllErrorDetailsFromIntent(
|
||||
this@ErrorActivity,
|
||||
|
@ -48,7 +48,7 @@ class ErrorActivity : AppCompatActivity() {
|
|||
)
|
||||
)
|
||||
.setPositiveButton(
|
||||
R.string.customactivityoncrash_error_activity_error_details_close,
|
||||
cat.ereza.customactivityoncrash.R.string.customactivityoncrash_error_activity_error_details_close,
|
||||
null
|
||||
)
|
||||
.setNeutralButton(
|
||||
|
@ -70,7 +70,7 @@ class ErrorActivity : AppCompatActivity() {
|
|||
}
|
||||
val errorActivityDrawableId = config.errorDrawable
|
||||
val errorImageView =
|
||||
findViewById<ImageView>(R.id.customactivityoncrash_error_activity_image)
|
||||
findViewById<ImageView>(cat.ereza.customactivityoncrash.R.id.customactivityoncrash_error_activity_image)
|
||||
if (errorActivityDrawableId != null) {
|
||||
errorImageView.setImageResource(
|
||||
errorActivityDrawableId
|
||||
|
|
|
@ -50,8 +50,8 @@ public class SAFGuideActivity extends IntroActivity {
|
|||
? R.string.saf_guide_slide1_description_before_o
|
||||
: R.string.saf_guide_slide1_description)
|
||||
.image(R.drawable.saf_guide_1)
|
||||
.background(R.color.md_deep_purple_300)
|
||||
.backgroundDark(R.color.md_deep_purple_400)
|
||||
.background(code.name.monkey.appthemehelper.R.color.md_deep_purple_300)
|
||||
.backgroundDark(code.name.monkey.appthemehelper.R.color.md_deep_purple_400)
|
||||
.layout(R.layout.fragment_simple_slide_large_image)
|
||||
.build());
|
||||
addSlide(
|
||||
|
@ -59,8 +59,8 @@ public class SAFGuideActivity extends IntroActivity {
|
|||
.title(R.string.saf_guide_slide2_title)
|
||||
.description(R.string.saf_guide_slide2_description)
|
||||
.image(R.drawable.saf_guide_2)
|
||||
.background(R.color.md_deep_purple_500)
|
||||
.backgroundDark(R.color.md_deep_purple_600)
|
||||
.background(code.name.monkey.appthemehelper.R.color.md_deep_purple_500)
|
||||
.backgroundDark(code.name.monkey.appthemehelper.R.color.md_deep_purple_600)
|
||||
.layout(R.layout.fragment_simple_slide_large_image)
|
||||
.build());
|
||||
addSlide(
|
||||
|
@ -68,8 +68,8 @@ public class SAFGuideActivity extends IntroActivity {
|
|||
.title(R.string.saf_guide_slide3_title)
|
||||
.description(R.string.saf_guide_slide3_description)
|
||||
.image(R.drawable.saf_guide_3)
|
||||
.background(R.color.md_deep_purple_700)
|
||||
.backgroundDark(R.color.md_deep_purple_800)
|
||||
.background(code.name.monkey.appthemehelper.R.color.md_deep_purple_700)
|
||||
.backgroundDark(code.name.monkey.appthemehelper.R.color.md_deep_purple_800)
|
||||
.layout(R.layout.fragment_simple_slide_large_image)
|
||||
.build());
|
||||
}
|
||||
|
|
|
@ -97,7 +97,7 @@ class SongFileAdapter(
|
|||
}
|
||||
|
||||
private fun loadFileImage(file: File, holder: ViewHolder) {
|
||||
val iconColor = ATHUtil.resolveColor(activity, R.attr.colorControlNormal)
|
||||
val iconColor = ATHUtil.resolveColor(activity, androidx.appcompat.R.attr.colorControlNormal)
|
||||
if (file.isDirectory) {
|
||||
holder.image?.let {
|
||||
it.setColorFilter(iconColor, PorterDuff.Mode.SRC_IN)
|
||||
|
@ -106,7 +106,7 @@ class SongFileAdapter(
|
|||
holder.imageTextContainer?.setCardBackgroundColor(
|
||||
ATHUtil.resolveColor(
|
||||
activity,
|
||||
R.attr.colorSurface
|
||||
com.google.android.material.R.attr.colorSurface
|
||||
)
|
||||
)
|
||||
} else {
|
||||
|
|
|
@ -119,7 +119,7 @@ class AlbumCoverPagerAdapter(
|
|||
withContext(Dispatchers.Main) {
|
||||
MaterialAlertDialogBuilder(
|
||||
requireContext(),
|
||||
R.style.ThemeOverlay_MaterialComponents_Dialog_Alert
|
||||
com.google.android.material.R.style.ThemeOverlay_MaterialComponents_Dialog_Alert
|
||||
).apply {
|
||||
setTitle(song.title)
|
||||
setMessage(if (data.isNullOrEmpty()) "No lyrics found" else data)
|
||||
|
|
|
@ -40,29 +40,29 @@ class AppWidgetText : BaseAppWidget() {
|
|||
appWidgetView.setImageViewBitmap(
|
||||
R.id.button_next,
|
||||
context.getTintedDrawable(R.drawable.ic_skip_next, ContextCompat.getColor(
|
||||
context, R.color.md_white_1000
|
||||
context, code.name.monkey.appthemehelper.R.color.md_white_1000
|
||||
)).toBitmap()
|
||||
)
|
||||
appWidgetView.setImageViewBitmap(
|
||||
R.id.button_prev,
|
||||
context.getTintedDrawable(R.drawable.ic_skip_previous, ContextCompat.getColor(
|
||||
context, R.color.md_white_1000
|
||||
context, code.name.monkey.appthemehelper.R.color.md_white_1000
|
||||
)
|
||||
).toBitmap()
|
||||
)
|
||||
appWidgetView.setImageViewBitmap(
|
||||
R.id.button_toggle_play_pause,
|
||||
context.getTintedDrawable(R.drawable.ic_play_arrow_white_32dp, ContextCompat.getColor(
|
||||
context, R.color.md_white_1000
|
||||
context, code.name.monkey.appthemehelper.R.color.md_white_1000
|
||||
)
|
||||
).toBitmap()
|
||||
)
|
||||
|
||||
appWidgetView.setTextColor(
|
||||
R.id.title, ContextCompat.getColor(context, R.color.md_white_1000)
|
||||
R.id.title, ContextCompat.getColor(context, code.name.monkey.appthemehelper.R.color.md_white_1000)
|
||||
)
|
||||
appWidgetView.setTextColor(
|
||||
R.id.text, ContextCompat.getColor(context, R.color.md_white_1000)
|
||||
R.id.text, ContextCompat.getColor(context, code.name.monkey.appthemehelper.R.color.md_white_1000)
|
||||
)
|
||||
|
||||
linkButtons(context, appWidgetView)
|
||||
|
@ -127,7 +127,7 @@ class AppWidgetText : BaseAppWidget() {
|
|||
appWidgetView.setImageViewBitmap(
|
||||
R.id.button_toggle_play_pause,
|
||||
service.getTintedDrawable(playPauseRes, ContextCompat.getColor(
|
||||
service, R.color.md_white_1000)
|
||||
service, code.name.monkey.appthemehelper.R.color.md_white_1000)
|
||||
).toBitmap()
|
||||
)
|
||||
appWidgetView.setImageViewBitmap(
|
||||
|
@ -136,7 +136,7 @@ class AppWidgetText : BaseAppWidget() {
|
|||
R.drawable.ic_skip_next,
|
||||
ContextCompat.getColor(
|
||||
service,
|
||||
R.color.md_white_1000
|
||||
code.name.monkey.appthemehelper.R.color.md_white_1000
|
||||
)
|
||||
).toBitmap()
|
||||
)
|
||||
|
@ -145,7 +145,7 @@ class AppWidgetText : BaseAppWidget() {
|
|||
service.getTintedDrawable(
|
||||
R.drawable.ic_skip_previous,
|
||||
ContextCompat.getColor(
|
||||
service, R.color.md_white_1000
|
||||
service, code.name.monkey.appthemehelper.R.color.md_white_1000
|
||||
)
|
||||
).toBitmap()
|
||||
)
|
||||
|
|
|
@ -52,7 +52,7 @@ fun Int.ripAlpha(): Int {
|
|||
fun Dialog.colorControlNormal() = resolveColor(android.R.attr.colorControlNormal)
|
||||
|
||||
fun Toolbar.backgroundTintList() {
|
||||
val surfaceColor = ATHUtil.resolveColor(context, R.attr.colorSurface, Color.BLACK)
|
||||
val surfaceColor = ATHUtil.resolveColor(context, com.google.android.material.R.attr.colorSurface, Color.BLACK)
|
||||
val colorStateList = ColorStateList.valueOf(surfaceColor)
|
||||
backgroundTintList = colorStateList
|
||||
}
|
||||
|
@ -61,13 +61,13 @@ fun Context.accentColor() = ThemeStore.accentColor(this)
|
|||
|
||||
fun Fragment.accentColor() = ThemeStore.accentColor(requireContext())
|
||||
|
||||
fun Context.surfaceColor() = resolveColor(R.attr.colorSurface, Color.WHITE)
|
||||
fun Context.surfaceColor() = resolveColor(com.google.android.material.R.attr.colorSurface, Color.WHITE)
|
||||
|
||||
fun Fragment.surfaceColor() = resolveColor(R.attr.colorSurface, Color.WHITE)
|
||||
fun Fragment.surfaceColor() = resolveColor(com.google.android.material.R.attr.colorSurface, Color.WHITE)
|
||||
|
||||
fun Context.surfaceColor(fallBackColor: Int) = resolveColor(R.attr.colorSurface, fallBackColor)
|
||||
fun Context.surfaceColor(fallBackColor: Int) = resolveColor(com.google.android.material.R.attr.colorSurface, fallBackColor)
|
||||
|
||||
fun Fragment.surfaceColor(fallBackColor: Int) = resolveColor(R.attr.colorSurface, fallBackColor)
|
||||
fun Fragment.surfaceColor(fallBackColor: Int) = resolveColor(com.google.android.material.R.attr.colorSurface, fallBackColor)
|
||||
|
||||
fun Context.textColorSecondary() = resolveColor(android.R.attr.textColorSecondary)
|
||||
|
||||
|
|
|
@ -71,7 +71,7 @@ class RestoreActivity : AppCompatActivity() {
|
|||
DynamicColors.applyToActivityIfAvailable(
|
||||
this,
|
||||
DynamicColorsOptions.Builder()
|
||||
.setThemeOverlay(R.style.ThemeOverlay_Material3_DynamicColors_DayNight)
|
||||
.setThemeOverlay(com.google.android.material.R.style.ThemeOverlay_Material3_DynamicColors_DayNight)
|
||||
.build()
|
||||
)
|
||||
}
|
||||
|
|
|
@ -118,7 +118,7 @@ class BlurPlaybackControlsFragment :
|
|||
override fun setColor(color: MediaNotificationProcessor) {
|
||||
lastPlaybackControlsColor = Color.WHITE
|
||||
lastDisabledPlaybackControlsColor =
|
||||
ContextCompat.getColor(requireContext(), R.color.md_grey_500)
|
||||
ContextCompat.getColor(requireContext(), code.name.monkey.appthemehelper.R.color.md_grey_500)
|
||||
|
||||
binding.title.setTextColor(lastPlaybackControlsColor)
|
||||
|
||||
|
|
|
@ -53,7 +53,7 @@ class MD3PlayerFragment : AbsPlayerFragment(R.layout.fragment_md3_player) {
|
|||
}
|
||||
|
||||
override fun toolbarIconColor(): Int {
|
||||
return ATHUtil.resolveColor(requireContext(), R.attr.colorControlNormal)
|
||||
return ATHUtil.resolveColor(requireContext(), androidx.appcompat.R.attr.colorControlNormal)
|
||||
}
|
||||
|
||||
override fun onColorChanged(color: MediaNotificationProcessor) {
|
||||
|
@ -63,7 +63,7 @@ class MD3PlayerFragment : AbsPlayerFragment(R.layout.fragment_md3_player) {
|
|||
|
||||
ToolbarContentTintHelper.colorizeToolbar(
|
||||
binding.playerToolbar,
|
||||
ATHUtil.resolveColor(requireContext(), R.attr.colorControlNormal),
|
||||
ATHUtil.resolveColor(requireContext(), androidx.appcompat.R.attr.colorControlNormal),
|
||||
requireActivity()
|
||||
)
|
||||
}
|
||||
|
@ -108,7 +108,7 @@ class MD3PlayerFragment : AbsPlayerFragment(R.layout.fragment_md3_player) {
|
|||
|
||||
ToolbarContentTintHelper.colorizeToolbar(
|
||||
binding.playerToolbar,
|
||||
ATHUtil.resolveColor(requireContext(), R.attr.colorControlNormal),
|
||||
ATHUtil.resolveColor(requireContext(), androidx.appcompat.R.attr.colorControlNormal),
|
||||
requireActivity()
|
||||
)
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ import com.bumptech.glide.request.transition.Transition
|
|||
abstract class SingleColorTarget(view: ImageView) : BitmapPaletteTarget(view) {
|
||||
|
||||
private val defaultFooterColor: Int
|
||||
get() = ATHUtil.resolveColor(view.context, R.attr.colorControlNormal)
|
||||
get() = ATHUtil.resolveColor(view.context, androidx.appcompat.R.attr.colorControlNormal)
|
||||
|
||||
abstract fun onColorReady(color: Int)
|
||||
|
||||
|
@ -43,7 +43,7 @@ abstract class SingleColorTarget(view: ImageView) : BitmapPaletteTarget(view) {
|
|||
onColorReady(
|
||||
ColorUtil.getColor(
|
||||
resource.palette,
|
||||
ATHUtil.resolveColor(view.context, R.attr.colorPrimary)
|
||||
ATHUtil.resolveColor(view.context, androidx.appcompat.R.attr.colorPrimary)
|
||||
)
|
||||
)
|
||||
}
|
||||
|
|
|
@ -124,14 +124,14 @@ class PlayingNotificationClassic(
|
|||
super.onLoadFailed(errorDrawable)
|
||||
update(
|
||||
null,
|
||||
resolveColor(context, R.attr.colorSurface, Color.WHITE)
|
||||
resolveColor(context, com.google.android.material.R.attr.colorSurface, Color.WHITE)
|
||||
)
|
||||
}
|
||||
|
||||
override fun onLoadCleared(placeholder: Drawable?) {
|
||||
update(
|
||||
null,
|
||||
resolveColor(context, R.attr.colorSurface, Color.WHITE)
|
||||
resolveColor(context, com.google.android.material.R.attr.colorSurface, Color.WHITE)
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -157,7 +157,7 @@ class PlayingNotificationClassic(
|
|||
if (!VersionUtils.hasS()) {
|
||||
if (!PreferenceUtil.isColoredNotification) {
|
||||
bgColorFinal =
|
||||
resolveColor(context, R.attr.colorSurface, Color.WHITE)
|
||||
resolveColor(context, com.google.android.material.R.attr.colorSurface, Color.WHITE)
|
||||
}
|
||||
setBackgroundColor(bgColorFinal)
|
||||
setNotificationContent(ColorUtil.isColorLight(bgColorFinal))
|
||||
|
|
|
@ -35,7 +35,6 @@ import java.util.List;
|
|||
import code.name.monkey.appthemehelper.ThemeStore;
|
||||
import code.name.monkey.appthemehelper.util.ColorUtil;
|
||||
import code.name.monkey.appthemehelper.util.VersionUtils;
|
||||
import code.name.monkey.retromusic.R;
|
||||
|
||||
public class RetroColorUtil {
|
||||
public static int desaturateColor(int color, float ratio) {
|
||||
|
@ -224,7 +223,7 @@ public class RetroColorUtil {
|
|||
|
||||
public static int getMD3AccentColor(@NotNull Context context) {
|
||||
if (VersionUtils.hasS()) {
|
||||
return ContextCompat.getColor(context, R.color.m3_accent_color);
|
||||
return ContextCompat.getColor(context, code.name.monkey.appthemehelper.R.color.m3_accent_color);
|
||||
} else {
|
||||
return ThemeStore.Companion.accentColor(context);
|
||||
}
|
||||
|
|
|
@ -35,7 +35,6 @@ import java.util.List;
|
|||
|
||||
import code.name.monkey.appthemehelper.util.ATHUtil;
|
||||
import code.name.monkey.appthemehelper.util.ColorUtil;
|
||||
import code.name.monkey.retromusic.R;
|
||||
|
||||
/** A class the processes media notifications and extracts the right text and background colors. */
|
||||
public class MediaNotificationProcessor {
|
||||
|
@ -454,7 +453,7 @@ public class MediaNotificationProcessor {
|
|||
public int getMightyColor() {
|
||||
boolean isDarkBg =
|
||||
ColorUtil.INSTANCE.isColorLight(
|
||||
ATHUtil.INSTANCE.resolveColor(context, R.attr.colorSurface));
|
||||
ATHUtil.INSTANCE.resolveColor(context, com.google.android.material.R.attr.colorSurface));
|
||||
if (isDarkBg) {
|
||||
if (isColorLight(backgroundColor)) {
|
||||
return primaryTextColor;
|
||||
|
|
|
@ -38,8 +38,6 @@ import androidx.core.content.ContextCompat;
|
|||
import java.util.Locale;
|
||||
import java.util.WeakHashMap;
|
||||
|
||||
import code.name.monkey.retromusic.R;
|
||||
|
||||
/**
|
||||
* Helper class to process legacy (Holo) notifications to make them look like material
|
||||
* notifications.
|
||||
|
@ -62,7 +60,7 @@ public class NotificationColorUtil {
|
|||
|
||||
private NotificationColorUtil(Context context) {
|
||||
mGrayscaleIconMaxSize =
|
||||
context.getResources().getDimensionPixelSize(R.dimen.notification_large_icon_width);
|
||||
context.getResources().getDimensionPixelSize(androidx.core.R.dimen.notification_large_icon_width);
|
||||
}
|
||||
|
||||
public static NotificationColorUtil getInstance(Context context) {
|
||||
|
|
|
@ -51,7 +51,7 @@ class ColorIconsImageView @JvmOverloads constructor(
|
|||
val desaturatedColor = RetroColorUtil.desaturateColor(color, 0.4f)
|
||||
backgroundTintList = ColorStateList.valueOf(desaturatedColor)
|
||||
imageTintList =
|
||||
ColorStateList.valueOf(ATHUtil.resolveColor(context, R.attr.colorSurface))
|
||||
ColorStateList.valueOf(ATHUtil.resolveColor(context, com.google.android.material.R.attr.colorSurface))
|
||||
} else {
|
||||
val finalColor = MaterialColors.harmonize(
|
||||
color,
|
||||
|
|
|
@ -32,8 +32,6 @@ import androidx.annotation.NonNull;
|
|||
import androidx.annotation.Nullable;
|
||||
import androidx.core.graphics.drawable.DrawableCompat;
|
||||
|
||||
import code.name.monkey.retromusic.R;
|
||||
|
||||
public class PopupBackground extends Drawable {
|
||||
|
||||
private final int mPaddingEnd;
|
||||
|
@ -52,8 +50,8 @@ public class PopupBackground extends Drawable {
|
|||
mPaint.setColor(color);
|
||||
mPaint.setStyle(Paint.Style.FILL);
|
||||
Resources resources = context.getResources();
|
||||
mPaddingStart = resources.getDimensionPixelOffset(R.dimen.afs_md2_popup_padding_start);
|
||||
mPaddingEnd = resources.getDimensionPixelOffset(R.dimen.afs_md2_popup_padding_end);
|
||||
mPaddingStart = resources.getDimensionPixelOffset(me.zhanghai.android.fastscroll.R.dimen.afs_md2_popup_padding_start);
|
||||
mPaddingEnd = resources.getDimensionPixelOffset(me.zhanghai.android.fastscroll.R.dimen.afs_md2_popup_padding_end);
|
||||
}
|
||||
|
||||
private static void pathArcTo(
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -7,6 +7,8 @@ org.gradle.configureondemand=true
|
|||
org.gradle.jvmargs=-Xmx4g -XX:+UseParallelGC -Dfile.encoding=UTF-8
|
||||
org.gradle.parallel=true
|
||||
|
||||
# https://developer.android.com/studio/build/optimize-your-build#use-non-transitive-r-classes
|
||||
android.nonTransitiveRClass=true
|
||||
# https://blog.jetbrains.com/kotlin/2022/07/a-new-approach-to-incremental-compilation-in-kotlin/
|
||||
kotlin.incremental.useClasspathSnapshot=true
|
||||
# https://docs.gradle.org/7.5/userguide/configuration_cache.html
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue