mirror of
https://github.com/YTVanced/VancedManager
synced 2025-01-03 06:01:03 +00:00
added a fallback for empty language list
This commit is contained in:
parent
c5f4f7a609
commit
6c0bc4e1ea
2 changed files with 13 additions and 4 deletions
|
@ -4,6 +4,7 @@ import android.content.Context
|
|||
import android.os.Bundle
|
||||
import android.view.LayoutInflater
|
||||
import android.view.ViewGroup
|
||||
import androidx.core.content.edit
|
||||
import com.vanced.manager.R
|
||||
import com.vanced.manager.core.ui.base.BindingBottomSheetDialogFragment
|
||||
import com.vanced.manager.core.ui.ext.showDialog
|
||||
|
@ -67,6 +68,14 @@ class VancedPreferencesDialog : BindingBottomSheetDialogFragment<DialogVancedPre
|
|||
showDialog(VancedLanguageSelectionDialog())
|
||||
}
|
||||
vancedInstall.setOnClickListener {
|
||||
if (showLang.isEmpty()) {
|
||||
with("en") en@ {
|
||||
showLang.add(this)
|
||||
installPrefs.edit {
|
||||
putString("lang", this@en)
|
||||
}
|
||||
}
|
||||
}
|
||||
dismiss()
|
||||
showDialog(
|
||||
AppDownloadDialog.newInstance(
|
||||
|
|
|
@ -21,8 +21,8 @@ object LanguageHelper {
|
|||
language == "System Default" -> context.getString(R.string.system_default)
|
||||
language.length > 2 -> {
|
||||
val loc = Locale(
|
||||
language.substring(0, language.length - 3),
|
||||
language.substring(language.length - 2)
|
||||
language.substring(0, language.length - 3),
|
||||
language.substring(language.length - 2)
|
||||
)
|
||||
loc.getDisplayName(loc).capitalize(Locale.ENGLISH)
|
||||
}
|
||||
|
@ -62,8 +62,8 @@ object LanguageHelper {
|
|||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
if (!Settings.canDrawOverlays(this)) {
|
||||
val intent = Intent(
|
||||
Settings.ACTION_MANAGE_OVERLAY_PERMISSION,
|
||||
Uri.parse("package:$packageName")
|
||||
Settings.ACTION_MANAGE_OVERLAY_PERMISSION,
|
||||
Uri.parse("package:$packageName")
|
||||
)
|
||||
startActivityForResult(intent, 69)
|
||||
return
|
||||
|
|
Loading…
Reference in a new issue