Skip to content

Commit

Permalink
优化
Browse files Browse the repository at this point in the history
  • Loading branch information
821938089 committed Sep 20, 2024
1 parent 38cecec commit 4b741f1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ class ReadAloudConfigDialog : DialogFragment() {

override fun onPreferenceTreeClick(preference: Preference): Boolean {
when (preference.key) {
PreferKey.ttsEngine -> showDialogFragment(SpeakEngineDialog(this))
PreferKey.ttsEngine -> showDialogFragment(SpeakEngineDialog())
"sysTtsConfig" -> IntentHelp.openTTSSetting()
}
return super.onPreferenceTreeClick(preference)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ import kotlinx.coroutines.launch
/**
* tts引擎管理
*/
class SpeakEngineDialog(val callBack: CallBack) : BaseDialogFragment(R.layout.dialog_recycler_view),
class SpeakEngineDialog() : BaseDialogFragment(R.layout.dialog_recycler_view),
Toolbar.OnMenuItemClickListener {

private val binding by viewBinding(DialogRecyclerViewBinding::bind)
Expand All @@ -63,6 +63,7 @@ class SpeakEngineDialog(val callBack: CallBack) : BaseDialogFragment(R.layout.di
private val adapter by lazy { Adapter(requireContext()) }
private var ttsEngine: String? = ReadAloud.ttsEngine
private val sysTtsViews = arrayListOf<RadioButton>()
private val callBack: CallBack? get() = parentFragment as? CallBack
private val importDocResult = registerForActivityResult(HandleFileContract()) {
it.uri?.let { uri ->
viewModel.importLocal(uri)
Expand Down Expand Up @@ -140,7 +141,7 @@ class SpeakEngineDialog(val callBack: CallBack) : BaseDialogFragment(R.layout.di
tvFooterLeft.visible()
tvFooterLeft.setOnClickListener {
ReadBook.book?.setTtsEngine(ttsEngine)
callBack.upSpeakEngineSummary()
callBack?.upSpeakEngineSummary()
ReadAloud.upReadAloudClass()
dismissAllowingStateLoss()
}
Expand All @@ -149,7 +150,7 @@ class SpeakEngineDialog(val callBack: CallBack) : BaseDialogFragment(R.layout.di
tvOk.setOnClickListener {
ReadBook.book?.setTtsEngine(null)
AppConfig.ttsEngine = ttsEngine
callBack.upSpeakEngineSummary()
callBack?.upSpeakEngineSummary()
ReadAloud.upReadAloudClass()
dismissAllowingStateLoss()
}
Expand Down

0 comments on commit 4b741f1

Please sign in to comment.