Fixed purpleish color on Volume Seekbar

This commit is contained in:
Hemanth S 2020-05-21 03:03:46 +05:30
parent 347d6c5238
commit a3cee7d5f4
2 changed files with 6 additions and 16 deletions

View file

@ -24,7 +24,6 @@ import androidx.annotation.ColorInt
import androidx.annotation.LayoutRes import androidx.annotation.LayoutRes
import code.name.monkey.appthemehelper.ThemeStore import code.name.monkey.appthemehelper.ThemeStore
import code.name.monkey.appthemehelper.util.TintHelper import code.name.monkey.appthemehelper.util.TintHelper
import com.google.android.material.slider.Slider
@Suppress("UNCHECKED_CAST") @Suppress("UNCHECKED_CAST")
fun <T : View> ViewGroup.inflate(@LayoutRes layout: Int): T { fun <T : View> ViewGroup.inflate(@LayoutRes layout: Int): T {
@ -50,13 +49,6 @@ fun EditText.appHandleColor(): EditText {
return this return this
} }
fun Slider.setRange(progress: Float, to: Float) {
valueFrom = 0F
valueTo = to
value = progress
}
fun SeekBar.applyColor(@ColorInt color: Int) { fun SeekBar.applyColor(@ColorInt color: Int) {
thumbTintList = ColorStateList.valueOf(color) thumbTintList = ColorStateList.valueOf(color)
progressTintList = ColorStateList.valueOf(color) progressTintList = ColorStateList.valueOf(color)

View file

@ -15,7 +15,6 @@ import code.name.monkey.retromusic.R
import code.name.monkey.retromusic.extensions.applyColor import code.name.monkey.retromusic.extensions.applyColor
import code.name.monkey.retromusic.helper.MusicPlayerRemote import code.name.monkey.retromusic.helper.MusicPlayerRemote
import code.name.monkey.retromusic.util.PreferenceUtil import code.name.monkey.retromusic.util.PreferenceUtil
import code.name.monkey.retromusic.util.ViewUtil
import code.name.monkey.retromusic.volume.AudioVolumeObserver import code.name.monkey.retromusic.volume.AudioVolumeObserver
import code.name.monkey.retromusic.volume.OnAudioVolumeChangedListener import code.name.monkey.retromusic.volume.OnAudioVolumeChangedListener
import kotlinx.android.synthetic.main.fragment_volume.* import kotlinx.android.synthetic.main.fragment_volume.*
@ -99,15 +98,14 @@ class VolumeFragment : Fragment(), SeekBar.OnSeekBarChangeListener, OnAudioVolum
} }
fun tintWhiteColor() { fun tintWhiteColor() {
val iconColor = Color.WHITE val color = Color.WHITE
volumeDown.setColorFilter(iconColor, PorterDuff.Mode.SRC_IN) volumeDown.setColorFilter(color, PorterDuff.Mode.SRC_IN)
volumeUp.setColorFilter(iconColor, PorterDuff.Mode.SRC_IN) volumeUp.setColorFilter(color, PorterDuff.Mode.SRC_IN)
volumeSeekBar.applyColor(color)
ViewUtil.setProgressDrawable(volumeSeekBar, iconColor, true)
} }
fun setTintable(color: Int) { fun setTintable(color: Int) {
volumeSeekBar.applyColor(color) volumeSeekBar.applyColor(color)
} }
fun removeThumb() { fun removeThumb() {
@ -126,7 +124,7 @@ class VolumeFragment : Fragment(), SeekBar.OnSeekBarChangeListener, OnAudioVolum
volumeDown.setColorFilter(color, PorterDuff.Mode.SRC_IN) volumeDown.setColorFilter(color, PorterDuff.Mode.SRC_IN)
volumeUp.setColorFilter(color, PorterDuff.Mode.SRC_IN) volumeUp.setColorFilter(color, PorterDuff.Mode.SRC_IN)
//TintHelper.setTint(volumeSeekBar, color, false) //TintHelper.setTint(volumeSeekBar, color, false)
ViewUtil.setProgressDrawable(volumeSeekBar, color, true) volumeSeekBar.applyColor(color)
} }
companion object { companion object {