|
@@ -15,6 +15,7 @@ import com.gyf.immersionbar.ktx.immersionBar
|
|
|
import com.yingyangfly.baselib.R
|
|
|
import com.yingyangfly.baselib.ext.setOnSingleClickListener
|
|
|
import com.yingyangfly.baselib.utils.ViewTool
|
|
|
+import com.yingyangfly.baselib.voice.PlayVoice
|
|
|
|
|
|
/**
|
|
|
* 任务提醒
|
|
@@ -27,6 +28,8 @@ class TaskFragment : DialogFragment(), View.OnTouchListener {
|
|
|
private var confirmBtan: AppCompatButton? = null
|
|
|
private var animationDrawable: AnimationDrawable? = null
|
|
|
private var id = ""
|
|
|
+ private var playVoice: PlayVoice? = null
|
|
|
+
|
|
|
var onDialogClickListener: ((bean: String) -> Unit)? = null
|
|
|
|
|
|
fun setTaskDesn(taskDesn: String, id: String) {
|
|
@@ -61,6 +64,8 @@ class TaskFragment : DialogFragment(), View.OnTouchListener {
|
|
|
val rootView = ViewTool.inflateFragmentPixels(
|
|
|
activity, R.layout.fragment_task, container, 1194, 834
|
|
|
)
|
|
|
+ playVoice = PlayVoice()
|
|
|
+ playVoice?.setContext(requireActivity())
|
|
|
findId(rootView)
|
|
|
init()
|
|
|
return rootView
|
|
@@ -87,6 +92,7 @@ class TaskFragment : DialogFragment(), View.OnTouchListener {
|
|
|
animationDrawable = fishImage?.drawable as AnimationDrawable?
|
|
|
animationDrawable?.start()
|
|
|
tvContent?.text = taskDesn
|
|
|
+ playVoice?.speak(taskDesn)
|
|
|
}
|
|
|
|
|
|
override fun onTouch(v: View?, event: MotionEvent?): Boolean {
|
|
@@ -96,4 +102,11 @@ class TaskFragment : DialogFragment(), View.OnTouchListener {
|
|
|
}
|
|
|
return false
|
|
|
}
|
|
|
+
|
|
|
+ override fun dismiss() {
|
|
|
+ if (playVoice != null) {
|
|
|
+ playVoice?.stop()
|
|
|
+ }
|
|
|
+ super.dismiss()
|
|
|
+ }
|
|
|
}
|