[Now Playing: Circle] Replaced SeekArc with Circular Seekbar
[Now Playing: Circle] Replaced SeekArc with Circular Seekbar
This commit is contained in:
parent
87eb3c08c3
commit
268e077ab5
7 changed files with 91 additions and 90 deletions
|
@ -160,5 +160,6 @@ dependencies {
|
||||||
implementation 'com.github.dhaval2404:imagepicker:2.1'
|
implementation 'com.github.dhaval2404:imagepicker:2.1'
|
||||||
implementation 'me.zhanghai.android.fastscroll:library:1.1.7'
|
implementation 'me.zhanghai.android.fastscroll:library:1.1.7'
|
||||||
implementation 'cat.ereza:customactivityoncrash:2.3.0'
|
implementation 'cat.ereza:customactivityoncrash:2.3.0'
|
||||||
|
implementation 'me.tankery.lib:circularSeekBar:1.3.2'
|
||||||
debugImplementation 'com.github.amitshekhariitbhu:Android-Debug-Database:1.0.6'
|
debugImplementation 'com.github.amitshekhariitbhu:Android-Debug-Database:1.0.6'
|
||||||
}
|
}
|
|
@ -1,4 +1,5 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<resources>
|
<resources>
|
||||||
<bool name="md3_available">true</bool>
|
<bool name="md3_available">true</bool>
|
||||||
|
<bool name="allowBackup">false</bool>
|
||||||
</resources>
|
</resources>
|
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
<application
|
<application
|
||||||
android:name=".App"
|
android:name=".App"
|
||||||
android:allowBackup="true"
|
android:allowBackup="@bool/allowBackup"
|
||||||
android:configChanges="locale|layoutDirection"
|
android:configChanges="locale|layoutDirection"
|
||||||
android:icon="@mipmap/ic_launcher"
|
android:icon="@mipmap/ic_launcher"
|
||||||
android:label="@string/app_name"
|
android:label="@string/app_name"
|
||||||
|
|
|
@ -18,6 +18,7 @@ import android.animation.ObjectAnimator
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.graphics.Color
|
import android.graphics.Color
|
||||||
import android.graphics.PorterDuff
|
import android.graphics.PorterDuff
|
||||||
|
import android.graphics.drawable.ColorDrawable
|
||||||
import android.media.AudioManager
|
import android.media.AudioManager
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
|
@ -28,10 +29,7 @@ import android.view.animation.LinearInterpolator
|
||||||
import android.widget.SeekBar
|
import android.widget.SeekBar
|
||||||
import androidx.appcompat.widget.Toolbar
|
import androidx.appcompat.widget.Toolbar
|
||||||
import code.name.monkey.appthemehelper.ThemeStore
|
import code.name.monkey.appthemehelper.ThemeStore
|
||||||
import code.name.monkey.appthemehelper.util.ATHUtil
|
import code.name.monkey.appthemehelper.util.*
|
||||||
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
|
import code.name.monkey.retromusic.R
|
||||||
import code.name.monkey.retromusic.databinding.FragmentCirclePlayerBinding
|
import code.name.monkey.retromusic.databinding.FragmentCirclePlayerBinding
|
||||||
import code.name.monkey.retromusic.extensions.*
|
import code.name.monkey.retromusic.extensions.*
|
||||||
|
@ -50,10 +48,9 @@ import code.name.monkey.retromusic.util.MusicUtil
|
||||||
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.util.ViewUtil
|
||||||
import code.name.monkey.retromusic.util.color.MediaNotificationProcessor
|
import code.name.monkey.retromusic.util.color.MediaNotificationProcessor
|
||||||
import code.name.monkey.retromusic.views.SeekArc
|
|
||||||
import code.name.monkey.retromusic.views.SeekArc.OnSeekArcChangeListener
|
|
||||||
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 me.tankery.lib.circularseekbar.CircularSeekBar
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by hemanths on 2020-01-06.
|
* Created by hemanths on 2020-01-06.
|
||||||
|
@ -61,7 +58,7 @@ import code.name.monkey.retromusic.volume.OnAudioVolumeChangedListener
|
||||||
|
|
||||||
class CirclePlayerFragment : AbsPlayerFragment(R.layout.fragment_circle_player), Callback,
|
class CirclePlayerFragment : AbsPlayerFragment(R.layout.fragment_circle_player), Callback,
|
||||||
OnAudioVolumeChangedListener,
|
OnAudioVolumeChangedListener,
|
||||||
OnSeekArcChangeListener {
|
CircularSeekBar.OnCircularSeekBarChangeListener {
|
||||||
|
|
||||||
private lateinit var progressViewUpdateHelper: MusicProgressViewUpdateHelper
|
private lateinit var progressViewUpdateHelper: MusicProgressViewUpdateHelper
|
||||||
private var audioVolumeObserver: AudioVolumeObserver? = null
|
private var audioVolumeObserver: AudioVolumeObserver? = null
|
||||||
|
@ -121,11 +118,17 @@ class CirclePlayerFragment : AbsPlayerFragment(R.layout.fragment_circle_player),
|
||||||
ThemeStore.accentColor(requireContext()),
|
ThemeStore.accentColor(requireContext()),
|
||||||
false
|
false
|
||||||
)
|
)
|
||||||
binding.volumeSeekBar.progressColor = accentColor()
|
binding.volumeSeekBar.circleProgressColor = accentColor()
|
||||||
binding.volumeSeekBar.arcColor = ColorUtil.withAlpha(accentColor(), 0.25f)
|
binding.volumeSeekBar.circleColor = ColorUtil.withAlpha(accentColor(), 0.25f)
|
||||||
setUpPlayPauseFab()
|
setUpPlayPauseFab()
|
||||||
setUpPrevNext()
|
setUpPrevNext()
|
||||||
setUpPlayerToolbar()
|
setUpPlayerToolbar()
|
||||||
|
binding.albumCoverOverlay.background = ColorDrawable(
|
||||||
|
MaterialValueHelper.getPrimaryTextColor(
|
||||||
|
requireContext(),
|
||||||
|
accentColor().isColorLight
|
||||||
|
)
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setUpPrevNext() {
|
private fun setUpPrevNext() {
|
||||||
|
@ -154,7 +157,7 @@ class CirclePlayerFragment : AbsPlayerFragment(R.layout.fragment_circle_player),
|
||||||
interpolator = LinearInterpolator()
|
interpolator = LinearInterpolator()
|
||||||
repeatCount = Animation.INFINITE
|
repeatCount = Animation.INFINITE
|
||||||
duration = 10000
|
duration = 10000
|
||||||
if (MusicPlayerRemote.isPlaying){
|
if (MusicPlayerRemote.isPlaying) {
|
||||||
start()
|
start()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -169,9 +172,11 @@ class CirclePlayerFragment : AbsPlayerFragment(R.layout.fragment_circle_player),
|
||||||
audioVolumeObserver?.register(AudioManager.STREAM_MUSIC, this)
|
audioVolumeObserver?.register(AudioManager.STREAM_MUSIC, this)
|
||||||
|
|
||||||
val audioManager = audioManager
|
val audioManager = audioManager
|
||||||
binding.volumeSeekBar.max = audioManager.getStreamMaxVolume(AudioManager.STREAM_MUSIC)
|
binding.volumeSeekBar.max =
|
||||||
binding.volumeSeekBar.progress = audioManager.getStreamVolume(AudioManager.STREAM_MUSIC)
|
audioManager.getStreamMaxVolume(AudioManager.STREAM_MUSIC).toFloat()
|
||||||
binding.volumeSeekBar.setOnSeekArcChangeListener(this)
|
binding.volumeSeekBar.progress =
|
||||||
|
audioManager.getStreamVolume(AudioManager.STREAM_MUSIC).toFloat()
|
||||||
|
binding.volumeSeekBar.setOnSeekBarChangeListener(this)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onPause() {
|
override fun onPause() {
|
||||||
|
@ -249,8 +254,8 @@ class CirclePlayerFragment : AbsPlayerFragment(R.layout.fragment_circle_player),
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onAudioVolumeChanged(currentVolume: Int, maxVolume: Int) {
|
override fun onAudioVolumeChanged(currentVolume: Int, maxVolume: Int) {
|
||||||
_binding?.volumeSeekBar?.max = maxVolume
|
_binding?.volumeSeekBar?.max = maxVolume.toFloat()
|
||||||
_binding?.volumeSeekBar?.progress = currentVolume
|
_binding?.volumeSeekBar?.progress = currentVolume.toFloat()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onDestroyView() {
|
override fun onDestroyView() {
|
||||||
|
@ -261,15 +266,16 @@ class CirclePlayerFragment : AbsPlayerFragment(R.layout.fragment_circle_player),
|
||||||
_binding = null
|
_binding = null
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onProgressChanged(seekArc: SeekArc?, progress: Int, fromUser: Boolean) {
|
|
||||||
|
override fun onProgressChanged(seekBar: CircularSeekBar?, progress: Float, fromUser: Boolean) {
|
||||||
val audioManager = audioManager
|
val audioManager = audioManager
|
||||||
audioManager.setStreamVolume(AudioManager.STREAM_MUSIC, progress, 0)
|
audioManager.setStreamVolume(AudioManager.STREAM_MUSIC, progress.toInt(), 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onStartTrackingTouch(seekArc: SeekArc?) {
|
override fun onStartTrackingTouch(seekBar: CircularSeekBar?) {
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onStopTrackingTouch(seekArc: SeekArc?) {
|
override fun onStopTrackingTouch(seekBar: CircularSeekBar?) {
|
||||||
}
|
}
|
||||||
|
|
||||||
fun setUpProgressSlider() {
|
fun setUpProgressSlider() {
|
||||||
|
|
|
@ -54,54 +54,46 @@
|
||||||
app:navigationIcon="@drawable/ic_keyboard_arrow_down_black"
|
app:navigationIcon="@drawable/ic_keyboard_arrow_down_black"
|
||||||
tools:layout_editor_absoluteY="24dp" />
|
tools:layout_editor_absoluteY="24dp" />
|
||||||
|
|
||||||
<code.name.monkey.retromusic.views.RetroShapeableImageView
|
<FrameLayout
|
||||||
android:id="@+id/album_cover"
|
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="0dp"
|
android:layout_height="0dp"
|
||||||
android:layout_margin="28dp"
|
android:padding="10dp"
|
||||||
android:scaleType="centerCrop"
|
app:layout_constraintBottom_toBottomOf="@id/volumeSeekBar"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintEnd_toEndOf="@id/volumeSeekBar"
|
||||||
app:layout_constraintDimensionRatio="1:1"
|
app:layout_constraintStart_toStartOf="@id/volumeSeekBar"
|
||||||
app:layout_constraintEnd_toEndOf="@id/guideline"
|
app:layout_constraintTop_toTopOf="@id/volumeSeekBar">
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toBottomOf="@id/playerToolbar"
|
|
||||||
tools:srcCompat="@tools:sample/backgrounds/scenic[6]" />
|
|
||||||
|
|
||||||
<code.name.monkey.retromusic.views.RetroShapeableImageView
|
<code.name.monkey.retromusic.views.RetroShapeableImageView
|
||||||
android:layout_width="0dp"
|
android:id="@+id/album_cover"
|
||||||
android:layout_height="0dp"
|
android:layout_width="match_parent"
|
||||||
android:layout_margin="28dp"
|
android:layout_height="match_parent"
|
||||||
android:alpha="0.5"
|
android:scaleType="centerCrop"
|
||||||
android:background="?colorSurface"
|
tools:srcCompat="@tools:sample/backgrounds/scenic[6]" />
|
||||||
android:scaleType="centerCrop"
|
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
|
||||||
app:layout_constraintDimensionRatio="1:1"
|
|
||||||
app:layout_constraintEnd_toEndOf="@id/guideline"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toBottomOf="@id/playerToolbar" />
|
|
||||||
|
|
||||||
<code.name.monkey.retromusic.views.SeekArc
|
<code.name.monkey.retromusic.views.RetroShapeableImageView
|
||||||
|
android:id="@+id/album_cover_overlay"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:alpha="0.5"
|
||||||
|
android:scaleType="centerCrop" />
|
||||||
|
</FrameLayout>
|
||||||
|
|
||||||
|
<me.tankery.lib.circularseekbar.CircularSeekBar
|
||||||
android:id="@+id/volumeSeekBar"
|
android:id="@+id/volumeSeekBar"
|
||||||
android:layout_width="0dp"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="0dp"
|
android:layout_height="300dp"
|
||||||
android:layout_marginStart="16dp"
|
app:cs_circle_stroke_width="4dp"
|
||||||
android:layout_marginTop="16dp"
|
app:cs_end_angle="60"
|
||||||
android:layout_marginEnd="16dp"
|
app:cs_move_outside_circle="true"
|
||||||
android:layout_marginBottom="16dp"
|
app:cs_pointer_color="@color/md_grey_200"
|
||||||
android:padding="24dp"
|
app:cs_pointer_halo_width="0dp"
|
||||||
app:arcColor="?android:attr/colorControlHighlight"
|
app:cs_pointer_stroke_width="20dp"
|
||||||
app:arcWidth="4dp"
|
app:cs_start_angle="120"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintDimensionRatio="1:1"
|
app:layout_constraintDimensionRatio="1:1"
|
||||||
app:layout_constraintEnd_toEndOf="@id/guideline"
|
app:layout_constraintEnd_toEndOf="@id/guideline"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@id/playerToolbar"
|
app:layout_constraintTop_toBottomOf="@id/playerToolbar"
|
||||||
app:progressWidth="4dp"
|
|
||||||
app:rotation="180"
|
|
||||||
app:roundEdges="true"
|
|
||||||
app:startAngle="30"
|
|
||||||
app:sweepAngle="300"
|
|
||||||
app:touchInside="false"
|
|
||||||
tools:progress="50" />
|
tools:progress="50" />
|
||||||
|
|
||||||
<com.google.android.material.floatingactionbutton.FloatingActionButton
|
<com.google.android.material.floatingactionbutton.FloatingActionButton
|
||||||
|
|
|
@ -81,45 +81,45 @@
|
||||||
app:layout_constraintTop_toBottomOf="@+id/titleContainer"
|
app:layout_constraintTop_toBottomOf="@+id/titleContainer"
|
||||||
tools:text="@tools:sample/lorem/random" />
|
tools:text="@tools:sample/lorem/random" />
|
||||||
|
|
||||||
<code.name.monkey.retromusic.views.RetroShapeableImageView
|
<FrameLayout
|
||||||
android:id="@+id/album_cover"
|
android:layout_width="0dp"
|
||||||
android:layout_width="276dp"
|
android:layout_height="0dp"
|
||||||
android:layout_height="276dp"
|
android:padding="10dp"
|
||||||
android:scaleType="centerCrop"
|
app:layout_constraintBottom_toBottomOf="@id/volumeSeekBar"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintEnd_toEndOf="@id/volumeSeekBar"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintStart_toStartOf="@id/volumeSeekBar"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintTop_toTopOf="@id/volumeSeekBar">
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
|
||||||
tools:srcCompat="@tools:sample/backgrounds/scenic[6]" />
|
|
||||||
|
|
||||||
<code.name.monkey.retromusic.views.RetroShapeableImageView
|
<code.name.monkey.retromusic.views.RetroShapeableImageView
|
||||||
android:layout_width="276dp"
|
android:id="@+id/album_cover"
|
||||||
android:layout_height="276dp"
|
android:layout_width="match_parent"
|
||||||
android:alpha="0.5"
|
android:layout_height="match_parent"
|
||||||
android:background="?colorSurface"
|
android:scaleType="centerCrop"
|
||||||
android:scaleType="centerCrop"
|
tools:srcCompat="@tools:sample/backgrounds/scenic[6]" />
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
|
||||||
|
|
||||||
<code.name.monkey.retromusic.views.SeekArc
|
<code.name.monkey.retromusic.views.RetroShapeableImageView
|
||||||
|
android:id="@+id/album_cover_overlay"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:alpha="0.5"
|
||||||
|
android:scaleType="centerCrop" />
|
||||||
|
</FrameLayout>
|
||||||
|
|
||||||
|
<me.tankery.lib.circularseekbar.CircularSeekBar
|
||||||
android:id="@+id/volumeSeekBar"
|
android:id="@+id/volumeSeekBar"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="300dp"
|
android:layout_height="300dp"
|
||||||
android:padding="28dp"
|
app:cs_circle_stroke_width="4dp"
|
||||||
app:arcColor="?android:attr/colorControlHighlight"
|
app:cs_end_angle="60"
|
||||||
app:arcWidth="4dp"
|
app:cs_move_outside_circle="true"
|
||||||
|
app:cs_pointer_color="@color/md_grey_200"
|
||||||
|
app:cs_pointer_halo_width="0dp"
|
||||||
|
app:cs_pointer_stroke_width="20dp"
|
||||||
|
app:cs_start_angle="120"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
app:progressWidth="4dp"
|
|
||||||
app:rotation="180"
|
|
||||||
app:roundEdges="true"
|
|
||||||
app:startAngle="30"
|
|
||||||
app:sweepAngle="300"
|
|
||||||
app:touchInside="false"
|
|
||||||
tools:progress="50" />
|
tools:progress="50" />
|
||||||
|
|
||||||
<com.google.android.material.floatingactionbutton.FloatingActionButton
|
<com.google.android.material.floatingactionbutton.FloatingActionButton
|
||||||
|
@ -165,7 +165,7 @@
|
||||||
android:textColor="?android:attr/textColorSecondary"
|
android:textColor="?android:attr/textColorSecondary"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="@+id/volumeSeekBar"
|
app:layout_constraintStart_toStartOf="@+id/volumeSeekBar"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/album_cover" />
|
app:layout_constraintTop_toBottomOf="@+id/volumeSeekBar" />
|
||||||
|
|
||||||
|
|
||||||
<androidx.appcompat.widget.AppCompatSeekBar
|
<androidx.appcompat.widget.AppCompatSeekBar
|
||||||
|
|
|
@ -29,4 +29,5 @@
|
||||||
|
|
||||||
<bool name="colored_notification_available">true</bool>
|
<bool name="colored_notification_available">true</bool>
|
||||||
<integer name="overScrollMode">2</integer>
|
<integer name="overScrollMode">2</integer>
|
||||||
|
<bool name="allowBackup">true</bool>
|
||||||
</resources>
|
</resources>
|
Loading…
Add table
Add a link
Reference in a new issue