Removed use of theme engine for colorPrimary

This commit is contained in:
h4h13 2019-10-09 19:16:25 +05:30
parent 8d8149839a
commit 3f50a118f7
32 changed files with 102 additions and 205 deletions

View file

@ -82,7 +82,7 @@ class AlbumDetailsActivity : AbsSlidingMusicPanelActivity(), AlbumDetailsView {
setLightNavigationBar(true) setLightNavigationBar(true)
setNavigationbarColorAuto() setNavigationbarColorAuto()
contentContainer?.setCardBackgroundColor(ColorStateList.valueOf(ThemeStore.primaryColor(this))) contentContainer?.setCardBackgroundColor(ColorStateList.valueOf(ATHUtil.resolveColor(this, R.attr.colorPrimary)))
postponeEnterTransition() postponeEnterTransition()
@ -124,10 +124,8 @@ class AlbumDetailsActivity : AbsSlidingMusicPanelActivity(), AlbumDetailsView {
private fun setupToolbarMarginHeight() { private fun setupToolbarMarginHeight() {
setSupportActionBar(toolbar) setSupportActionBar(toolbar)
supportActionBar!!.title = null supportActionBar?.title = null
val primaryColor = ATHUtil.resolveColor(this, R.attr.colorPrimary)
val primaryColor = ThemeStore.primaryColor(this)
collapsingToolbarLayout?.let { collapsingToolbarLayout?.let {
it.setContentScrimColor(primaryColor) it.setContentScrimColor(primaryColor)
it.setStatusBarScrimColor(ColorUtil.darkenColor(primaryColor)) it.setStatusBarScrimColor(ColorUtil.darkenColor(primaryColor))
@ -147,8 +145,8 @@ class AlbumDetailsActivity : AbsSlidingMusicPanelActivity(), AlbumDetailsView {
override fun onStateChanged(appBarLayout: AppBarLayout, state: State) { override fun onStateChanged(appBarLayout: AppBarLayout, state: State) {
val color: Int = when (state) { val color: Int = when (state) {
State.COLLAPSED -> { State.COLLAPSED -> {
setLightStatusbar(ColorUtil.isColorLight(ThemeStore.primaryColor(this@AlbumDetailsActivity))) setLightStatusbar(ColorUtil.isColorLight(primaryColor))
ThemeStore.primaryColor(this@AlbumDetailsActivity) primaryColor
} }
State.EXPANDED, State.IDLE -> { State.EXPANDED, State.IDLE -> {
setLightStatusbar(false) setLightStatusbar(false)

View file

@ -72,7 +72,7 @@ class ArtistDetailActivity : AbsSlidingMusicPanelActivity(), ArtistDetailsView {
setDrawUnderStatusBar() setDrawUnderStatusBar()
setupWindowTransitions() setupWindowTransitions()
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
contentContainer?.setCardBackgroundColor(ColorStateList.valueOf(ThemeStore.primaryColor(this))) contentContainer?.setCardBackgroundColor(ColorStateList.valueOf(ATHUtil.resolveColor(this, R.attr.colorPrimary)))
toggleBottomNavigationView(true) toggleBottomNavigationView(true)
setNavigationbarColorAuto() setNavigationbarColorAuto()
setLightNavigationBar(true) setLightNavigationBar(true)
@ -128,8 +128,7 @@ class ArtistDetailActivity : AbsSlidingMusicPanelActivity(), ArtistDetailsView {
} }
private fun setupToolbarMarginHeight() { private fun setupToolbarMarginHeight() {
val primaryColor = ThemeStore.primaryColor(this) val primaryColor = ATHUtil.resolveColor(this, R.attr.colorPrimary)
collapsingToolbarLayout?.let { collapsingToolbarLayout?.let {
it.setContentScrimColor(primaryColor) it.setContentScrimColor(primaryColor)
it.setStatusBarScrimColor(ColorUtil.darkenColor(primaryColor)) it.setStatusBarScrimColor(ColorUtil.darkenColor(primaryColor))
@ -150,8 +149,8 @@ class ArtistDetailActivity : AbsSlidingMusicPanelActivity(), ArtistDetailsView {
override fun onStateChanged(appBarLayout: AppBarLayout, state: State) { override fun onStateChanged(appBarLayout: AppBarLayout, state: State) {
val color: Int = when (state) { val color: Int = when (state) {
State.COLLAPSED -> { State.COLLAPSED -> {
setLightStatusbar(ColorUtil.isColorLight(ThemeStore.primaryColor(appBarLayout.context))) setLightStatusbar(ColorUtil.isColorLight(primaryColor))
ThemeStore.primaryColor(appBarLayout.context) primaryColor
} }
State.EXPANDED, State.IDLE -> { State.EXPANDED, State.IDLE -> {
setLightStatusbar(false) setLightStatusbar(false)

View file

@ -9,6 +9,7 @@ import androidx.recyclerview.widget.DefaultItemAnimator
import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
import code.name.monkey.appthemehelper.ThemeStore import code.name.monkey.appthemehelper.ThemeStore
import code.name.monkey.appthemehelper.util.ATHUtil
import code.name.monkey.appthemehelper.util.ColorUtil import code.name.monkey.appthemehelper.util.ColorUtil
import code.name.monkey.retromusic.App import code.name.monkey.retromusic.App
import code.name.monkey.retromusic.R import code.name.monkey.retromusic.R
@ -53,7 +54,7 @@ class GenreDetailsActivity : AbsSlidingMusicPanelActivity(), CabHolder, GenreDet
setNavigationbarColorAuto() setNavigationbarColorAuto()
setTaskDescriptionColorAuto() setTaskDescriptionColorAuto()
setLightNavigationBar(true) setLightNavigationBar(true)
setLightStatusbar(ColorUtil.isColorLight(ThemeStore.primaryColor(this))) setLightStatusbar(ColorUtil.isColorLight(ATHUtil.resolveColor(this, R.attr.colorPrimary)))
toggleBottomNavigationView(true) toggleBottomNavigationView(true)
if (intent.extras != null) { if (intent.extras != null) {
@ -65,13 +66,13 @@ class GenreDetailsActivity : AbsSlidingMusicPanelActivity(), CabHolder, GenreDet
setUpToolBar() setUpToolBar()
setupRecyclerView() setupRecyclerView()
App.musicComponent?.inject(this) App.musicComponent.inject(this)
genreDetailsPresenter.attachView(this) genreDetailsPresenter.attachView(this)
} }
private fun setUpToolBar() { private fun setUpToolBar() {
val primaryColor = ThemeStore.primaryColor(this) val primaryColor = ATHUtil.resolveColor(this, R.attr.colorPrimary)
appBarLayout.setBackgroundColor(primaryColor) appBarLayout.setBackgroundColor(primaryColor)
applyToolbar(toolbar) applyToolbar(toolbar)
title = genre.name title = genre.name
@ -132,7 +133,7 @@ class GenreDetailsActivity : AbsSlidingMusicPanelActivity(), CabHolder, GenreDet
cab = MaterialCab(this, R.id.cab_stub) cab = MaterialCab(this, R.id.cab_stub)
.setMenu(menuRes) .setMenu(menuRes)
.setCloseDrawableRes(R.drawable.ic_close_white_24dp) .setCloseDrawableRes(R.drawable.ic_close_white_24dp)
.setBackgroundColor(RetroColorUtil.shiftBackgroundColorForLightText(ThemeStore.primaryColor(this))) .setBackgroundColor(RetroColorUtil.shiftBackgroundColorForLightText(ATHUtil.resolveColor(this, R.attr.colorPrimary)))
.start(callback) .start(callback)
return cab!! return cab!!
} }

View file

@ -7,11 +7,10 @@ import android.os.Bundle
import android.view.View import android.view.View
import android.view.WindowManager import android.view.WindowManager
import androidx.core.view.ViewCompat import androidx.core.view.ViewCompat
import code.name.monkey.appthemehelper.ThemeStore import code.name.monkey.appthemehelper.util.ATHUtil
import code.name.monkey.retromusic.R import code.name.monkey.retromusic.R
import code.name.monkey.retromusic.activities.base.AbsMusicServiceActivity import code.name.monkey.retromusic.activities.base.AbsMusicServiceActivity
import code.name.monkey.retromusic.fragments.player.lockscreen.LockScreenPlayerControlsFragment import code.name.monkey.retromusic.fragments.player.lockscreen.LockScreenPlayerControlsFragment
import code.name.monkey.retromusic.glide.RetroMusicColoredTarget import code.name.monkey.retromusic.glide.RetroMusicColoredTarget
import code.name.monkey.retromusic.glide.SongGlideRequest import code.name.monkey.retromusic.glide.SongGlideRequest
import code.name.monkey.retromusic.helper.MusicPlayerRemote import code.name.monkey.retromusic.helper.MusicPlayerRemote
@ -84,7 +83,7 @@ class LockScreenActivity : AbsMusicServiceActivity() {
.start() .start()
} }
findViewById<View>(R.id.root_layout).setBackgroundColor(ThemeStore.primaryColor(this)) findViewById<View>(R.id.root_layout).setBackgroundColor(ATHUtil.resolveColor(this, R.attr.colorPrimary))
} }
override fun onPlayingMetaChanged() { override fun onPlayingMetaChanged() {

View file

@ -15,10 +15,7 @@ import androidx.fragment.app.FragmentManager
import androidx.fragment.app.FragmentStatePagerAdapter import androidx.fragment.app.FragmentStatePagerAdapter
import androidx.viewpager.widget.ViewPager import androidx.viewpager.widget.ViewPager
import code.name.monkey.appthemehelper.ThemeStore import code.name.monkey.appthemehelper.ThemeStore
import code.name.monkey.appthemehelper.util.ColorUtil import code.name.monkey.appthemehelper.util.*
import code.name.monkey.appthemehelper.util.MaterialUtil
import code.name.monkey.appthemehelper.util.MaterialValueHelper
import code.name.monkey.appthemehelper.util.TintHelper
import code.name.monkey.retromusic.App import code.name.monkey.retromusic.App
import code.name.monkey.retromusic.R import code.name.monkey.retromusic.R
import code.name.monkey.retromusic.activities.base.AbsMusicServiceActivity import code.name.monkey.retromusic.activities.base.AbsMusicServiceActivity
@ -94,9 +91,10 @@ class LyricsActivity : AbsMusicServiceActivity(), View.OnClickListener, ViewPage
setTaskDescriptionColorAuto() setTaskDescriptionColorAuto()
setNavigationBarColorPrimary() setNavigationBarColorPrimary()
appBarLayout.setBackgroundColor(ThemeStore.primaryColor(this)) val primaryColor = ATHUtil.resolveColor(this, R.attr.colorPrimary)
appBarLayout.setBackgroundColor(primaryColor)
toolbar.apply { toolbar.apply {
setBackgroundColor(ThemeStore.primaryColor(this@LyricsActivity)) setBackgroundColor(primaryColor)
navigationIcon = TintHelper.createTintedDrawable(ContextCompat.getDrawable(this@LyricsActivity, R.drawable.ic_keyboard_backspace_black_24dp), ThemeStore.textColorSecondary(this@LyricsActivity)) navigationIcon = TintHelper.createTintedDrawable(ContextCompat.getDrawable(this@LyricsActivity, R.drawable.ic_keyboard_backspace_black_24dp), ThemeStore.textColorSecondary(this@LyricsActivity))
setSupportActionBar(toolbar) setSupportActionBar(toolbar)
} }

View file

@ -6,6 +6,7 @@ import android.view.MenuItem
import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
import code.name.monkey.appthemehelper.ThemeStore import code.name.monkey.appthemehelper.ThemeStore
import code.name.monkey.appthemehelper.util.ATHUtil
import code.name.monkey.appthemehelper.util.ColorUtil import code.name.monkey.appthemehelper.util.ColorUtil
import code.name.monkey.appthemehelper.util.MaterialValueHelper import code.name.monkey.appthemehelper.util.MaterialValueHelper
import code.name.monkey.retromusic.R import code.name.monkey.retromusic.R
@ -164,7 +165,7 @@ class PlayingQueueActivity : AbsMusicServiceActivity() {
playerQueueSubHeader.setTextColor(ThemeStore.accentColor(this)) playerQueueSubHeader.setTextColor(ThemeStore.accentColor(this))
applyToolbar(toolbar) applyToolbar(toolbar)
appBarLayout.setBackgroundColor(ThemeStore.primaryColor(this)) appBarLayout.setBackgroundColor(ATHUtil.resolveColor(this, R.attr.colorPrimary))
clearQueue.backgroundTintList = ColorStateList.valueOf(ThemeStore.accentColor(this)) clearQueue.backgroundTintList = ColorStateList.valueOf(ThemeStore.accentColor(this))
ColorStateList.valueOf(MaterialValueHelper.getPrimaryTextColor(this, ColorUtil.isColorLight(ThemeStore.accentColor(this)))).apply { ColorStateList.valueOf(MaterialValueHelper.getPrimaryTextColor(this, ColorUtil.isColorLight(ThemeStore.accentColor(this)))).apply {

View file

@ -8,6 +8,7 @@ import android.view.View
import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
import code.name.monkey.appthemehelper.ThemeStore import code.name.monkey.appthemehelper.ThemeStore
import code.name.monkey.appthemehelper.util.ATHUtil
import code.name.monkey.appthemehelper.util.ColorUtil import code.name.monkey.appthemehelper.util.ColorUtil
import code.name.monkey.retromusic.App import code.name.monkey.retromusic.App
import code.name.monkey.retromusic.R import code.name.monkey.retromusic.R
@ -54,7 +55,7 @@ class PlaylistDetailActivity : AbsSlidingMusicPanelActivity(), CabHolder, Playli
setNavigationbarColorAuto() setNavigationbarColorAuto()
setTaskDescriptionColorAuto() setTaskDescriptionColorAuto()
setLightNavigationBar(true) setLightNavigationBar(true)
setLightStatusbar(ColorUtil.isColorLight(ThemeStore.primaryColor(this))) setLightStatusbar(ColorUtil.isColorLight(ATHUtil.resolveColor(this, R.attr.colorPrimary)))
toggleBottomNavigationView(true) toggleBottomNavigationView(true)
@ -143,7 +144,7 @@ class PlaylistDetailActivity : AbsSlidingMusicPanelActivity(), CabHolder, Playli
.setMenu(menuRes) .setMenu(menuRes)
.setCloseDrawableRes(R.drawable.ic_close_white_24dp) .setCloseDrawableRes(R.drawable.ic_close_white_24dp)
.setBackgroundColor( .setBackgroundColor(
RetroColorUtil.shiftBackgroundColorForLightText(ThemeStore.primaryColor(this))) RetroColorUtil.shiftBackgroundColorForLightText(ATHUtil.resolveColor(this, R.attr.colorPrimary)))
.start(callback) .start(callback)
return cab!! return cab!!
} }

View file

@ -6,7 +6,7 @@ import android.os.Bundle
import android.util.Log import android.util.Log
import android.view.MenuItem import android.view.MenuItem
import android.widget.Toast import android.widget.Toast
import code.name.monkey.appthemehelper.ThemeStore import code.name.monkey.appthemehelper.util.ATHUtil
import code.name.monkey.appthemehelper.util.MaterialUtil import code.name.monkey.appthemehelper.util.MaterialUtil
import code.name.monkey.retromusic.App import code.name.monkey.retromusic.App
import code.name.monkey.retromusic.BuildConfig import code.name.monkey.retromusic.BuildConfig
@ -35,7 +35,7 @@ class PurchaseActivity : AbsBaseActivity(), BillingProcessor.IBillingHandler {
setTaskDescriptionColorAuto() setTaskDescriptionColorAuto()
setLightNavigationBar(true) setLightNavigationBar(true)
val primaryColor = ThemeStore.primaryColor(this) val primaryColor = ATHUtil.resolveColor(this, R.attr.colorPrimary)
toolbar.setBackgroundColor(primaryColor) toolbar.setBackgroundColor(primaryColor)
appBarLayout.setBackgroundColor(primaryColor) appBarLayout.setBackgroundColor(primaryColor)

View file

@ -19,6 +19,7 @@ import androidx.appcompat.widget.SearchView.OnQueryTextListener
import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
import code.name.monkey.appthemehelper.ThemeStore import code.name.monkey.appthemehelper.ThemeStore
import code.name.monkey.appthemehelper.util.ATHUtil
import code.name.monkey.appthemehelper.util.ColorUtil import code.name.monkey.appthemehelper.util.ColorUtil
import code.name.monkey.appthemehelper.util.MaterialValueHelper import code.name.monkey.appthemehelper.util.MaterialValueHelper
import code.name.monkey.retromusic.App import code.name.monkey.retromusic.App
@ -129,7 +130,7 @@ class SearchActivity : AbsMusicServiceActivity(), OnQueryTextListener, TextWatch
private fun setUpToolBar() { private fun setUpToolBar() {
title = null title = null
appBarLayout.setBackgroundColor(ThemeStore.primaryColor(this)) appBarLayout.setBackgroundColor(ATHUtil.resolveColor(this, R.attr.colorPrimary))
} }

View file

@ -5,7 +5,7 @@ import android.view.MenuItem
import androidx.annotation.StringRes import androidx.annotation.StringRes
import androidx.fragment.app.Fragment import androidx.fragment.app.Fragment
import androidx.transition.TransitionManager import androidx.transition.TransitionManager
import code.name.monkey.appthemehelper.ThemeStore import code.name.monkey.appthemehelper.util.ATHUtil
import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper
import code.name.monkey.retromusic.R import code.name.monkey.retromusic.R
import code.name.monkey.retromusic.activities.base.AbsBaseActivity import code.name.monkey.retromusic.activities.base.AbsBaseActivity
@ -36,12 +36,12 @@ class SettingsActivity : AbsBaseActivity() {
setSupportActionBar(toolbar) setSupportActionBar(toolbar)
setTitle(R.string.action_settings) setTitle(R.string.action_settings)
toolbar.apply { toolbar.apply {
setTitleTextColor(ThemeStore.textColorPrimary(context)) setTitleTextColor(ATHUtil.resolveColor(this@SettingsActivity, R.attr.colorOnPrimary))
setBackgroundColor(ThemeStore.primaryColor(context)) setBackgroundColor(ATHUtil.resolveColor(this@SettingsActivity, R.attr.colorPrimary))
setNavigationOnClickListener { onBackPressed() } setNavigationOnClickListener { onBackPressed() }
ToolbarContentTintHelper.colorBackButton(toolbar, ThemeStore.textColorSecondary(context)) ToolbarContentTintHelper.colorBackButton(toolbar, ATHUtil.resolveColor(this@SettingsActivity, R.attr.colorOnSecondary))
} }
appBarLayout.setBackgroundColor(ThemeStore.primaryColor(this)) appBarLayout.setBackgroundColor(ATHUtil.resolveColor(this@SettingsActivity, R.attr.colorPrimary))
} }

View file

@ -71,7 +71,7 @@ class SupportDevelopmentActivity : AbsBaseActivity(), BillingProcessor.IBillingH
} }
private fun setupToolbar() { private fun setupToolbar() {
val primaryColor = ThemeStore.primaryColor(this) val primaryColor = ATHUtil.resolveColor(this, R.attr.colorPrimary)
appBarLayout.setBackgroundColor(primaryColor) appBarLayout.setBackgroundColor(primaryColor)
applyToolbar(toolbar) applyToolbar(toolbar)
} }

View file

@ -16,6 +16,7 @@ import android.text.TextUtils
import android.view.MenuItem import android.view.MenuItem
import android.widget.Toast import android.widget.Toast
import code.name.monkey.appthemehelper.ThemeStore import code.name.monkey.appthemehelper.ThemeStore
import code.name.monkey.appthemehelper.util.ATHUtil
import code.name.monkey.appthemehelper.util.ColorUtil import code.name.monkey.appthemehelper.util.ColorUtil
import code.name.monkey.appthemehelper.util.MaterialUtil import code.name.monkey.appthemehelper.util.MaterialUtil
import code.name.monkey.appthemehelper.util.MaterialValueHelper import code.name.monkey.appthemehelper.util.MaterialValueHelper
@ -109,7 +110,7 @@ class UserInfoActivity : AbsBaseActivity() {
} }
private fun setupToolbar() { private fun setupToolbar() {
val primaryColor = ThemeStore.primaryColor(this) val primaryColor = ATHUtil.resolveColor(this, R.attr.colorPrimary)
applyToolbar(toolbar) applyToolbar(toolbar)
appBarLayout.setBackgroundColor(primaryColor) appBarLayout.setBackgroundColor(primaryColor)
} }

View file

@ -19,6 +19,7 @@ import java.io.InputStreamReader;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import code.name.monkey.appthemehelper.ThemeStore; import code.name.monkey.appthemehelper.ThemeStore;
import code.name.monkey.appthemehelper.util.ATHUtil;
import code.name.monkey.appthemehelper.util.ColorUtil; import code.name.monkey.appthemehelper.util.ColorUtil;
import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper; import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper;
import code.name.monkey.retromusic.R; import code.name.monkey.retromusic.R;
@ -60,12 +61,13 @@ public class WhatsNewActivity extends AbsBaseActivity {
toolbar = findViewById(R.id.toolbar); toolbar = findViewById(R.id.toolbar);
appBarLayout = findViewById(R.id.appBarLayout); appBarLayout = findViewById(R.id.appBarLayout);
toolbar.setBackgroundColor(ThemeStore.Companion.primaryColor(this)); int primaryColor = INSTANCE.resolveColor(this, R.attr.colorPrimary);
appBarLayout.setBackgroundColor(ThemeStore.Companion.primaryColor(this)); toolbar.setBackgroundColor(primaryColor);
appBarLayout.setBackgroundColor(primaryColor);
//setSupportActionBar(toolbar); //setSupportActionBar(toolbar);
toolbar.setNavigationOnClickListener(v -> onBackPressed()); toolbar.setNavigationOnClickListener(v -> onBackPressed());
ToolbarContentTintHelper.colorBackButton(toolbar, ThemeStore.Companion.textColorSecondary(this)); ToolbarContentTintHelper.colorBackButton(toolbar, ATHUtil.INSTANCE.resolveColor(this, R.attr.colorOnSecondary));
try { try {
StringBuilder buf = new StringBuilder(); StringBuilder buf = new StringBuilder();

View file

@ -8,7 +8,7 @@ import android.view.ViewGroup
import android.view.ViewTreeObserver import android.view.ViewTreeObserver
import androidx.annotation.LayoutRes import androidx.annotation.LayoutRes
import androidx.fragment.app.Fragment import androidx.fragment.app.Fragment
import code.name.monkey.appthemehelper.ThemeStore import code.name.monkey.appthemehelper.util.ATHUtil
import code.name.monkey.appthemehelper.util.ColorUtil import code.name.monkey.appthemehelper.util.ColorUtil
import code.name.monkey.retromusic.R import code.name.monkey.retromusic.R
import code.name.monkey.retromusic.fragments.MiniPlayerFragment import code.name.monkey.retromusic.fragments.MiniPlayerFragment
@ -310,7 +310,7 @@ abstract class AbsSlidingMusicPanelActivity : AbsMusicServiceActivity(), AbsPlay
super.setLightNavigationBar(isColorLight) super.setLightNavigationBar(isColorLight)
super.setLightStatusbar(isColorLight) super.setLightStatusbar(isColorLight)
} else { } else {
super.setLightStatusbar(ColorUtil.isColorLight(ThemeStore.primaryColor(this))) super.setLightStatusbar(ColorUtil.isColorLight(ATHUtil.resolveColor(this, R.attr.colorPrimary)))
super.setLightNavigationBar(true) super.setLightNavigationBar(true)
} }
} }

View file

@ -73,7 +73,7 @@ abstract class AbsThemeActivity : ATHActivity(), Runnable {
ContextCompat.getDrawable(this, R.drawable.round_window) ContextCompat.getDrawable(this, R.drawable.round_window)
else else
ContextCompat.getDrawable(this, R.drawable.square_window) ContextCompat.getDrawable(this, R.drawable.square_window)
background = TintHelper.createTintedDrawable(background, ThemeStore.primaryColor(this)) background = TintHelper.createTintedDrawable(background, ATHUtil.resolveColor(this, R.attr.colorPrimary))
window.setBackgroundDrawable(background) window.setBackgroundDrawable(background)
} }

View file

@ -16,6 +16,7 @@ import androidx.annotation.StringDef
import androidx.annotation.StringRes import androidx.annotation.StringRes
import androidx.appcompat.app.AlertDialog import androidx.appcompat.app.AlertDialog
import code.name.monkey.appthemehelper.ThemeStore import code.name.monkey.appthemehelper.ThemeStore
import code.name.monkey.appthemehelper.util.ATHUtil
import code.name.monkey.appthemehelper.util.MaterialUtil import code.name.monkey.appthemehelper.util.MaterialUtil
import code.name.monkey.appthemehelper.util.TintHelper import code.name.monkey.appthemehelper.util.TintHelper
import code.name.monkey.retromusic.R import code.name.monkey.retromusic.R
@ -74,7 +75,7 @@ open class BugReportActivity : AbsThemeActivity() {
private fun initViews() { private fun initViews() {
val accentColor = ThemeStore.accentColor(this) val accentColor = ThemeStore.accentColor(this)
val primaryColor = ThemeStore.primaryColor(this) val primaryColor = ATHUtil.resolveColor(this, R.attr.colorPrimary)
toolbar!!.setBackgroundColor(primaryColor) toolbar!!.setBackgroundColor(primaryColor)
setSupportActionBar(toolbar) setSupportActionBar(toolbar)

View file

@ -14,6 +14,7 @@ import android.view.MenuItem
import android.view.View import android.view.View
import android.view.animation.OvershootInterpolator import android.view.animation.OvershootInterpolator
import code.name.monkey.appthemehelper.ThemeStore import code.name.monkey.appthemehelper.ThemeStore
import code.name.monkey.appthemehelper.util.ATHUtil
import code.name.monkey.appthemehelper.util.ColorUtil import code.name.monkey.appthemehelper.util.ColorUtil
import code.name.monkey.appthemehelper.util.MaterialValueHelper import code.name.monkey.appthemehelper.util.MaterialValueHelper
import code.name.monkey.appthemehelper.util.TintHelper import code.name.monkey.appthemehelper.util.TintHelper
@ -25,7 +26,6 @@ import code.name.monkey.retromusic.util.SAFUtil
import com.afollestad.materialdialogs.MaterialDialog import com.afollestad.materialdialogs.MaterialDialog
import com.afollestad.materialdialogs.list.listItems import com.afollestad.materialdialogs.list.listItems
import com.google.android.material.button.MaterialButton import com.google.android.material.button.MaterialButton
import com.google.android.material.floatingactionbutton.FloatingActionButton
import kotlinx.android.synthetic.main.activity_album_tag_editor.* import kotlinx.android.synthetic.main.activity_album_tag_editor.*
import org.jaudiotagger.audio.AudioFile import org.jaudiotagger.audio.AudioFile
import org.jaudiotagger.audio.AudioFileIO import org.jaudiotagger.audio.AudioFileIO
@ -289,7 +289,7 @@ abstract class AbsTagEditorActivity : AbsBaseActivity() {
editorImage.visibility = View.GONE editorImage.visibility = View.GONE
editorImage.isEnabled = false editorImage.isEnabled = false
setColors(intent.getIntExtra(EXTRA_PALETTE, ThemeStore.primaryColor(this))) setColors(intent.getIntExtra(EXTRA_PALETTE, ATHUtil.resolveColor(this, R.attr.colorPrimary)))
} }
protected fun dataChanged() { protected fun dataChanged() {

View file

@ -12,8 +12,6 @@ import android.text.Editable
import android.text.TextUtils import android.text.TextUtils
import android.text.TextWatcher import android.text.TextWatcher
import android.widget.Toast import android.widget.Toast
import androidx.core.content.ContextCompat
import code.name.monkey.appthemehelper.ThemeStore
import code.name.monkey.appthemehelper.util.ATHUtil import code.name.monkey.appthemehelper.util.ATHUtil
import code.name.monkey.appthemehelper.util.MaterialUtil import code.name.monkey.appthemehelper.util.MaterialUtil
import code.name.monkey.appthemehelper.util.TintHelper import code.name.monkey.appthemehelper.util.TintHelper
@ -106,7 +104,7 @@ class AlbumTagEditorActivity : AbsTagEditorActivity(), TextWatcher {
ToolbarContentTintHelper.setToolbarContentColorBasedOnToolbarColor(this, toolbar, Color.TRANSPARENT) ToolbarContentTintHelper.setToolbarContentColorBasedOnToolbarColor(this, toolbar, Color.TRANSPARENT)
title = null title = null
setSupportActionBar(toolbar) setSupportActionBar(toolbar)
TintHelper.setTintAuto(content, ThemeStore.primaryColor(this), true) TintHelper.setTintAuto(content, ATHUtil.resolveColor(this, R.attr.colorPrimary), true)
} }
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {

View file

@ -6,6 +6,7 @@ import android.text.Editable
import android.text.TextWatcher import android.text.TextWatcher
import androidx.core.content.ContextCompat import androidx.core.content.ContextCompat
import code.name.monkey.appthemehelper.ThemeStore import code.name.monkey.appthemehelper.ThemeStore
import code.name.monkey.appthemehelper.util.ATHUtil
import code.name.monkey.appthemehelper.util.MaterialUtil import code.name.monkey.appthemehelper.util.MaterialUtil
import code.name.monkey.appthemehelper.util.TintHelper import code.name.monkey.appthemehelper.util.TintHelper
import code.name.monkey.retromusic.R import code.name.monkey.retromusic.R
@ -22,9 +23,9 @@ class SongTagEditorActivity : AbsTagEditorActivity(), TextWatcher {
get() = R.layout.activity_song_tag_editor get() = R.layout.activity_song_tag_editor
private fun setupToolbar() { private fun setupToolbar() {
appBarLayout.setBackgroundColor(ThemeStore.primaryColor(this)) appBarLayout.setBackgroundColor(ATHUtil.resolveColor(this, R.attr.colorPrimary))
toolbar.apply { toolbar.apply {
setBackgroundColor(ThemeStore.primaryColor(context)) setBackgroundColor(ATHUtil.resolveColor(this@SongTagEditorActivity, R.attr.colorPrimary))
navigationIcon = TintHelper.createTintedDrawable(ContextCompat.getDrawable(context, R.drawable.ic_keyboard_backspace_black_24dp), ThemeStore.textColorPrimary(context)) navigationIcon = TintHelper.createTintedDrawable(ContextCompat.getDrawable(context, R.drawable.ic_keyboard_backspace_black_24dp), ThemeStore.textColorPrimary(context))
setNavigationOnClickListener { onBackPressed() } setNavigationOnClickListener { onBackPressed() }
setSupportActionBar(toolbar) setSupportActionBar(toolbar)

View file

@ -6,8 +6,8 @@ import android.view.MenuItem
import android.view.View import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
import androidx.appcompat.app.AppCompatActivity import androidx.appcompat.app.AppCompatActivity
import code.name.monkey.appthemehelper.ThemeStore
import code.name.monkey.appthemehelper.util.ATHUtil import code.name.monkey.appthemehelper.util.ATHUtil
import code.name.monkey.retromusic.R
import code.name.monkey.retromusic.adapter.base.AbsMultiSelectAdapter import code.name.monkey.retromusic.adapter.base.AbsMultiSelectAdapter
import code.name.monkey.retromusic.adapter.base.MediaEntryViewHolder import code.name.monkey.retromusic.adapter.base.MediaEntryViewHolder
import code.name.monkey.retromusic.glide.audiocover.AudioFileCover import code.name.monkey.retromusic.glide.audiocover.AudioFileCover
@ -30,7 +30,7 @@ class SongFileAdapter(
private val itemLayoutRes: Int, private val itemLayoutRes: Int,
private val callbacks: Callbacks?, private val callbacks: Callbacks?,
cabHolder: CabHolder? cabHolder: CabHolder?
) : AbsMultiSelectAdapter<SongFileAdapter.ViewHolder, File>(activity, cabHolder, code.name.monkey.retromusic.R.menu.menu_media_selection), FastScrollRecyclerView.SectionedAdapter { ) : AbsMultiSelectAdapter<SongFileAdapter.ViewHolder, File>(activity, cabHolder, R.menu.menu_media_selection), FastScrollRecyclerView.SectionedAdapter {
init { init {
this.setHasStableIds(true) this.setHasStableIds(true)
@ -83,16 +83,16 @@ class SongFileAdapter(
} }
private fun loadFileImage(file: File, holder: ViewHolder) { private fun loadFileImage(file: File, holder: ViewHolder) {
val iconColor = ATHUtil.resolveColor(activity, code.name.monkey.retromusic.R.attr.iconColor) val iconColor = ATHUtil.resolveColor(activity, R.attr.iconColor)
if (file.isDirectory) { if (file.isDirectory) {
holder.image?.let { holder.image?.let {
it.setColorFilter(iconColor, PorterDuff.Mode.SRC_IN) it.setColorFilter(iconColor, PorterDuff.Mode.SRC_IN)
it.setImageResource(code.name.monkey.retromusic.R.drawable.ic_folder_white_24dp) it.setImageResource(R.drawable.ic_folder_white_24dp)
} }
holder.imageTextContainer?.setCardBackgroundColor(ThemeStore.primaryColor(activity)) holder.imageTextContainer?.setCardBackgroundColor(ATHUtil.resolveColor(activity, R.attr.colorPrimary))
} else { } else {
val error = RetroUtil.getTintedVectorDrawable(activity, code.name.monkey.retromusic.R.drawable.ic_file_music_white_24dp, iconColor) val error = RetroUtil.getTintedVectorDrawable(activity, R.drawable.ic_file_music_white_24dp, iconColor)
Glide.with(activity) Glide.with(activity)
.load(AudioFileCover(file.path)) .load(AudioFileCover(file.path))
.diskCacheStrategy(DiskCacheStrategy.NONE) .diskCacheStrategy(DiskCacheStrategy.NONE)

View file

@ -27,7 +27,7 @@ import androidx.recyclerview.widget.RecyclerView;
import com.google.android.material.card.MaterialCardView; import com.google.android.material.card.MaterialCardView;
import code.name.monkey.appthemehelper.ThemeStore; import code.name.monkey.appthemehelper.util.ATHUtil;
import code.name.monkey.retromusic.R; import code.name.monkey.retromusic.R;
public class MediaEntryViewHolder extends RecyclerView.ViewHolder implements View.OnLongClickListener, View.OnClickListener { public class MediaEntryViewHolder extends RecyclerView.ViewHolder implements View.OnLongClickListener, View.OnClickListener {
@ -94,7 +94,7 @@ public class MediaEntryViewHolder extends RecyclerView.ViewHolder implements Vie
playSongs = itemView.findViewById(R.id.playSongs); playSongs = itemView.findViewById(R.id.playSongs);
if (imageContainerCard != null) { if (imageContainerCard != null) {
imageContainerCard.setCardBackgroundColor(ThemeStore.Companion.primaryColor(itemView.getContext())); imageContainerCard.setCardBackgroundColor(ATHUtil.INSTANCE.resolveColor(itemView.getContext(), R.attr.colorPrimary));
} }
itemView.setOnClickListener(this); itemView.setOnClickListener(this);
itemView.setOnLongClickListener(this); itemView.setOnLongClickListener(this);

View file

@ -195,7 +195,7 @@ class PlaylistAdapter(protected val activity: AppCompatActivity, dataSet: ArrayL
imageTextContainer?.apply { imageTextContainer?.apply {
cardElevation = 0f cardElevation = 0f
setCardBackgroundColor(ThemeStore.primaryColor(itemView.context)) setCardBackgroundColor(ATHUtil.resolveColor(activity, R.attr.colorPrimary))
} }
} }

View file

@ -17,6 +17,7 @@ package code.name.monkey.retromusic.extensions
import androidx.appcompat.app.AppCompatActivity import androidx.appcompat.app.AppCompatActivity
import androidx.appcompat.widget.Toolbar import androidx.appcompat.widget.Toolbar
import code.name.monkey.appthemehelper.ThemeStore import code.name.monkey.appthemehelper.ThemeStore
import code.name.monkey.appthemehelper.util.ATHUtil
import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper
import code.name.monkey.retromusic.R import code.name.monkey.retromusic.R
@ -25,7 +26,7 @@ fun AppCompatActivity.applyToolbar(toolbar: Toolbar) {
setNavigationOnClickListener { onBackPressed() } setNavigationOnClickListener { onBackPressed() }
setNavigationIcon(R.drawable.ic_keyboard_backspace_black_24dp) setNavigationIcon(R.drawable.ic_keyboard_backspace_black_24dp)
ToolbarContentTintHelper.colorBackButton(toolbar, ThemeStore.textColorSecondary(this@applyToolbar)) ToolbarContentTintHelper.colorBackButton(toolbar, ThemeStore.textColorSecondary(this@applyToolbar))
setBackgroundColor(ThemeStore.primaryColor(this@applyToolbar)) setBackgroundColor(ATHUtil.resolveColor(this@applyToolbar, R.attr.colorPrimary))
} }
setSupportActionBar(toolbar) setSupportActionBar(toolbar)
} }

View file

@ -3,7 +3,7 @@ package code.name.monkey.retromusic.fragments.base
import android.os.Build import android.os.Build
import android.os.Bundle import android.os.Bundle
import android.view.View import android.view.View
import code.name.monkey.appthemehelper.ThemeStore import code.name.monkey.appthemehelper.util.ATHUtil
import code.name.monkey.appthemehelper.util.ColorUtil import code.name.monkey.appthemehelper.util.ColorUtil
import code.name.monkey.appthemehelper.util.VersionUtils import code.name.monkey.appthemehelper.util.VersionUtils
import code.name.monkey.retromusic.R import code.name.monkey.retromusic.R
@ -39,11 +39,12 @@ abstract class AbsMainActivityFragment : AbsMusicServiceFragment() {
} }
fun setStatusbarColorAuto(view: View) { fun setStatusbarColorAuto(view: View) {
val colorPrimary = ATHUtil.resolveColor(requireContext(), R.attr.colorPrimary)
// we don't want to use statusbar color because we are doing the color darkening on our own to support KitKat // we don't want to use statusbar color because we are doing the color darkening on our own to support KitKat
if (VersionUtils.hasMarshmallow()) { if (VersionUtils.hasMarshmallow()) {
setStatusbarColor(view, ThemeStore.primaryColor(context!!)) setStatusbarColor(view, colorPrimary)
} else { } else {
setStatusbarColor(view, ColorUtil.darkenColor(ThemeStore.primaryColor(context!!))) setStatusbarColor(view, ColorUtil.darkenColor(colorPrimary))
} }
} }

View file

@ -26,9 +26,6 @@ import com.google.android.material.card.MaterialCardView;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import java.util.Objects;
import code.name.monkey.appthemehelper.ThemeStore;
import code.name.monkey.appthemehelper.common.ATHToolbarActivity; import code.name.monkey.appthemehelper.common.ATHToolbarActivity;
import code.name.monkey.appthemehelper.util.ATHUtil; import code.name.monkey.appthemehelper.util.ATHUtil;
import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper; import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper;
@ -193,7 +190,7 @@ public class LibraryFragment extends AbsMainActivityFragment implements CabHolde
.setMenu(menuRes) .setMenu(menuRes)
.setCloseDrawableRes(R.drawable.ic_close_white_24dp) .setCloseDrawableRes(R.drawable.ic_close_white_24dp)
.setBackgroundColor( .setBackgroundColor(
RetroColorUtil.shiftBackgroundColorForLightText(ThemeStore.Companion.primaryColor(Objects.requireNonNull(getActivity())))) RetroColorUtil.shiftBackgroundColorForLightText(ATHUtil.INSTANCE.resolveColor(requireContext(), R.attr.colorPrimary)))
.start(callback); .start(callback);
return cab; return cab;
} }

View file

@ -230,7 +230,7 @@ public class FoldersFragment extends AbsMainActivityFragment implements
} }
private void setUpAppbarColor() { private void setUpAppbarColor() {
int primaryColor = ThemeStore.Companion.primaryColor(requireContext()); int primaryColor = ATHUtil.INSTANCE.resolveColor(requireContext(), R.attr.colorPrimary);
getMainActivity().setSupportActionBar(toolbar); getMainActivity().setSupportActionBar(toolbar);
TintHelper.setTintAuto(container, primaryColor, true); TintHelper.setTintAuto(container, primaryColor, true);
appBarLayout.setBackgroundColor(primaryColor); appBarLayout.setBackgroundColor(primaryColor);
@ -309,7 +309,7 @@ public class FoldersFragment extends AbsMainActivityFragment implements
cab = new MaterialCab(getMainActivity(), R.id.cab_stub) cab = new MaterialCab(getMainActivity(), R.id.cab_stub)
.setMenu(menuRes) .setMenu(menuRes)
.setCloseDrawableRes(R.drawable.ic_close_white_24dp) .setCloseDrawableRes(R.drawable.ic_close_white_24dp)
.setBackgroundColor(RetroColorUtil.shiftBackgroundColorForLightText(ThemeStore.Companion.primaryColor(getActivity()))) .setBackgroundColor(RetroColorUtil.shiftBackgroundColorForLightText(ATHUtil.INSTANCE.resolveColor(requireContext(), R.attr.colorPrimary)))
.start(callback); .start(callback);
return cab; return cab;
} }

View file

@ -9,8 +9,8 @@ import android.view.*
import androidx.appcompat.widget.Toolbar import androidx.appcompat.widget.Toolbar
import androidx.core.content.ContextCompat import androidx.core.content.ContextCompat
import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.LinearLayoutManager
import code.name.monkey.appthemehelper.ThemeStore
import code.name.monkey.appthemehelper.common.ATHToolbarActivity import code.name.monkey.appthemehelper.common.ATHToolbarActivity
import code.name.monkey.appthemehelper.util.ATHUtil
import code.name.monkey.appthemehelper.util.ColorUtil import code.name.monkey.appthemehelper.util.ColorUtil
import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper
import code.name.monkey.retromusic.App import code.name.monkey.retromusic.App
@ -127,7 +127,7 @@ class BannerHomeFragment : AbsMainActivityFragment(), MainActivityFragmentCallba
NavigationUtil.goToPlaylistNew(requireActivity(), HistoryPlaylist(requireActivity())) NavigationUtil.goToPlaylistNew(requireActivity(), HistoryPlaylist(requireActivity()))
} }
contentContainer.setBackgroundColor(ThemeStore.primaryColor(requireContext())) contentContainer.setBackgroundColor(ATHUtil.resolveColor(requireContext(), R.attr.colorPrimary))
setupToolbar() setupToolbar()
checkPadding() checkPadding()
@ -136,7 +136,6 @@ class BannerHomeFragment : AbsMainActivityFragment(), MainActivityFragmentCallba
val options = ActivityOptions.makeSceneTransitionAnimation(mainActivity, userImage, getString(R.string.transition_user_image)) val options = ActivityOptions.makeSceneTransitionAnimation(mainActivity, userImage, getString(R.string.transition_user_image))
NavigationUtil.goToUserInfo(requireActivity(), options) NavigationUtil.goToUserInfo(requireActivity(), options)
} }
titleWelcome.setTextColor(ThemeStore.textColorPrimary(requireContext()))
titleWelcome.text = String.format("%s", PreferenceUtil.getInstance(requireContext()).userName) titleWelcome.text = String.format("%s", PreferenceUtil.getInstance(requireContext()).userName)
App.musicComponent.inject(this) App.musicComponent.inject(this)

View file

@ -139,11 +139,10 @@ class AdaptiveFragment : AbsPlayerFragment(), MusicProgressViewUpdateHelper.Cal
} }
private fun setUpPlayerToolbar() { private fun setUpPlayerToolbar() {
ATHUtil.resolveColor(context, R.attr.iconColor) val primaryColor = ATHUtil.resolveColor(requireContext(), R.attr.colorPrimary)
val primaryColor = ThemeStore.primaryColor(context!!)
playerToolbar.apply { playerToolbar.apply {
inflateMenu(R.menu.menu_player) inflateMenu(R.menu.menu_player)
setNavigationOnClickListener { activity!!.onBackPressed() } setNavigationOnClickListener { requireActivity().onBackPressed() }
ToolbarContentTintHelper.colorizeToolbar(this, primaryColor, activity) ToolbarContentTintHelper.colorizeToolbar(this, primaryColor, activity)
setTitleTextColor(primaryColor) setTitleTextColor(primaryColor)
setSubtitleTextColor(ThemeStore.textColorSecondary(context!!)) setSubtitleTextColor(ThemeStore.textColorSecondary(context!!))

View file

@ -144,7 +144,7 @@ class ClassicPlayerFragment : AbsPlayerFragment(), SlidingUpPanelLayout.PanelSli
}) })
// for some reason the xml attribute doesn't get applied here. // for some reason the xml attribute doesn't get applied here.
playingQueueCard.setCardBackgroundColor(ThemeStore.primaryColor(requireContext())) playingQueueCard.setCardBackgroundColor(ATHUtil.resolveColor(requireContext(), R.attr.colorPrimary))
} }
private fun setUpPlayerToolbar() { private fun setUpPlayerToolbar() {
@ -308,7 +308,7 @@ class PortraitImpl(private val fragment: ClassicPlayerFragment) : BaseImpl(fragm
} }
imageTextContainer?.let { imageTextContainer?.let {
it.cardElevation = 0f it.cardElevation = 0f
it.setCardBackgroundColor(ThemeStore.primaryColor(fragment.activity!!)) it.setCardBackgroundColor(ATHUtil.resolveColor(fragment.requireContext(), R.attr.colorPrimary))
} }
itemView.setOnClickListener { itemView.setOnClickListener {

View file

@ -21,7 +21,7 @@ import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
import androidx.annotation.StringRes import androidx.annotation.StringRes
import androidx.fragment.app.Fragment import androidx.fragment.app.Fragment
import code.name.monkey.appthemehelper.ThemeStore import code.name.monkey.appthemehelper.util.ATHUtil
import code.name.monkey.appthemehelper.util.ColorUtil import code.name.monkey.appthemehelper.util.ColorUtil
import code.name.monkey.appthemehelper.util.MaterialUtil import code.name.monkey.appthemehelper.util.MaterialUtil
import code.name.monkey.appthemehelper.util.MaterialValueHelper import code.name.monkey.appthemehelper.util.MaterialValueHelper
@ -75,7 +75,7 @@ class MainSettingsFragment : Fragment(), View.OnClickListener {
NavigationUtil.goToProVersion(requireContext()) NavigationUtil.goToProVersion(requireContext())
} }
MaterialUtil.setTint(buyPremium) MaterialUtil.setTint(buyPremium)
val primaryColor = MaterialValueHelper.getPrimaryTextColor(requireContext(), ColorUtil.isColorLight(ThemeStore.primaryColor(requireContext()))) val primaryColor = MaterialValueHelper.getPrimaryTextColor(requireContext(), ColorUtil.isColorLight(ATHUtil.resolveColor(requireContext(), R.attr.colorPrimary)))
text.setTextColor(ColorUtil.withAlpha(primaryColor, 0.75f)) text.setTextColor(ColorUtil.withAlpha(primaryColor, 0.75f))
text2.setTextColor(primaryColor) text2.setTextColor(primaryColor)
text3.imageTintList = ColorStateList.valueOf(primaryColor) text3.imageTintList = ColorStateList.valueOf(primaryColor)

View file

@ -31,7 +31,6 @@ import android.widget.SeekBar
import android.widget.TextView import android.widget.TextView
import androidx.annotation.ColorInt import androidx.annotation.ColorInt
import androidx.core.view.ViewCompat import androidx.core.view.ViewCompat
import code.name.monkey.appthemehelper.ThemeStore
import code.name.monkey.appthemehelper.util.ATHUtil import code.name.monkey.appthemehelper.util.ATHUtil
import code.name.monkey.appthemehelper.util.ColorUtil import code.name.monkey.appthemehelper.util.ColorUtil
import code.name.monkey.appthemehelper.util.MaterialValueHelper import code.name.monkey.appthemehelper.util.MaterialValueHelper
@ -67,7 +66,8 @@ object ViewUtil {
progress.setColorFilter(newColor, PorterDuff.Mode.SRC_IN) progress.setColorFilter(newColor, PorterDuff.Mode.SRC_IN)
val background = ld.findDrawableByLayerId(android.R.id.background) val background = ld.findDrawableByLayerId(android.R.id.background)
background.setColorFilter(MaterialValueHelper.getPrimaryDisabledTextColor(progressSlider.context, ColorUtil.isColorLight(ThemeStore.primaryColor(progressSlider.context))), PorterDuff.Mode.SRC_IN) val primaryColor = ATHUtil.resolveColor(progressSlider.context, R.attr.colorPrimary);
background.setColorFilter(MaterialValueHelper.getPrimaryDisabledTextColor(progressSlider.context, ColorUtil.isColorLight(primaryColor)), PorterDuff.Mode.SRC_IN)
val secondaryProgress = ld.findDrawableByLayerId(android.R.id.secondaryProgress) val secondaryProgress = ld.findDrawableByLayerId(android.R.id.secondaryProgress)
secondaryProgress.setColorFilter(ColorUtil.withAlpha(newColor, 0.65f), PorterDuff.Mode.SRC_IN) secondaryProgress.setColorFilter(ColorUtil.withAlpha(newColor, 0.65f), PorterDuff.Mode.SRC_IN)

View file

@ -1,101 +0,0 @@
/*
* Copyright (c) 2019 Hemanth Savarala.
*
* Licensed under the GNU General Public License v3
*
* This is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by
* the Free Software Foundation either version 3 of the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*/
package code.name.monkey.retromusic.views;
import android.annotation.SuppressLint;
import android.app.Dialog;
import android.content.Context;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.os.Bundle;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.widget.FrameLayout;
import com.google.android.material.bottomsheet.BottomSheetBehavior;
import com.google.android.material.bottomsheet.BottomSheetDialog;
import java.util.Objects;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.StyleRes;
import androidx.appcompat.app.AppCompatDialogFragment;
import code.name.monkey.appthemehelper.ThemeStore;
import code.name.monkey.appthemehelper.util.VersionUtils;
import code.name.monkey.retromusic.R;
import code.name.monkey.retromusic.activities.base.AbsBaseActivity;
import code.name.monkey.retromusic.util.RetroUtil;
/**
* Created by yu on 2016/11/10.
*/
@SuppressLint("RestrictedApi")
public class RoundedBottomSheetDialogFragment extends AppCompatDialogFragment {
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
view.getViewTreeObserver().addOnGlobalLayoutListener(() -> {
BottomSheetDialog dialog = (BottomSheetDialog) getDialog();
FrameLayout bottomSheet = dialog.findViewById(R.id.design_bottom_sheet);
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.Companion.primaryColor(getContext())));
}
});
if (getActivity() != null) {
if (VersionUtils.INSTANCE.hasNougat()) {
((AbsBaseActivity) getActivity()).setNavigationbarColor(ThemeStore.Companion.primaryColor(getContext()));
} else {
((AbsBaseActivity) getActivity()).setNavigationbarColorAuto();
}
}
}
@NonNull
@Override
public Dialog onCreateDialog(@NonNull Bundle savedInstanceState) {
//noinspection ConstantConditions
return new CustomWidthBottomSheetDialog(getContext(), getTheme());
}
@Override
public void onStart() {
super.onStart();
if (getDialog() != null && getDialog().getWindow() != null) {
Window window = getDialog().getWindow();
window.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
window.setNavigationBarColor(ThemeStore.Companion.primaryColor(getContext()));
window.findViewById(com.google.android.material.R.id.container).setFitsSystemWindows(true);
}
}
static class CustomWidthBottomSheetDialog extends BottomSheetDialog {
CustomWidthBottomSheetDialog(@NonNull Context context, @StyleRes int theme) {
super(context, theme);
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
int width = getContext().getResources().getDimensionPixelSize(R.dimen.bottom_sheet_width);
Objects.requireNonNull(getWindow()).setLayout(width > 0 ? width : ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.MATCH_PARENT);
}
}
}