Commit f556f899 by 王佳洋

音频播放倍速

parent 3eaf2c42
package com.yidianling.course.coursePlay package com.yidianling.course.coursePlay
import android.annotation.SuppressLint
import android.content.Intent import android.content.Intent
import android.graphics.drawable.Drawable import android.graphics.drawable.Drawable
import android.text.TextUtils import android.text.TextUtils
...@@ -178,6 +179,7 @@ class AudioPlayActivity : BaseMvpActivity<IAudioPlayContract.View, IAudioPlayCon ...@@ -178,6 +179,7 @@ class AudioPlayActivity : BaseMvpActivity<IAudioPlayContract.View, IAudioPlayCon
} }
} }
@SuppressLint("SetTextI18n")
override fun updateView(bean: CourseExtraBean, from: Int) { override fun updateView(bean: CourseExtraBean, from: Int) {
bean.let { bean.let {
Glide.with(this) Glide.with(this)
...@@ -206,6 +208,7 @@ class AudioPlayActivity : BaseMvpActivity<IAudioPlayContract.View, IAudioPlayCon ...@@ -206,6 +208,7 @@ class AudioPlayActivity : BaseMvpActivity<IAudioPlayContract.View, IAudioPlayCon
iv_speed.setOnClickListener { speedClick() } iv_speed.setOnClickListener { speedClick() }
tv_list.setOnClickListener { _ -> listClick(it) } tv_list.setOnClickListener { _ -> listClick(it) }
iv_list.setOnClickListener { _ -> listClick(it) } iv_list.setOnClickListener { _ -> listClick(it) }
tv_speed.text = "${audio_play.getSpeed()}X"
audio_play.setData(mPresenter.getPlayPosition(), mPresenter.convertToMusics(), from) audio_play.setData(mPresenter.getPlayPosition(), mPresenter.convertToMusics(), from)
} }
} }
...@@ -234,11 +237,13 @@ class AudioPlayActivity : BaseMvpActivity<IAudioPlayContract.View, IAudioPlayCon ...@@ -234,11 +237,13 @@ class AudioPlayActivity : BaseMvpActivity<IAudioPlayContract.View, IAudioPlayCon
} }
} }
@SuppressLint("SetTextI18n")
private fun speedClick() { private fun speedClick() {
showFragment(mCourseSpeedDialog ?: CourseSpeedDialog().also { dialog -> showFragment(mCourseSpeedDialog ?: CourseSpeedDialog().also { dialog ->
mCourseSpeedDialog = dialog mCourseSpeedDialog = dialog
dialog.setSpeedPosition(audio_play.getSpeed()) dialog.setSpeedPosition(audio_play.getSpeed())
dialog.mListener = { speed -> dialog.mListener = { speed ->
tv_speed.text = "${speed}X"
audio_play.setSpeed(speed) audio_play.setSpeed(speed)
} }
}, "courseSpeed") }, "courseSpeed")
......
...@@ -136,7 +136,7 @@ ...@@ -136,7 +136,7 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:paddingTop="7dp" android:paddingTop="7dp"
android:text="倍速" tools:text="1.0X"
android:textColor="@android:color/white" android:textColor="@android:color/white"
android:textSize="13sp" android:textSize="13sp"
app:layout_constraintEnd_toStartOf="@id/tv_list" app:layout_constraintEnd_toStartOf="@id/tv_list"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment