mirror of
https://github.com/kiwix/kiwix-android.git
synced 2025-09-27 23:20:58 -04:00
Improved code and optimized imports
This commit is contained in:
parent
f85ead71b2
commit
36c304a64b
@ -117,7 +117,8 @@ class KiwixTextToSpeech internal constructor(
|
|||||||
} else {
|
} else {
|
||||||
tts.language = locale
|
tts.language = locale
|
||||||
if (getFeatures(tts).contains(Engine.KEY_FEATURE_NOT_INSTALLED)) {
|
if (getFeatures(tts).contains(Engine.KEY_FEATURE_NOT_INSTALLED)) {
|
||||||
(context as CoreMainActivity).externalLinkOpener.showTTSLanguageDownloadDialog()
|
val activity = context as CoreMainActivity?
|
||||||
|
activity?.externalLinkOpener?.showTTSLanguageDownloadDialog()
|
||||||
} else if (requestAudioFocus()) {
|
} else if (requestAudioFocus()) {
|
||||||
loadURL(webView)
|
loadURL(webView)
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,7 @@ package org.kiwix.kiwixmobile.core.utils
|
|||||||
|
|
||||||
import android.app.Activity
|
import android.app.Activity
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.speech.tts.TextToSpeech
|
import android.speech.tts.TextToSpeech.Engine.ACTION_INSTALL_TTS_DATA
|
||||||
import org.kiwix.kiwixmobile.core.R
|
import org.kiwix.kiwixmobile.core.R
|
||||||
import org.kiwix.kiwixmobile.core.extensions.toast
|
import org.kiwix.kiwixmobile.core.extensions.toast
|
||||||
import org.kiwix.kiwixmobile.core.utils.dialog.AlertDialogShower
|
import org.kiwix.kiwixmobile.core.utils.dialog.AlertDialogShower
|
||||||
@ -69,7 +69,7 @@ class ExternalLinkOpener @Inject constructor(
|
|||||||
{
|
{
|
||||||
activity.startActivity(
|
activity.startActivity(
|
||||||
Intent().apply {
|
Intent().apply {
|
||||||
action = TextToSpeech.Engine.ACTION_INSTALL_TTS_DATA
|
action = ACTION_INSTALL_TTS_DATA
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user