Fix Slider thumb size
This commit is contained in:
parent
20e71f355a
commit
19c7b826f4
25 changed files with 98 additions and 64 deletions
|
@ -67,6 +67,11 @@ android {
|
|||
versionName defaultConfig.versionName + "_" + getDate()
|
||||
dimension "default"
|
||||
}
|
||||
nofont {
|
||||
versionCode defaultConfig.versionCode + 10000
|
||||
versionName defaultConfig.versionName + "_" + getDate()
|
||||
dimension "default"
|
||||
}
|
||||
}
|
||||
|
||||
packagingOptions {
|
||||
|
|
Binary file not shown.
|
@ -21,6 +21,7 @@ import code.name.monkey.retromusic.helper.PlayPauseButtonOnClickHandler
|
|||
import code.name.monkey.retromusic.service.MusicService
|
||||
import code.name.monkey.retromusic.util.MusicUtil
|
||||
import code.name.monkey.retromusic.util.PreferenceUtil
|
||||
import code.name.monkey.retromusic.util.SliderReadTimeLabelFormatter
|
||||
import code.name.monkey.retromusic.util.ViewUtil
|
||||
import kotlinx.android.synthetic.main.fragment_adaptive_player_playback_controls.*
|
||||
|
||||
|
@ -233,6 +234,7 @@ class AdaptivePlaybackControlsFragment : AbsPlayerControlsFragment() {
|
|||
}
|
||||
|
||||
override fun setUpProgressSlider() {
|
||||
progressSlider.setLabelFormatter(SliderReadTimeLabelFormatter())
|
||||
progressSlider.addOnChangeListener { _, value, fromUser ->
|
||||
if (fromUser) {
|
||||
MusicPlayerRemote.seekTo(value.toInt())
|
||||
|
|
|
@ -25,6 +25,7 @@ import android.view.ViewGroup
|
|||
import androidx.appcompat.widget.Toolbar
|
||||
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.TintHelper
|
||||
import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper
|
||||
import code.name.monkey.retromusic.R
|
||||
|
@ -97,6 +98,8 @@ class CirclePlayerFragment : AbsPlayerFragment(), Callback, OnAudioVolumeChanged
|
|||
false
|
||||
)
|
||||
volumeSeekBar.progressColor = ThemeStore.accentColor(requireContext())
|
||||
volumeSeekBar.arcColor = ColorUtil
|
||||
.withAlpha(ThemeStore.accentColor(requireContext()), 0.25f)
|
||||
setUpPlayPauseFab()
|
||||
setUpPrevNext()
|
||||
setUpPlayerToolbar()
|
||||
|
@ -116,7 +119,6 @@ class CirclePlayerFragment : AbsPlayerFragment(), Callback, OnAudioVolumeChanged
|
|||
|
||||
private fun setUpPlayPauseFab() {
|
||||
TintHelper.setTintAuto(playPauseButton, ThemeStore.accentColor(requireContext()), false)
|
||||
//TintHelper.setTintAuto(playPauseButton, ATHUtil.resolveColor(requireContext(), R.attr.colorSurface), true)
|
||||
playPauseButton.setOnClickListener(PlayPauseButtonOnClickHandler())
|
||||
}
|
||||
|
||||
|
|
|
@ -62,7 +62,6 @@ class FullPlaybackControlsFragment : AbsPlayerControlsFragment(),
|
|||
|
||||
songTotalTime.setTextColor(Color.WHITE)
|
||||
songCurrentProgress.setTextColor(Color.WHITE)
|
||||
|
||||
title.isSelected = true
|
||||
}
|
||||
|
||||
|
|
|
@ -14,15 +14,12 @@
|
|||
|
||||
package code.name.monkey.retromusic.fragments.player.lockscreen
|
||||
|
||||
import android.animation.ObjectAnimator
|
||||
import android.graphics.PorterDuff
|
||||
import android.os.Bundle
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.view.animation.DecelerateInterpolator
|
||||
import android.view.animation.LinearInterpolator
|
||||
import android.widget.SeekBar
|
||||
import code.name.monkey.appthemehelper.util.ATHUtil
|
||||
import code.name.monkey.appthemehelper.util.ColorUtil
|
||||
import code.name.monkey.appthemehelper.util.MaterialValueHelper
|
||||
|
@ -34,7 +31,6 @@ import code.name.monkey.retromusic.fragments.base.AbsPlayerControlsFragment
|
|||
import code.name.monkey.retromusic.helper.MusicPlayerRemote
|
||||
import code.name.monkey.retromusic.helper.MusicProgressViewUpdateHelper
|
||||
import code.name.monkey.retromusic.helper.PlayPauseButtonOnClickHandler
|
||||
import code.name.monkey.retromusic.misc.SimpleOnSeekbarChangeListener
|
||||
import code.name.monkey.retromusic.service.MusicService
|
||||
import code.name.monkey.retromusic.util.MusicUtil
|
||||
import code.name.monkey.retromusic.util.PreferenceUtil
|
||||
|
@ -133,6 +129,8 @@ class LockScreenPlayerControlsFragment : AbsPlayerControlsFragment() {
|
|||
volumeFragment?.setTintable(colorFinal)
|
||||
ViewUtil.setProgressDrawable(progressSlider, colorFinal, true)
|
||||
|
||||
updateRepeatState()
|
||||
updateShuffleState()
|
||||
updatePrevNextColor()
|
||||
|
||||
val isDark = ColorUtil.isColorLight(colorFinal)
|
||||
|
@ -237,29 +235,22 @@ class LockScreenPlayerControlsFragment : AbsPlayerControlsFragment() {
|
|||
}
|
||||
}
|
||||
|
||||
override fun setUpProgressSlider() {
|
||||
progressSlider.setOnSeekBarChangeListener(object : SimpleOnSeekbarChangeListener() {
|
||||
override fun onProgressChanged(seekBar: SeekBar, progress: Int, fromUser: Boolean) {
|
||||
if (fromUser) {
|
||||
MusicPlayerRemote.seekTo(progress)
|
||||
onUpdateProgressViews(
|
||||
MusicPlayerRemote.songProgressMillis,
|
||||
MusicPlayerRemote.songDurationMillis
|
||||
)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
override fun onUpdateProgressViews(progress: Int, total: Int) {
|
||||
progressSlider.max = total
|
||||
|
||||
val animator = ObjectAnimator.ofInt(progressSlider, "progress", progress)
|
||||
animator.duration = SLIDER_ANIMATION_TIME
|
||||
animator.interpolator = LinearInterpolator()
|
||||
animator.start()
|
||||
|
||||
progressSlider.valueTo = total.toFloat()
|
||||
progressSlider.value = progress.toFloat()
|
||||
songTotalTime.text = MusicUtil.getReadableDurationString(total.toLong())
|
||||
songCurrentProgress.text = MusicUtil.getReadableDurationString(progress.toLong())
|
||||
}
|
||||
|
||||
override fun setUpProgressSlider() {
|
||||
progressSlider.addOnChangeListener { _, value, fromUser ->
|
||||
if (fromUser) {
|
||||
MusicPlayerRemote.seekTo(value.toInt())
|
||||
onUpdateProgressViews(
|
||||
MusicPlayerRemote.songProgressMillis,
|
||||
MusicPlayerRemote.songDurationMillis
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -41,9 +41,10 @@ object SongMenuHelper {
|
|||
R.id.action_set_as_ringtone -> {
|
||||
if (RingtoneManager.requiresDialog(activity)) {
|
||||
RingtoneManager.getDialog(activity)
|
||||
} else {
|
||||
val ringtoneManager = RingtoneManager(activity)
|
||||
ringtoneManager.setRingtone(song)
|
||||
}
|
||||
val ringtoneManager = RingtoneManager(activity)
|
||||
ringtoneManager.setRingtone(song)
|
||||
return true
|
||||
}
|
||||
R.id.action_share -> {
|
||||
|
|
|
@ -43,7 +43,6 @@ class RingtoneManager(val context: Context) {
|
|||
return
|
||||
}
|
||||
|
||||
|
||||
try {
|
||||
val cursor = resolver.query(
|
||||
MediaStore.Audio.Media.EXTERNAL_CONTENT_URI,
|
||||
|
@ -65,7 +64,6 @@ class RingtoneManager(val context: Context) {
|
|||
}
|
||||
|
||||
companion object {
|
||||
private const val TAG = "RingtoneManager"
|
||||
|
||||
fun requiresDialog(context: Context): Boolean {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
|
@ -89,6 +87,5 @@ class RingtoneManager(val context: Context) {
|
|||
negativeButton(android.R.string.cancel)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
package code.name.monkey.retromusic.util
|
||||
|
||||
import com.google.android.material.slider.Slider
|
||||
import java.util.*
|
||||
|
||||
class SliderReadTimeLabelFormatter : Slider.LabelFormatter {
|
||||
|
||||
override fun getFormattedValue(value: Float): String {
|
||||
var minutes: Long = value.toLong() / 1000 / 60
|
||||
val seconds: Long = value.toLong() / 1000 % 60
|
||||
return if (minutes < 60) {
|
||||
String.format(
|
||||
Locale.getDefault(),
|
||||
"%01d:%02d",
|
||||
minutes,
|
||||
seconds
|
||||
)
|
||||
} else {
|
||||
val hours = minutes / 60
|
||||
minutes %= 60
|
||||
String.format(
|
||||
Locale.getDefault(),
|
||||
"%d:%02d:%02d",
|
||||
hours,
|
||||
minutes,
|
||||
seconds
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
|
@ -29,16 +29,12 @@
|
|||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:value="1.0f"
|
||||
android:valueFrom="-0.1f"
|
||||
android:valueTo="1.0f"
|
||||
app:labelBehavior="gone"
|
||||
app:layout_constraintEnd_toStartOf="@id/songTotalTime"
|
||||
app:layout_constraintStart_toEndOf="@id/songCurrentProgress"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:trackHeight="3dp"
|
||||
tools:valueFrom="0.0"
|
||||
tools:valueTo="11.0" />
|
||||
app:haloRadius="0dp"
|
||||
app:thumbRadius="@dimen/slider_thumb_radius"
|
||||
app:trackHeight="@dimen/slider_track_height" />
|
||||
|
||||
<com.google.android.material.textview.MaterialTextView
|
||||
android:id="@+id/songTotalTime"
|
||||
|
|
|
@ -43,22 +43,17 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:layout_weight="8"
|
||||
android:splitTrack="false"
|
||||
android:value="1.0f"
|
||||
android:valueFrom="0.0f"
|
||||
android:valueTo="1.0f"
|
||||
app:haloColor="@color/md_white_semi_transparent"
|
||||
app:haloRadius="0dp"
|
||||
app:labelBehavior="gone"
|
||||
app:layout_constraintEnd_toStartOf="@id/songTotalTime"
|
||||
app:layout_constraintStart_toEndOf="@id/songCurrentProgress"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:thumbColor="@color/md_white_1000"
|
||||
app:thumbRadius="@dimen/slider_thumb_radius"
|
||||
app:trackColorActive="@color/md_white_1000"
|
||||
app:trackColorInactive="@color/md_white_semi_transparent"
|
||||
app:trackHeight="3dp"
|
||||
tools:ignore="RtlHardcoded,UnusedAttribute"
|
||||
tools:progress="20"
|
||||
tools:valueFrom="0.0"
|
||||
tools:valueTo="11.0" />
|
||||
app:trackHeight="@dimen/slider_track_height" />
|
||||
|
||||
<com.google.android.material.textview.MaterialTextView
|
||||
android:id="@+id/songTotalTime"
|
||||
|
|
|
@ -61,11 +61,13 @@
|
|||
android:paddingStart="20dp"
|
||||
android:paddingEnd="20dp"
|
||||
app:haloColor="@color/md_white_semi_transparent"
|
||||
app:haloRadius="0dp"
|
||||
app:labelBehavior="gone"
|
||||
app:thumbColor="@color/md_white_1000"
|
||||
app:thumbRadius="@dimen/slider_thumb_radius"
|
||||
app:trackColorActive="@color/md_white_1000"
|
||||
app:trackColorInactive="@color/md_white_semi_transparent"
|
||||
app:trackHeight="2dp"
|
||||
app:trackHeight="@dimen/slider_track_height"
|
||||
tools:progress="20" />
|
||||
|
||||
<com.google.android.material.textview.MaterialTextView
|
||||
|
|
|
@ -32,7 +32,8 @@
|
|||
app:layout_constraintEnd_toStartOf="@id/songTotalTime"
|
||||
app:layout_constraintStart_toEndOf="@id/songCurrentProgress"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:trackHeight="3dp"
|
||||
app:thumbRadius="@dimen/slider_thumb_radius"
|
||||
app:trackHeight="@dimen/slider_track_height"
|
||||
tools:ignore="RtlHardcoded,UnusedAttribute"
|
||||
tools:progress="20" />
|
||||
|
||||
|
|
|
@ -35,8 +35,7 @@
|
|||
app:layout_constraintEnd_toStartOf="@id/songTotalTime"
|
||||
app:layout_constraintStart_toEndOf="@id/songCurrentProgress"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:thumbRadius="8dp"
|
||||
app:trackHeight="3dp"
|
||||
app:trackHeight="@dimen/slider_track_height"
|
||||
tools:ignore="RtlHardcoded,UnusedAttribute"
|
||||
tools:progress="20" />
|
||||
|
||||
|
|
|
@ -88,15 +88,16 @@
|
|||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="16dp"
|
||||
app:haloColor="@color/md_white_semi_transparent"
|
||||
app:haloRadius="0dp"
|
||||
app:labelBehavior="gone"
|
||||
app:layout_constraintEnd_toStartOf="@id/songTotalTime"
|
||||
app:layout_constraintStart_toEndOf="@id/songCurrentProgress"
|
||||
app:layout_constraintTop_toBottomOf="@id/text"
|
||||
app:thumbColor="@color/md_white_1000"
|
||||
app:thumbRadius="@dimen/slider_thumb_radius"
|
||||
app:trackColorActive="@color/md_white_1000"
|
||||
app:trackColorInactive="@color/md_white_semi_transparent"
|
||||
app:trackHeight="3dp"
|
||||
app:trackHeight="@dimen/slider_track_height"
|
||||
tools:ignore="RtlHardcoded,UnusedAttribute"
|
||||
tools:progress="20" />
|
||||
|
||||
|
|
|
@ -25,19 +25,15 @@
|
|||
tools:ignore="RtlHardcoded,RtlSymmetry"
|
||||
tools:text="00:22" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatSeekBar
|
||||
<com.google.android.material.slider.Slider
|
||||
android:id="@+id/progressSlider"
|
||||
style="@style/Widget.MaterialProgressBar.ProgressBar.Horizontal"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="8"
|
||||
android:maxHeight="3dp"
|
||||
android:progressDrawable="@drawable/color_progress_seek"
|
||||
android:splitTrack="false"
|
||||
android:thumb="@drawable/switch_thumb_material"
|
||||
app:layout_constraintEnd_toStartOf="@id/songTotalTime"
|
||||
app:layout_constraintStart_toEndOf="@id/songCurrentProgress"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:thumbRadius="@dimen/slider_thumb_radius"
|
||||
app:trackHeight="@dimen/slider_track_height"
|
||||
tools:ignore="RtlHardcoded,UnusedAttribute"
|
||||
tools:progress="20" />
|
||||
|
||||
|
|
|
@ -33,7 +33,8 @@
|
|||
app:layout_constraintEnd_toStartOf="@id/songTotalTime"
|
||||
app:layout_constraintStart_toEndOf="@id/songCurrentProgress"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:trackHeight="3dp"
|
||||
app:thumbRadius="@dimen/slider_thumb_radius"
|
||||
app:trackHeight="@dimen/slider_track_height"
|
||||
tools:ignore="RtlHardcoded,UnusedAttribute"
|
||||
tools:progress="20" />
|
||||
|
||||
|
|
|
@ -43,7 +43,8 @@
|
|||
app:layout_constraintEnd_toStartOf="@id/songTotalTime"
|
||||
app:layout_constraintStart_toEndOf="@id/songCurrentProgress"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:trackHeight="3dp"
|
||||
app:thumbRadius="@dimen/slider_thumb_radius"
|
||||
app:trackHeight="@dimen/slider_track_height"
|
||||
tools:ignore="RtlHardcoded,UnusedAttribute"
|
||||
tools:progress="20" />
|
||||
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
app:layout_constraintEnd_toStartOf="@id/songTotalTime"
|
||||
app:layout_constraintStart_toEndOf="@id/songCurrentProgress"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:thumbRadius="@dimen/slider_thumb_radius"
|
||||
app:trackHeight="3dp"
|
||||
tools:ignore="RtlHardcoded,UnusedAttribute"
|
||||
tools:progress="20" />
|
||||
|
|
|
@ -32,7 +32,8 @@
|
|||
app:layout_constraintEnd_toStartOf="@id/songTotalTime"
|
||||
app:layout_constraintStart_toEndOf="@id/songCurrentProgress"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:trackHeight="3dp"
|
||||
app:thumbRadius="@dimen/slider_thumb_radius"
|
||||
app:trackHeight="@dimen/slider_track_height"
|
||||
tools:ignore="RtlHardcoded,UnusedAttribute"
|
||||
tools:progress="20" />
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
app:layout_constraintHorizontal_bias="0.5"
|
||||
app:layout_constraintStart_toEndOf="@+id/volumeDown"
|
||||
app:layout_constraintTop_toTopOf="@+id/volumeDown"
|
||||
app:thumbRadius="8dp"
|
||||
app:thumbRadius="@dimen/slider_thumb_radius"
|
||||
app:trackHeight="2dp" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
|
|
|
@ -50,4 +50,6 @@
|
|||
<dimen name="bottom_sheet_peek_2_height">32dp</dimen>
|
||||
<dimen name="list_pref_guideline_begin">56dp</dimen>
|
||||
<dimen name="pref_title_padding">72dp</dimen>
|
||||
<dimen name="slider_thumb_radius">6dp</dimen>
|
||||
<dimen name="slider_track_height">3dp</dimen>
|
||||
</resources>
|
||||
|
|
|
@ -198,4 +198,11 @@
|
|||
<item name="cornerFamily">rounded</item>
|
||||
<item name="cornerSize">78dp</item>
|
||||
</style>
|
||||
|
||||
<style name="RetroSliderTooltip" parent="Widget.MaterialComponents.Tooltip">
|
||||
<item name="backgroundColor">@color/md_white_1000</item>
|
||||
<item name="background">@color/md_white_1000</item>
|
||||
<item name="android:background">@color/md_white_1000</item>
|
||||
<item name="android:textColor">@color/md_red_400</item>
|
||||
</style>
|
||||
</resources>
|
||||
|
|
4
app/src/nofont/res/font/circular.xml
Normal file
4
app/src/nofont/res/font/circular.xml
Normal file
|
@ -0,0 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<font-family xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
</font-family>
|
BIN
device-2020-03-01-203243.png
Normal file
BIN
device-2020-03-01-203243.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3 MiB |
Loading…
Reference in a new issue