Error handling added
This commit is contained in:
parent
a773074c77
commit
8dfb0dc8dd
50 changed files with 2206 additions and 1473 deletions
|
@ -18,8 +18,6 @@ class App : MultiDexApplication() {
|
|||
super.onCreate()
|
||||
instance = this
|
||||
|
||||
setupErrorHandler()
|
||||
|
||||
// default theme
|
||||
if (!ThemeStore.isConfigured(this, 3)) {
|
||||
ThemeStore.editTheme(this)
|
||||
|
|
|
@ -83,6 +83,10 @@ class AppWidgetText : BaseAppWidget() {
|
|||
else
|
||||
R.drawable.ic_play_arrow_white_24dp
|
||||
appWidgetView.setImageViewBitmap(R.id.button_toggle_play_pause, BaseAppWidget.createBitmap(RetroUtil.getTintedVectorDrawable(context, playPauseRes, ContextCompat.getColor(context, R.color.md_white_1000)), 1f))
|
||||
appWidgetView.setImageViewBitmap(R.id.button_next, BaseAppWidget.createBitmap(RetroUtil.getTintedVectorDrawable(context, R.drawable.ic_skip_next_white_24dp, ContextCompat.getColor(context, R.color.md_white_1000)), 1f))
|
||||
appWidgetView.setImageViewBitmap(R.id.button_prev, BaseAppWidget.createBitmap(RetroUtil.getTintedVectorDrawable(context, R.drawable.ic_skip_previous_white_24dp, ContextCompat.getColor(context, R.color.md_white_1000)), 1f))
|
||||
|
||||
|
||||
|
||||
pushUpdate(service.applicationContext, appWidgetIds, appWidgetView)
|
||||
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
package code.name.monkey.retromusic.ui.activities;
import android.os.Bundle;
import androidx.appcompat.app.AppCompatActivity;
import code.name.monkey.retromusic.R;
public class ErrorHandlerActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_error_handler);
}
}
|
|
@ -59,13 +59,13 @@ public class WhatsNewActivity extends AbsBaseActivity {
|
|||
setNavigationbarColorAuto();
|
||||
setTaskDescriptionColorAuto();
|
||||
|
||||
toolbar.setBackgroundColor(ThemeStore.primaryColor(this));
|
||||
appBarLayout.setBackgroundColor(ThemeStore.primaryColor(this));
|
||||
toolbar.setBackgroundColor(ThemeStore.Companion.primaryColor(this));
|
||||
appBarLayout.setBackgroundColor(ThemeStore.Companion.primaryColor(this));
|
||||
setSupportActionBar(toolbar);
|
||||
setTitle(null);
|
||||
toolbar.setNavigationOnClickListener(v -> onBackPressed());
|
||||
title.setTextColor(ThemeStore.textColorPrimary(this));
|
||||
ToolbarContentTintHelper.colorBackButton(toolbar, ThemeStore.accentColor(this));
|
||||
title.setTextColor(ThemeStore.Companion.textColorPrimary(this));
|
||||
ToolbarContentTintHelper.colorBackButton(toolbar, ThemeStore.Companion.accentColor(this));
|
||||
|
||||
try {
|
||||
// Load from phonograph-changelog.html in the assets folder
|
||||
|
@ -78,13 +78,13 @@ public class WhatsNewActivity extends AbsBaseActivity {
|
|||
in.close();
|
||||
|
||||
// Inject color values for WebView body background and links
|
||||
final String backgroundColor = colorToHex(ThemeStore.primaryColor(this));
|
||||
final String backgroundColor = colorToHex(ThemeStore.Companion.primaryColor(this));
|
||||
final String contentColor = ThemeSingleton.get().darkTheme ? "#ffffff" : "#000000";
|
||||
webView.loadData(buf.toString()
|
||||
.replace("{style-placeholder}",
|
||||
String.format("body { background-color: %s; color: %s; }", backgroundColor, contentColor))
|
||||
.replace("{link-color}", colorToHex(ThemeSingleton.get().positiveColor.getDefaultColor()))
|
||||
.replace("{link-color-active}", colorToHex(ColorUtil.lightenColor(ThemeSingleton.get().positiveColor.getDefaultColor())))
|
||||
.replace("{link-color-active}", colorToHex(ColorUtil.INSTANCE.lightenColor(ThemeSingleton.get().positiveColor.getDefaultColor())))
|
||||
, "text/html", "UTF-8");
|
||||
} catch (Throwable e) {
|
||||
webView.loadData("<h1>Unable to load</h1><p>" + e.getLocalizedMessage() + "</p>", "text/html", "UTF-8");
|
||||
|
|
|
@ -17,7 +17,7 @@ import code.name.monkey.retromusic.R
|
|||
import code.name.monkey.retromusic.util.PreferenceUtil
|
||||
import code.name.monkey.retromusic.util.RetroUtil
|
||||
|
||||
abstract class AbsThemeActivity : ATHActivity(), Runnable {
|
||||
abstract class AbsThemeActivity : AbsCrashCollector(), Runnable {
|
||||
|
||||
private val handler = Handler()
|
||||
|
||||
|
|
|
@ -166,16 +166,16 @@ public class LibraryFragment extends AbsMainActivityFragment implements CabHolde
|
|||
|
||||
@SuppressWarnings("ConstantConditions")
|
||||
private void setupToolbar() {
|
||||
bannerTitle.setTextColor(ThemeStore.textColorPrimary(getContext()));
|
||||
bannerTitle.setTextColor(ThemeStore.Companion.textColorPrimary(getContext()));
|
||||
|
||||
int primaryColor = ThemeStore.primaryColor(getContext());
|
||||
int primaryColor = ThemeStore.Companion.primaryColor(getContext());
|
||||
TintHelper.setTintAuto(contentContainer, primaryColor, true);
|
||||
|
||||
toolbar.setBackgroundColor(primaryColor);
|
||||
toolbar.setNavigationIcon(R.drawable.ic_search_white_24dp);
|
||||
appBarLayout.setBackgroundColor(primaryColor);
|
||||
appBarLayout.addOnOffsetChangedListener((appBarLayout, verticalOffset) ->
|
||||
getMainActivity().setLightStatusbar(!ATHUtil.isWindowBackgroundDark(getContext())));
|
||||
getMainActivity().setLightStatusbar(!ATHUtil.INSTANCE.isWindowBackgroundDark(getContext())));
|
||||
getMainActivity().setTitle(null);
|
||||
getMainActivity().setSupportActionBar(toolbar);
|
||||
}
|
||||
|
@ -216,7 +216,7 @@ public class LibraryFragment extends AbsMainActivityFragment implements CabHolde
|
|||
.setMenu(menuRes)
|
||||
.setCloseDrawableRes(R.drawable.ic_close_white_24dp)
|
||||
.setBackgroundColor(
|
||||
RetroColorUtil.shiftBackgroundColorForLightText(ThemeStore.primaryColor(getActivity())))
|
||||
RetroColorUtil.shiftBackgroundColorForLightText(ThemeStore.Companion.primaryColor(getActivity())))
|
||||
.start(callback);
|
||||
return cab;
|
||||
}
|
||||
|
|
|
@ -225,10 +225,10 @@ public class FoldersFragment extends AbsMainActivityFragment implements
|
|||
}
|
||||
|
||||
private void setUpAppbarColor() {
|
||||
title.setTextColor(ThemeStore.textColorPrimary(getContext()));
|
||||
title.setTextColor(ThemeStore.Companion.textColorPrimary(getContext()));
|
||||
|
||||
//noinspection ConstantConditions
|
||||
int primaryColor = ThemeStore.primaryColor(getContext());
|
||||
int primaryColor = ThemeStore.Companion.primaryColor(getContext());
|
||||
|
||||
toolbar.setNavigationIcon(R.drawable.ic_keyboard_backspace_black_24dp);
|
||||
//noinspection ConstantConditions
|
||||
|
@ -242,9 +242,9 @@ public class FoldersFragment extends AbsMainActivityFragment implements
|
|||
getActivity().onBackPressed();
|
||||
});
|
||||
|
||||
breadCrumbs.setActivatedContentColor(ToolbarContentTintHelper.toolbarTitleColor(getActivity(), ColorUtil.darkenColor(primaryColor)));
|
||||
breadCrumbs.setDeactivatedContentColor(ToolbarContentTintHelper.toolbarSubtitleColor(getActivity(), ColorUtil.darkenColor(primaryColor)));
|
||||
appBarLayout.addOnOffsetChangedListener((appBarLayout, verticalOffset) -> getMainActivity().setLightStatusbar(!ATHUtil.isWindowBackgroundDark(getContext())));
|
||||
breadCrumbs.setActivatedContentColor(ToolbarContentTintHelper.toolbarTitleColor(getActivity(), ColorUtil.INSTANCE.darkenColor(primaryColor)));
|
||||
breadCrumbs.setDeactivatedContentColor(ToolbarContentTintHelper.toolbarSubtitleColor(getActivity(), ColorUtil.INSTANCE.darkenColor(primaryColor)));
|
||||
appBarLayout.addOnOffsetChangedListener((appBarLayout, verticalOffset) -> getMainActivity().setLightStatusbar(!ATHUtil.INSTANCE.isWindowBackgroundDark(getContext())));
|
||||
}
|
||||
|
||||
private void setUpBreadCrumbs() {
|
||||
|
@ -254,7 +254,7 @@ public class FoldersFragment extends AbsMainActivityFragment implements
|
|||
private void setUpRecyclerView() {
|
||||
//noinspection ConstantConditions
|
||||
ViewUtil.setUpFastScrollRecyclerViewColor(getActivity(), recyclerView,
|
||||
ThemeStore.accentColor(getActivity()));
|
||||
ThemeStore.Companion.accentColor(getActivity()));
|
||||
recyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
|
||||
appBarLayout.addOnOffsetChangedListener(this);
|
||||
}
|
||||
|
@ -307,7 +307,7 @@ public class FoldersFragment extends AbsMainActivityFragment implements
|
|||
cab = new MaterialCab(getMainActivity(), R.id.cab_stub)
|
||||
.setMenu(menuRes)
|
||||
.setCloseDrawableRes(R.drawable.ic_close_white_24dp)
|
||||
.setBackgroundColor(RetroColorUtil.shiftBackgroundColorForLightText(ThemeStore.primaryColor(getActivity())))
|
||||
.setBackgroundColor(RetroColorUtil.shiftBackgroundColorForLightText(ThemeStore.Companion.primaryColor(getActivity())))
|
||||
.start(callback);
|
||||
return cab;
|
||||
}
|
||||
|
@ -379,7 +379,7 @@ public class FoldersFragment extends AbsMainActivityFragment implements
|
|||
.setAction(R.string.action_scan,
|
||||
v -> new ListPathsAsyncTask(getActivity(), this::scanPaths)
|
||||
.execute(new ListPathsAsyncTask.LoadingInfo(finalFile, AUDIO_FILE_FILTER)))
|
||||
.setActionTextColor(ThemeStore.accentColor(getActivity()))
|
||||
.setActionTextColor(ThemeStore.Companion.accentColor(getActivity()))
|
||||
.show();
|
||||
}
|
||||
}).execute(new ListSongsAsyncTask.LoadingInfo(toList(file.getParentFile()), fileFilter,
|
||||
|
|
|
@ -104,9 +104,9 @@ class FlatPlayerFragment : AbsPlayerFragment(), PlayerAlbumCoverFragment.Callbac
|
|||
|
||||
//TransitionManager.beginDelayedTransition(mToolbar);
|
||||
val iconColor = if (PreferenceUtil.getInstance().adaptiveColor)
|
||||
MaterialValueHelper.getPrimaryTextColor(context, isLight)
|
||||
MaterialValueHelper.getPrimaryTextColor(context!!, isLight)
|
||||
else
|
||||
ATHUtil.resolveColor(context, R.attr.iconColor)
|
||||
ATHUtil.resolveColor(context!!, R.attr.iconColor)
|
||||
ToolbarContentTintHelper.colorizeToolbar(playerToolbar, iconColor, activity)
|
||||
if (PreferenceUtil.getInstance().adaptiveColor) {
|
||||
colorize(color)
|
||||
|
|
|
@ -96,20 +96,20 @@ class LockScreenPlayerControlsFragment : AbsPlayerControlsFragment() {
|
|||
override fun setDark(color: Int) {
|
||||
setProgressBarColor(progressSlider, color)
|
||||
|
||||
val colorBg = ATHUtil.resolveColor(activity, android.R.attr.colorBackground)
|
||||
val colorBg = ATHUtil.resolveColor(context!!, android.R.attr.colorBackground)
|
||||
if (ColorUtil.isColorLight(colorBg)) {
|
||||
lastPlaybackControlsColor = MaterialValueHelper.getSecondaryTextColor(activity, true)
|
||||
lastDisabledPlaybackControlsColor = MaterialValueHelper.getSecondaryDisabledTextColor(activity, true)
|
||||
lastPlaybackControlsColor = MaterialValueHelper.getSecondaryTextColor(context!!, true)
|
||||
lastDisabledPlaybackControlsColor = MaterialValueHelper.getSecondaryDisabledTextColor(context!!, true)
|
||||
} else {
|
||||
lastPlaybackControlsColor = MaterialValueHelper.getPrimaryTextColor(activity, false)
|
||||
lastDisabledPlaybackControlsColor = MaterialValueHelper.getPrimaryDisabledTextColor(activity, false)
|
||||
lastPlaybackControlsColor = MaterialValueHelper.getPrimaryTextColor(context!!, false)
|
||||
lastDisabledPlaybackControlsColor = MaterialValueHelper.getPrimaryDisabledTextColor(context!!, false)
|
||||
}
|
||||
|
||||
updatePrevNextColor()
|
||||
|
||||
val isDark = ColorUtil.isColorLight(color)
|
||||
text!!.setTextColor(color)
|
||||
TintHelper.setTintAuto(playPauseButton, MaterialValueHelper.getPrimaryTextColor(context, isDark), false)
|
||||
TintHelper.setTintAuto(playPauseButton, MaterialValueHelper.getPrimaryTextColor(context!!, isDark), false)
|
||||
TintHelper.setTintAuto(playPauseButton, color, true)
|
||||
}
|
||||
|
||||
|
|
|
@ -90,13 +90,13 @@ class MaterialControlsFragment : AbsPlayerControlsFragment() {
|
|||
}
|
||||
|
||||
override fun setDark(color: Int) {
|
||||
val colorBg = ATHUtil.resolveColor(activity, android.R.attr.colorBackground)
|
||||
val colorBg = ATHUtil.resolveColor(context, android.R.attr.colorBackground)
|
||||
if (ColorUtil.isColorLight(colorBg)) {
|
||||
lastPlaybackControlsColor = MaterialValueHelper.getSecondaryTextColor(activity, true)
|
||||
lastDisabledPlaybackControlsColor = MaterialValueHelper.getSecondaryDisabledTextColor(activity, true)
|
||||
lastPlaybackControlsColor = MaterialValueHelper.getSecondaryTextColor(context, true)
|
||||
lastDisabledPlaybackControlsColor = MaterialValueHelper.getSecondaryDisabledTextColor(context, true)
|
||||
} else {
|
||||
lastPlaybackControlsColor = MaterialValueHelper.getPrimaryTextColor(activity, false)
|
||||
lastDisabledPlaybackControlsColor = MaterialValueHelper.getPrimaryDisabledTextColor(activity, false)
|
||||
lastPlaybackControlsColor = MaterialValueHelper.getPrimaryTextColor(context, false)
|
||||
lastDisabledPlaybackControlsColor = MaterialValueHelper.getPrimaryDisabledTextColor(context!!, false)
|
||||
}
|
||||
|
||||
updateRepeatState()
|
||||
|
|
|
@ -43,7 +43,7 @@ class MaterialFragment : AbsPlayerFragment(), PlayerAlbumCoverFragment.Callbacks
|
|||
}
|
||||
|
||||
override fun toolbarIconColor(): Int {
|
||||
return ATHUtil.resolveColor(context, R.attr.iconColor)
|
||||
return ATHUtil.resolveColor(context!!, R.attr.iconColor)
|
||||
}
|
||||
|
||||
override fun onColorChanged(color: Int) {
|
||||
|
@ -51,7 +51,7 @@ class MaterialFragment : AbsPlayerFragment(), PlayerAlbumCoverFragment.Callbacks
|
|||
lastColor = color
|
||||
callbacks!!.onPaletteColorChanged()
|
||||
|
||||
ToolbarContentTintHelper.colorizeToolbar(playerToolbar, ATHUtil.resolveColor(context, R.attr.iconColor), activity)
|
||||
ToolbarContentTintHelper.colorizeToolbar(playerToolbar, ATHUtil.resolveColor(context!!, R.attr.iconColor), activity)
|
||||
}
|
||||
|
||||
override fun toggleFavorite(song: Song) {
|
||||
|
|
|
@ -61,13 +61,13 @@ class PlayerPlaybackControlsFragment : AbsPlayerControlsFragment() {
|
|||
}
|
||||
|
||||
override fun setDark(color: Int) {
|
||||
val colorBg = ATHUtil.resolveColor(activity, android.R.attr.colorBackground)
|
||||
val colorBg = ATHUtil.resolveColor(context!!, android.R.attr.colorBackground)
|
||||
if (ColorUtil.isColorLight(colorBg)) {
|
||||
lastPlaybackControlsColor = MaterialValueHelper.getSecondaryTextColor(activity, true)
|
||||
lastDisabledPlaybackControlsColor = MaterialValueHelper.getSecondaryDisabledTextColor(activity, true)
|
||||
lastPlaybackControlsColor = MaterialValueHelper.getSecondaryTextColor(context!!, true)
|
||||
lastDisabledPlaybackControlsColor = MaterialValueHelper.getSecondaryDisabledTextColor(context!!, true)
|
||||
} else {
|
||||
lastPlaybackControlsColor = MaterialValueHelper.getPrimaryTextColor(activity, false)
|
||||
lastDisabledPlaybackControlsColor = MaterialValueHelper.getPrimaryDisabledTextColor(activity, false)
|
||||
lastPlaybackControlsColor = MaterialValueHelper.getPrimaryTextColor(context!!, false)
|
||||
lastDisabledPlaybackControlsColor = MaterialValueHelper.getPrimaryDisabledTextColor(context!!, false)
|
||||
}
|
||||
|
||||
if (PreferenceUtil.getInstance().adaptiveColor) {
|
||||
|
@ -82,7 +82,7 @@ class PlayerPlaybackControlsFragment : AbsPlayerControlsFragment() {
|
|||
}
|
||||
|
||||
private fun setFabColor(i: Int) {
|
||||
TintHelper.setTintAuto(playPauseButton, MaterialValueHelper.getPrimaryTextColor(context, ColorUtil.isColorLight(i)), false)
|
||||
TintHelper.setTintAuto(playPauseButton, MaterialValueHelper.getPrimaryTextColor(context!!, ColorUtil.isColorLight(i)), false)
|
||||
TintHelper.setTintAuto(playPauseButton, i, true)
|
||||
setProgressBarColor(i)
|
||||
}
|
||||
|
|
|
@ -118,17 +118,17 @@ class PlainPlaybackControlsFragment : AbsPlayerControlsFragment() {
|
|||
|
||||
|
||||
override fun setDark(color: Int) {
|
||||
val colorBg = ATHUtil.resolveColor(activity, android.R.attr.colorBackground)
|
||||
val colorBg = ATHUtil.resolveColor(context!!, android.R.attr.colorBackground)
|
||||
if (ColorUtil.isColorLight(colorBg)) {
|
||||
lastPlaybackControlsColor = MaterialValueHelper.getSecondaryTextColor(activity, true)
|
||||
lastDisabledPlaybackControlsColor = MaterialValueHelper.getSecondaryDisabledTextColor(activity, true)
|
||||
lastPlaybackControlsColor = MaterialValueHelper.getSecondaryTextColor(context!!, true)
|
||||
lastDisabledPlaybackControlsColor = MaterialValueHelper.getSecondaryDisabledTextColor(context!!, true)
|
||||
} else {
|
||||
lastPlaybackControlsColor = MaterialValueHelper.getPrimaryTextColor(activity, false)
|
||||
lastDisabledPlaybackControlsColor = MaterialValueHelper.getPrimaryDisabledTextColor(activity, false)
|
||||
lastPlaybackControlsColor = MaterialValueHelper.getPrimaryTextColor(context!!, false)
|
||||
lastDisabledPlaybackControlsColor = MaterialValueHelper.getPrimaryDisabledTextColor(context!!, false)
|
||||
}
|
||||
|
||||
if (PreferenceUtil.getInstance().adaptiveColor) {
|
||||
TintHelper.setTintAuto(playPauseButton, MaterialValueHelper.getPrimaryTextColor(context, ColorUtil.isColorLight(color)), false)
|
||||
TintHelper.setTintAuto(playPauseButton, MaterialValueHelper.getPrimaryTextColor(context!!, ColorUtil.isColorLight(color)), false)
|
||||
TintHelper.setTintAuto(playPauseButton, color, true)
|
||||
setProgressBarColor(progressSlider, color)
|
||||
}
|
||||
|
|
|
@ -81,14 +81,14 @@ class PlainPlayerFragment : AbsPlayerFragment(), PlayerAlbumCoverFragment.Callba
|
|||
}
|
||||
|
||||
override fun toolbarIconColor(): Int {
|
||||
return ATHUtil.resolveColor(context, R.attr.iconColor)
|
||||
return ATHUtil.resolveColor(context!!, R.attr.iconColor)
|
||||
}
|
||||
|
||||
override fun onColorChanged(color: Int) {
|
||||
plainPlaybackControlsFragment.setDark(color)
|
||||
lastColor = color
|
||||
callbacks!!.onPaletteColorChanged()
|
||||
ToolbarContentTintHelper.colorizeToolbar(playerToolbar!!, ATHUtil.resolveColor(context, R.attr.iconColor), activity)
|
||||
ToolbarContentTintHelper.colorizeToolbar(playerToolbar!!, ATHUtil.resolveColor(context!!, R.attr.iconColor), activity)
|
||||
}
|
||||
|
||||
override fun onFavoriteToggled() {
|
||||
|
|
|
@ -179,21 +179,17 @@ class SimplePlaybackControlsFragment : AbsPlayerControlsFragment() {
|
|||
}
|
||||
|
||||
override fun setDark(color: Int) {
|
||||
val colorBg = ATHUtil.resolveColor(activity, android.R.attr.colorBackground)
|
||||
val colorBg = ATHUtil.resolveColor(context!!, android.R.attr.colorBackground)
|
||||
if (ColorUtil.isColorLight(colorBg)) {
|
||||
lastPlaybackControlsColor = MaterialValueHelper
|
||||
.getSecondaryTextColor(activity, true)
|
||||
lastDisabledPlaybackControlsColor = MaterialValueHelper
|
||||
.getSecondaryDisabledTextColor(activity, true)
|
||||
lastPlaybackControlsColor = MaterialValueHelper.getSecondaryTextColor(context!!, true)
|
||||
lastDisabledPlaybackControlsColor = MaterialValueHelper.getSecondaryDisabledTextColor(context!!, true)
|
||||
} else {
|
||||
lastPlaybackControlsColor = MaterialValueHelper
|
||||
.getPrimaryTextColor(activity, false)
|
||||
lastDisabledPlaybackControlsColor = MaterialValueHelper
|
||||
.getPrimaryDisabledTextColor(activity, false)
|
||||
lastPlaybackControlsColor = MaterialValueHelper.getPrimaryTextColor(context!!, false)
|
||||
lastDisabledPlaybackControlsColor = MaterialValueHelper.getPrimaryDisabledTextColor(context!!, false)
|
||||
}
|
||||
|
||||
if (PreferenceUtil.getInstance().adaptiveColor) {
|
||||
TintHelper.setTintAuto(playPauseButton, MaterialValueHelper.getPrimaryTextColor(context, ColorUtil.isColorLight(color)), false)
|
||||
TintHelper.setTintAuto(playPauseButton, MaterialValueHelper.getPrimaryTextColor(context!!, ColorUtil.isColorLight(color)), false)
|
||||
TintHelper.setTintAuto(playPauseButton, color, true)
|
||||
text.setTextColor(color)
|
||||
} else {
|
||||
|
|
|
@ -61,14 +61,14 @@ class SimplePlayerFragment : AbsPlayerFragment(), PlayerAlbumCoverFragment.Callb
|
|||
}
|
||||
|
||||
override fun toolbarIconColor(): Int {
|
||||
return ATHUtil.resolveColor(context, R.attr.iconColor)
|
||||
return ATHUtil.resolveColor(context!!, R.attr.iconColor)
|
||||
}
|
||||
|
||||
override fun onColorChanged(color: Int) {
|
||||
lastColor = color
|
||||
callbacks!!.onPaletteColorChanged()
|
||||
simplePlaybackControlsFragment.setDark(color)
|
||||
ToolbarContentTintHelper.colorizeToolbar(playerToolbar, ATHUtil.resolveColor(context, R.attr.iconColor), activity)
|
||||
ToolbarContentTintHelper.colorizeToolbar(playerToolbar, ATHUtil.resolveColor(context!!, R.attr.iconColor), activity)
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -56,7 +56,7 @@ public abstract class AbsSettingsFragment extends ATEPreferenceFragmentCompat {
|
|||
public void onViewCreated(@NonNull View view, Bundle savedInstanceState) {
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
setDivider(new ColorDrawable(Color.TRANSPARENT));
|
||||
getListView().setBackgroundColor(ThemeStore.primaryColor(getContext()));
|
||||
getListView().setBackgroundColor(ThemeStore.Companion.primaryColor(getContext()));
|
||||
getListView().setOverScrollMode(View.OVER_SCROLL_NEVER);
|
||||
getListView().setPadding(0, 0, 0, 0);
|
||||
getListView().setPaddingRelative(0, 0, 0, 0);
|
||||
|
|
|
@ -42,7 +42,7 @@ public class RetroColorUtil {
|
|||
if (inverse != -1) {
|
||||
return ColorUtils.getReadableText(inverse, background, 150);
|
||||
}
|
||||
return ColorUtil.stripAlpha(getSwatch(palette).getTitleTextColor());
|
||||
return ColorUtil.INSTANCE.stripAlpha(getSwatch(palette).getTitleTextColor());
|
||||
}
|
||||
|
||||
@NonNull
|
||||
|
@ -163,8 +163,8 @@ public class RetroColorUtil {
|
|||
|
||||
@ColorInt
|
||||
public static int shiftBackgroundColorForLightText(@ColorInt int backgroundColor) {
|
||||
while (ColorUtil.isColorLight(backgroundColor)) {
|
||||
backgroundColor = ColorUtil.darkenColor(backgroundColor);
|
||||
while (ColorUtil.INSTANCE.isColorLight(backgroundColor)) {
|
||||
backgroundColor = ColorUtil.INSTANCE.darkenColor(backgroundColor);
|
||||
}
|
||||
return backgroundColor;
|
||||
}
|
||||
|
|
|
@ -200,7 +200,7 @@ public class RetroUtil {
|
|||
public static Drawable getTintedDrawable(@DrawableRes int id) {
|
||||
return TintHelper
|
||||
.createTintedDrawable(ContextCompat.getDrawable(App.Companion.getInstance(), id),
|
||||
ThemeStore.accentColor(App.Companion.getInstance()));
|
||||
ThemeStore.Companion.accentColor(App.Companion.getInstance()));
|
||||
}
|
||||
|
||||
public static Bitmap createBitmap(Drawable drawable, float sizeMultiplier) {
|
||||
|
|
|
@ -78,7 +78,7 @@ public class ViewUtil {
|
|||
FastScrollRecyclerView recyclerView, int accentColor) {
|
||||
recyclerView.setPopupBgColor(accentColor);
|
||||
recyclerView.setPopupTextColor(
|
||||
MaterialValueHelper.getPrimaryTextColor(context, ColorUtil.isColorLight(accentColor)));
|
||||
MaterialValueHelper.INSTANCE.getPrimaryTextColor(context, ColorUtil.INSTANCE.isColorLight(accentColor)));
|
||||
recyclerView.setThumbColor(accentColor);
|
||||
recyclerView.setTrackColor(Color.TRANSPARENT);
|
||||
//recyclerView.setTrackColor(ColorUtil.withAlpha(ATHUtil.resolveColor(context, R.attr.colorControlNormal), 0.12f));
|
||||
|
|
|
@ -124,7 +124,7 @@ public class MediaNotificationProcessor {
|
|||
}
|
||||
|
||||
private int selectForegroundColor(int backgroundColor, Palette palette) {
|
||||
if (ColorUtil.isColorLight(backgroundColor)) {
|
||||
if (ColorUtil.INSTANCE.isColorLight(backgroundColor)) {
|
||||
return selectForegroundColorForSwatches(palette.getDarkVibrantSwatch(),
|
||||
palette.getVibrantSwatch(),
|
||||
palette.getDarkMutedSwatch(),
|
||||
|
|
|
@ -24,13 +24,13 @@ public class BottomNavigationBarTinted extends BottomNavigationView {
|
|||
public BottomNavigationBarTinted(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
setLabelVisibilityMode(PreferenceUtil.getInstance().getTabTitleMode());
|
||||
setBackgroundColor(ThemeStore.primaryColor(context));
|
||||
setBackgroundColor(ThemeStore.Companion.primaryColor(context));
|
||||
setSelectedItemId(PreferenceUtil.getInstance().getLastPage());
|
||||
|
||||
int iconColor = ATHUtil.resolveColor(context, R.attr.iconColor);
|
||||
int accentColor = ThemeStore.accentColor(context);
|
||||
NavigationViewUtil.setItemIconColors(this, ColorUtil.withAlpha(iconColor, 0.5f), accentColor);
|
||||
NavigationViewUtil.setItemTextColors(this, ColorUtil.withAlpha(iconColor, 0.5f), accentColor);
|
||||
int iconColor = ATHUtil.INSTANCE.resolveColor(context, R.attr.iconColor);
|
||||
int accentColor = ThemeStore.Companion.accentColor(context);
|
||||
NavigationViewUtil.INSTANCE.setItemIconColors(this, ColorUtil.INSTANCE.withAlpha(iconColor, 0.5f), accentColor);
|
||||
NavigationViewUtil.INSTANCE.setItemTextColors(this, ColorUtil.INSTANCE.withAlpha(iconColor, 0.5f), accentColor);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -135,8 +135,8 @@ public class BreadCrumbLayout extends HorizontalScrollView implements View.OnCli
|
|||
private SelectionCallback mCallback;
|
||||
|
||||
private void init() {
|
||||
contentColorActivated = ThemeStore.textColorPrimary(getContext());
|
||||
contentColorDeactivated = ThemeStore.textColorSecondary(getContext());
|
||||
contentColorActivated = ThemeStore.Companion.textColorPrimary(getContext());
|
||||
contentColorDeactivated = ThemeStore.Companion.textColorSecondary(getContext());
|
||||
setMinimumHeight((int) getResources().getDimension(R.dimen.tab_height));
|
||||
setClipToPadding(false);
|
||||
setHorizontalScrollBarEnabled(false);
|
||||
|
|
|
@ -72,7 +72,7 @@ public class CollapsingFAB extends FrameLayout {
|
|||
|
||||
public void setColor(int color) {
|
||||
this.color = color;
|
||||
int textColor = MaterialValueHelper.getPrimaryTextColor(getContext(), ColorUtil.isColorLight(color));
|
||||
int textColor = MaterialValueHelper.INSTANCE.getPrimaryTextColor(getContext(), ColorUtil.INSTANCE.isColorLight(color));
|
||||
shuffleIcon.setColorFilter(textColor);
|
||||
textView.setTextColor(textColor);
|
||||
cardView.setCardBackgroundColor(ColorStateList.valueOf(color));
|
||||
|
|
|
@ -27,6 +27,6 @@ public class IconImageView extends androidx.appcompat.widget.AppCompatImageView
|
|||
|
||||
private void init(Context context) {
|
||||
if (context == null) return;
|
||||
setColorFilter(ATHUtil.resolveColor(context, R.attr.iconColor), PorterDuff.Mode.SRC_IN);
|
||||
setColorFilter(ATHUtil.INSTANCE.resolveColor(context, R.attr.iconColor), PorterDuff.Mode.SRC_IN);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -42,12 +42,12 @@ public class RoundedBottomSheetDialogFragment extends AppCompatDialogFragment {
|
|||
if (bottomSheet != null) {
|
||||
BottomSheetBehavior behavior = BottomSheetBehavior.from(bottomSheet);
|
||||
behavior.setState(BottomSheetBehavior.STATE_EXPANDED);
|
||||
bottomSheet.setBackground(RetroUtil.getTintedDrawable(getContext(), R.drawable.bg_bottom_sheet_dialog_fragment, ThemeStore.primaryColor(getContext())));
|
||||
bottomSheet.setBackground(RetroUtil.getTintedDrawable(getContext(), R.drawable.bg_bottom_sheet_dialog_fragment, ThemeStore.Companion.primaryColor(getContext())));
|
||||
}
|
||||
});
|
||||
if (getActivity() != null) {
|
||||
if (VersionUtils.hasNougat()) {
|
||||
((AbsBaseActivity) getActivity()).setNavigationbarColor(ThemeStore.primaryColor(getContext()));
|
||||
if (VersionUtils.INSTANCE.hasNougat()) {
|
||||
((AbsBaseActivity) getActivity()).setNavigationbarColor(ThemeStore.Companion.primaryColor(getContext()));
|
||||
} else {
|
||||
((AbsBaseActivity) getActivity()).setNavigationbarColorAuto();
|
||||
}
|
||||
|
@ -67,7 +67,7 @@ public class RoundedBottomSheetDialogFragment extends AppCompatDialogFragment {
|
|||
if (getDialog() != null && getDialog().getWindow() != null) {
|
||||
Window window = getDialog().getWindow();
|
||||
window.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
|
||||
window.setNavigationBarColor(ThemeStore.primaryColor(getContext()));
|
||||
window.setNavigationBarColor(ThemeStore.Companion.primaryColor(getContext()));
|
||||
window.findViewById(com.google.android.material.R.id.container).setFitsSystemWindows(true);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue