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