Improved code and optimized imports

This commit is contained in:
MohitMaliFtechiz 2023-01-21 18:07:05 +05:30 committed by Kelson
parent f85ead71b2
commit 36c304a64b
2 changed files with 4 additions and 3 deletions

View File

@ -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)
} }

View File

@ -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
} }
) )
} }