|
|
@ -56,11 +56,12 @@ class ReadAloudConfigDialog : DialogFragment() { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
class ReadAloudPreferenceFragment : BasePreferenceFragment(), |
|
|
|
class ReadAloudPreferenceFragment : BasePreferenceFragment(), |
|
|
|
|
|
|
|
SpeakEngineDialog.CallBack, |
|
|
|
SharedPreferences.OnSharedPreferenceChangeListener { |
|
|
|
SharedPreferences.OnSharedPreferenceChangeListener { |
|
|
|
|
|
|
|
|
|
|
|
private val speakEngineSummary: String |
|
|
|
private val speakEngineSummary: String |
|
|
|
get() { |
|
|
|
get() { |
|
|
|
val ttsEngine = AppConfig.ttsEngine |
|
|
|
val ttsEngine = ReadAloud.ttsEngine |
|
|
|
?: return getString(R.string.system_tts) |
|
|
|
?: return getString(R.string.system_tts) |
|
|
|
if (StringUtils.isNumeric(ttsEngine)) { |
|
|
|
if (StringUtils.isNumeric(ttsEngine)) { |
|
|
|
return appDb.httpTTSDao.getName(ttsEngine.toLong()) |
|
|
|
return appDb.httpTTSDao.getName(ttsEngine.toLong()) |
|
|
@ -72,10 +73,7 @@ class ReadAloudConfigDialog : DialogFragment() { |
|
|
|
|
|
|
|
|
|
|
|
override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) { |
|
|
|
override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) { |
|
|
|
addPreferencesFromResource(R.xml.pref_config_aloud) |
|
|
|
addPreferencesFromResource(R.xml.pref_config_aloud) |
|
|
|
upPreferenceSummary( |
|
|
|
upSpeakEngineSummary() |
|
|
|
findPreference(PreferKey.ttsEngine), |
|
|
|
|
|
|
|
speakEngineSummary |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
override fun onViewCreated(view: View, savedInstanceState: Bundle?) { |
|
|
|
override fun onViewCreated(view: View, savedInstanceState: Bundle?) { |
|
|
@ -95,7 +93,7 @@ class ReadAloudConfigDialog : DialogFragment() { |
|
|
|
|
|
|
|
|
|
|
|
override fun onPreferenceTreeClick(preference: Preference): Boolean { |
|
|
|
override fun onPreferenceTreeClick(preference: Preference): Boolean { |
|
|
|
when (preference.key) { |
|
|
|
when (preference.key) { |
|
|
|
PreferKey.ttsEngine -> showDialogFragment(SpeakEngineDialog()) |
|
|
|
PreferKey.ttsEngine -> showDialogFragment(SpeakEngineDialog(this)) |
|
|
|
} |
|
|
|
} |
|
|
|
return super.onPreferenceTreeClick(preference) |
|
|
|
return super.onPreferenceTreeClick(preference) |
|
|
|
} |
|
|
|
} |
|
|
@ -110,10 +108,7 @@ class ReadAloudConfigDialog : DialogFragment() { |
|
|
|
postEvent(EventBus.MEDIA_BUTTON, false) |
|
|
|
postEvent(EventBus.MEDIA_BUTTON, false) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
PreferKey.ttsEngine -> { |
|
|
|
PreferKey.ttsEngine -> upSpeakEngineSummary() |
|
|
|
upPreferenceSummary(findPreference(key), speakEngineSummary) |
|
|
|
|
|
|
|
ReadAloud.upReadAloudClass() |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -129,5 +124,11 @@ class ReadAloudConfigDialog : DialogFragment() { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
override fun upSpeakEngineSummary() { |
|
|
|
|
|
|
|
upPreferenceSummary( |
|
|
|
|
|
|
|
findPreference(PreferKey.ttsEngine), |
|
|
|
|
|
|
|
speakEngineSummary |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |