Fix buttons color

This commit is contained in:
h4h13 2019-06-08 19:12:57 +05:30
parent a96e682e2b
commit 933bf70068
13 changed files with 47 additions and 90 deletions

View file

@ -1,7 +1,6 @@
package code.name.monkey.retromusic.activities
import android.content.Intent
import android.content.res.ColorStateList
import android.graphics.Color
import android.os.Bundle
import android.transition.Slide
@ -14,10 +13,7 @@ import androidx.recyclerview.widget.DefaultItemAnimator
import androidx.recyclerview.widget.GridLayoutManager
import androidx.recyclerview.widget.LinearLayoutManager
import code.name.monkey.appthemehelper.ThemeStore
import code.name.monkey.appthemehelper.util.ColorUtil
import code.name.monkey.appthemehelper.util.MaterialValueHelper
import code.name.monkey.appthemehelper.util.TintHelper
import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper
import code.name.monkey.appthemehelper.util.*
import code.name.monkey.retromusic.R
import code.name.monkey.retromusic.activities.base.AbsSlidingMusicPanelActivity
import code.name.monkey.retromusic.activities.tageditor.AbsTagEditorActivity
@ -245,19 +241,17 @@ class AlbumDetailsActivity : AbsSlidingMusicPanelActivity(), AlbumDetailsContrac
}
private fun setColors(color: Int) {
val themeColor = if (PreferenceUtil.getInstance().adaptiveColor) color else ThemeStore.accentColor(this)
val themeColor = if (PreferenceUtil.getInstance().adaptiveColor) color
else ThemeStore.accentColor(this)
songTitle.setTextColor(themeColor)
moreTitle.setTextColor(themeColor)
playAction.backgroundTintList = ColorStateList.valueOf(themeColor)
shuffleAction.backgroundTintList = ColorStateList.valueOf(themeColor)
ColorStateList.valueOf(MaterialValueHelper.getPrimaryTextColor(this, ColorUtil.isColorLight(themeColor))).apply {
playAction.setTextColor(this)
playAction.iconTint = this
val buttonColor = if (PreferenceUtil.getInstance().adaptiveColor) color
else ATHUtil.resolveColor(this, R.attr.cardBackgroundColor)
shuffleAction.setTextColor(this)
shuffleAction.iconTint = this
}
MaterialUtil.setTint(button = shuffleAction, color = buttonColor)
MaterialUtil.setTint(button = playAction, color = buttonColor)
}

View file

@ -18,10 +18,7 @@ import androidx.recyclerview.widget.DefaultItemAnimator
import androidx.recyclerview.widget.GridLayoutManager
import androidx.recyclerview.widget.LinearLayoutManager
import code.name.monkey.appthemehelper.ThemeStore
import code.name.monkey.appthemehelper.util.ColorUtil
import code.name.monkey.appthemehelper.util.MaterialValueHelper
import code.name.monkey.appthemehelper.util.TintHelper
import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper
import code.name.monkey.appthemehelper.util.*
import code.name.monkey.retromusic.R
import code.name.monkey.retromusic.activities.base.AbsSlidingMusicPanelActivity
import code.name.monkey.retromusic.adapter.album.AlbumAdapter
@ -40,7 +37,12 @@ import code.name.monkey.retromusic.rest.LastFMRestClient
import code.name.monkey.retromusic.rest.model.LastFmArtist
import code.name.monkey.retromusic.util.*
import com.google.android.material.appbar.AppBarLayout
import kotlinx.android.synthetic.main.activity_album_content.*
import kotlinx.android.synthetic.main.activity_artist_content.*
import kotlinx.android.synthetic.main.activity_artist_content.playAction
import kotlinx.android.synthetic.main.activity_artist_content.recyclerView
import kotlinx.android.synthetic.main.activity_artist_content.shuffleAction
import kotlinx.android.synthetic.main.activity_artist_content.songTitle
import kotlinx.android.synthetic.main.activity_artist_details.*
import retrofit2.Call
import retrofit2.Callback
@ -291,17 +293,11 @@ class ArtistDetailActivity : AbsSlidingMusicPanelActivity(), ArtistDetailContrac
songTitle.setTextColor(textColor)
biographyTitle.setTextColor(textColor)
playAction.backgroundTintList = ColorStateList.valueOf(textColor)
shuffleAction.backgroundTintList = ColorStateList.valueOf(textColor)
ColorStateList.valueOf(MaterialValueHelper.getPrimaryTextColor(this, ColorUtil.isColorLight(textColor))).apply {
playAction.setTextColor(this)
playAction.iconTint = this
val buttonColor = if (PreferenceUtil.getInstance().adaptiveColor) color
else ATHUtil.resolveColor(this, R.attr.cardBackgroundColor)
shuffleAction.setTextColor(this)
shuffleAction.iconTint = this
}
findViewById<View>(R.id.root).setBackgroundColor(ThemeStore.primaryColor(this))
MaterialUtil.setTint(button = shuffleAction, color = buttonColor)
MaterialUtil.setTint(button = playAction, color = buttonColor)
}

View file

@ -26,6 +26,7 @@ import code.name.monkey.retromusic.activities.base.AbsMusicServiceActivity
import code.name.monkey.retromusic.adapter.SearchAdapter
import code.name.monkey.retromusic.mvp.contract.SearchContract
import code.name.monkey.retromusic.mvp.presenter.SearchPresenter
import code.name.monkey.retromusic.util.RetroColorUtil
import code.name.monkey.retromusic.util.RetroUtil
import kotlinx.android.synthetic.main.activity_search.*
import java.util.*
@ -59,7 +60,7 @@ class SearchActivity : AbsMusicServiceActivity(), OnQueryTextListener, SearchCon
back.setOnClickListener { onBackPressed() }
voiceSearch.setOnClickListener { startMicSearch() }
searchContainer.setCardBackgroundColor(RetroUtil.toolbarColor(this))
searchContainer.setCardBackgroundColor(RetroColorUtil.toolbarColor(this))
keyboardPopup.setOnClickListener {
val inputManager = getSystemService(Service.INPUT_METHOD_SERVICE) as InputMethodManager