Improved slider

This commit is contained in:
h4h13 2020-02-25 04:03:05 +05:30
parent 437f73b1dc
commit c42e9cb0df
68 changed files with 621 additions and 3401 deletions

View file

@ -32,7 +32,7 @@ import code.name.monkey.retromusic.R;
import code.name.monkey.retromusic.dialogs.OptionsSheetDialogFragment;
import code.name.monkey.retromusic.fragments.AlbumCoverStyle;
import code.name.monkey.retromusic.fragments.NowPlayingScreen;
import code.name.monkey.retromusic.fragments.mainactivity.folders.FoldersFragment;
import code.name.monkey.retromusic.fragments.mainactivity.FoldersFragment;
import code.name.monkey.retromusic.helper.SortOrder;
import code.name.monkey.retromusic.helper.SortOrder.AlbumSongSortOrder;
import code.name.monkey.retromusic.model.CategoryInfo;

View file

@ -28,6 +28,7 @@ import androidx.core.view.ViewCompat
import code.name.monkey.appthemehelper.util.ATHUtil
import code.name.monkey.appthemehelper.util.ColorUtil
import code.name.monkey.appthemehelper.util.MaterialValueHelper
import com.google.android.material.slider.Slider
object ViewUtil {
@ -47,6 +48,16 @@ object ViewUtil {
}
}
fun setProgressDrawable(progressSlider: Slider, color: Int, thumbTint: Boolean = false) {
if (thumbTint) {
progressSlider.thumbColor = ColorStateList.valueOf(color)
}
val colorWithAlpha = ColorUtil.withAlpha(color, 0.25f)
progressSlider.haloColor = ColorStateList.valueOf(colorWithAlpha)
progressSlider.trackColorActive = ColorStateList.valueOf(color)
progressSlider.trackColorInactive = ColorStateList.valueOf(colorWithAlpha)
}
fun setProgressDrawable(progressSlider: ProgressBar, newColor: Int) {
val layerDrawable = progressSlider.progressDrawable as LayerDrawable