|
@@ -41,14 +41,17 @@ class MusicEditDialog : DialogFragment() {
|
|
|
editMusic?.let {
|
|
|
val endPosition = endScrollRatio * it.duration
|
|
|
|
|
|
- var playPosition = currentPosition
|
|
|
- if (currentPosition >= endPosition) {
|
|
|
- playPosition = 0
|
|
|
+ if (field >= endPosition) {
|
|
|
+ field = (headScrollRatio * it.duration).toInt()
|
|
|
+
|
|
|
listener?.onMusicStop()
|
|
|
+
|
|
|
editAudioTrackView.playProgressDialogVisible = false
|
|
|
+ play.visibility = View.VISIBLE
|
|
|
+ pause.visibility = View.INVISIBLE
|
|
|
}
|
|
|
- editAudioTrackView.playProgress = playPosition.toFloat() / it.duration
|
|
|
- editAudioTrackView.playProgressText = TimeUtils.getAudioTimeFormat(playPosition.toLong())
|
|
|
+ editAudioTrackView.playProgress = field.toFloat() / it.duration
|
|
|
+ editAudioTrackView.playProgressText = TimeUtils.getAudioTimeFormat(field.toLong())
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -87,12 +90,14 @@ class MusicEditDialog : DialogFragment() {
|
|
|
volumeText.text = "${volumeSeekBar.progress} %"
|
|
|
|
|
|
play.setOnClickListener { _ ->
|
|
|
- var playPosition = currentPosition
|
|
|
val startPosition = it.duration * headScrollRatio
|
|
|
+ var playPosition = currentPosition
|
|
|
+
|
|
|
if (startPosition > currentPosition) {
|
|
|
playPosition = startPosition.toInt()
|
|
|
}
|
|
|
- listener?.onMusicPlayClick2(it, playPosition)
|
|
|
+
|
|
|
+ listener?.onMusicPlayClick(it, playPosition)
|
|
|
|
|
|
editAudioTrackView.playProgressDialogVisible = true
|
|
|
play.visibility = View.INVISIBLE
|
|
@@ -100,10 +105,9 @@ class MusicEditDialog : DialogFragment() {
|
|
|
}
|
|
|
|
|
|
pause.setOnClickListener { _ ->
|
|
|
- editAudioTrackView.playProgressDialogVisible = false
|
|
|
-
|
|
|
listener?.onMusicPauseClick()
|
|
|
|
|
|
+ editAudioTrackView.playProgressDialogVisible = false
|
|
|
play.visibility = View.VISIBLE
|
|
|
pause.visibility = View.INVISIBLE
|
|
|
}
|
|
@@ -209,10 +213,9 @@ class MusicEditDialog : DialogFragment() {
|
|
|
* for more information.
|
|
|
*/
|
|
|
interface OnFragmentInteractionListener {
|
|
|
- fun onMusicPlayClick2(music: Music, startPosition: Int)
|
|
|
+ fun onMusicPlayClick(music: Music, startPosition: Int)
|
|
|
fun onMusicPauseClick()
|
|
|
fun onMusicVolumeChanged(volume: Float)
|
|
|
- fun onMusicSeekTo(mSec: Int)
|
|
|
fun onMusicStop()
|
|
|
}
|
|
|
|