Added tint to bottomNavigationView and slidingPanel

This commit is contained in:
Prathamesh More 2021-11-11 20:24:05 +05:30
parent 9d93d700be
commit bc146d8b11
2 changed files with 10 additions and 0 deletions

View file

@ -15,6 +15,7 @@
package code.name.monkey.retromusic.activities.base
import android.animation.Animator
import android.content.res.ColorStateList
import android.graphics.Color
import android.os.Bundle
import android.view.View
@ -60,6 +61,7 @@ import code.name.monkey.retromusic.helper.MusicPlayerRemote
import code.name.monkey.retromusic.model.CategoryInfo
import code.name.monkey.retromusic.util.PreferenceUtil
import code.name.monkey.retromusic.util.RetroUtil
import com.google.android.material.bottomnavigation.BottomNavigationView
import com.google.android.material.bottomsheet.BottomSheetBehavior.*
import org.koin.androidx.viewmodel.ext.android.viewModel
@ -133,6 +135,8 @@ abstract class AbsSlidingMusicPanelActivity : AbsMusicServiceActivity() {
setupSlidingUpPanel()
setupBottomSheet()
updateColor()
binding.slidingPanel.backgroundTintList = ColorStateList.valueOf(darkAccentColor())
bottomNavigationView.backgroundTintList = ColorStateList.valueOf(darkAccentColor())
}
private fun setupBottomSheet() {

View file

@ -29,6 +29,7 @@ import androidx.annotation.ColorRes
import androidx.appcompat.widget.AppCompatImageView
import androidx.appcompat.widget.Toolbar
import androidx.core.content.ContextCompat
import androidx.core.graphics.ColorUtils
import androidx.core.graphics.drawable.DrawableCompat
import androidx.fragment.app.Fragment
import code.name.monkey.appthemehelper.ThemeStore
@ -223,3 +224,8 @@ fun Drawable.tint(context: Context, @ColorRes color: Int): Drawable =
fun Context.getColorCompat(@ColorRes colorRes: Int): Int {
return ContextCompat.getColor(this, colorRes)
}
@ColorInt
fun Context.darkAccentColor(): Int {
return ColorUtils.blendARGB(accentColor(), surfaceColor(), 0.975f)
}