Colored settings

This commit is contained in:
h4h13 2019-02-17 23:33:12 +05:30
parent 01a4119a8d
commit a5a27e62aa
9 changed files with 114 additions and 51 deletions

View file

@ -154,7 +154,7 @@ abstract class AbsSlidingMusicPanelActivity protected constructor() : AbsMusicSe
}
override fun onPanelSlide(panel: View?, slideOffset: Float) {
bottomNavigationView.translationY = slideOffset * 400
setMiniPlayerAlphaProgress(slideOffset)
}
@ -197,6 +197,9 @@ abstract class AbsSlidingMusicPanelActivity protected constructor() : AbsMusicSe
miniPlayerFragment!!.view!!.alpha = alpha
// necessary to make the views below clickable
miniPlayerFragment!!.view!!.visibility = if (alpha == 0f) View.GONE else View.VISIBLE
bottomNavigationView.translationY = progress * 500
bottomNavigationView.alpha = alpha
}
private fun chooseFragmentForTheme() {

View file

@ -8,7 +8,6 @@ import android.view.View
import android.view.ViewGroup
import android.view.animation.LinearInterpolator
import android.widget.SeekBar
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.MaterialValueHelper
@ -105,16 +104,12 @@ class MaterialControlsFragment : AbsPlayerControlsFragment() {
updateShuffleState()
val colorFinal = if (PreferenceUtil.getInstance().adaptiveColor) {
color
} else {
ThemeStore.accentColor(context!!)
if (PreferenceUtil.getInstance().adaptiveColor) {
lastPlaybackControlsColor = color
text.setTextColor(color)
TintHelper.setTintAuto(progressSlider, color, false)
}
lastPlaybackControlsColor = colorFinal
text.setTextColor(colorFinal)
TintHelper.setTintAuto(progressSlider, colorFinal, false)
updatePlayPauseColor()
updatePrevNextColor()
}

View file

@ -46,9 +46,7 @@ class MainSettingsFragment : Fragment(), View.OnClickListener {
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
settingsIcons.forEach {
view.findViewById<ImageView>(it).setColorFilter(ThemeStore.accentColor(context!!))
}
generalSettings.setOnClickListener(this)
audioSettings.setOnClickListener(this)
nowPlayingSettings.setOnClickListener(this)

View file

@ -0,0 +1,39 @@
package code.name.monkey.retromusic.views
import android.content.Context
import android.content.res.ColorStateList
import android.graphics.Color
import android.util.AttributeSet
import androidx.appcompat.widget.AppCompatImageView
import code.name.monkey.appthemehelper.util.ColorUtil
import code.name.monkey.retromusic.R
class ColorIconsImageView : AppCompatImageView {
constructor(context: Context) : super(context) {
init(context, null)
}
constructor(context: Context, attrs: AttributeSet) : super(context, attrs) {
init(context, attrs)
}
constructor(context: Context, attrs: AttributeSet, defStyleAttr: Int) : super(context, attrs, defStyleAttr) {
init(context, attrs)
}
private fun init(context: Context, attrs: AttributeSet?) {
// Load the styled attributes and set their properties
val attributes = context.obtainStyledAttributes(attrs, R.styleable.ColorIconsImageView, 0, 0)
setIconBackgroundColor(attributes.getColor(R.styleable.ColorIconsImageView_iconBackgroundColor, Color.RED))
attributes.recycle()
}
private fun setIconBackgroundColor(color: Int) {
setBackgroundResource(R.drawable.color_circle_gradient)
backgroundTintList = ColorStateList.valueOf(ColorUtil.adjustAlpha(color, 0.3f))
imageTintList = ColorStateList.valueOf(color)
requestLayout()
invalidate()
}
}