0
0
mirror of https://github.com/ankidroid/Anki-Android.git synced 2024-09-20 12:02:16 +02:00

fixed the crash that occured due to getResources() error (#13086)

This commit is contained in:
Ashish Yadav 2023-03-06 22:10:47 +05:30 committed by GitHub
parent d6bbea76da
commit 385afba7a5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 2 deletions

View File

@ -408,6 +408,9 @@ open class DeckPicker :
// Then set theme and content view
super.onCreate(savedInstanceState)
asyncMessageContent = resources.getString(R.string.import_interrupted)
asyncMessageTitle = resources.getString(R.string.import_title)
// handle the first load: display the app introduction
if (!hasShownAppIntro()) {
val appIntro = Intent(this, IntroductionActivity::class.java)
@ -2463,6 +2466,13 @@ open class DeckPicker :
}
companion object {
/** Import Error variable so to access the resource directory without
* causing a crash
*/
lateinit var asyncMessageContent: String
lateinit var asyncMessageTitle: String
/**
* Result codes from other activities
*/

View File

@ -18,6 +18,8 @@ package com.ichi2.anki.dialogs
import android.os.Bundle
import com.afollestad.materialdialogs.MaterialDialog
import com.ichi2.anki.DeckPicker.Companion.asyncMessageContent
import com.ichi2.anki.DeckPicker.Companion.asyncMessageTitle
import com.ichi2.anki.R
import timber.log.Timber
import java.net.URLDecoder
@ -78,12 +80,12 @@ class ImportDialog : AsyncDialogFragment() {
override val notificationMessage: String
get() {
return resources.getString(R.string.import_interrupted)
return asyncMessageContent
}
override val notificationTitle: String
get() {
return resources.getString(R.string.import_title)
return asyncMessageTitle
}
fun dismissAllDialogFragments() {