Skip to content

Commit

Permalink
more crumbs
Browse files Browse the repository at this point in the history
  • Loading branch information
deniscerri committed May 1, 2023
1 parent 8924bdd commit 3101a32
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import android.content.Context.POWER_SERVICE
import android.content.Intent
import android.net.Uri
import android.os.Build
import android.os.Build.VERSION
import android.os.Build.VERSION_CODES
import android.os.Bundle
import android.os.Environment
Expand Down Expand Up @@ -158,14 +159,18 @@ class SettingsFragment : PreferenceFragmentCompat() {
version = findPreference("version")
version!!.summary = BuildConfig.VERSION_NAME

val values = resources.getStringArray(R.array.language_values)
val entries = mutableListOf<String>()
values.forEach {
entries.add(Locale(it).getDisplayName(Locale(it)))
if(VERSION.SDK_INT < VERSION_CODES.TIRAMISU){
val values = resources.getStringArray(R.array.language_values)
val entries = mutableListOf<String>()
values.forEach {
entries.add(Locale(it).getDisplayName(Locale(it)))
}
language!!.entries = entries.toTypedArray()
val lang = if (values.contains(Locale.getDefault().language)) Locale.getDefault().language else "en"
editor.putString("app_language", lang)
}else{
language!!.isVisible = false
}
language!!.entries = entries.toTypedArray()
val lang = if (values.contains(Locale.getDefault().language)) Locale.getDefault().language else "en"
editor.putString("app_language", lang)

val packageName: String = requireContext().packageName
val pm = requireContext().applicationContext.getSystemService(POWER_SERVICE) as PowerManager
Expand Down Expand Up @@ -239,7 +244,6 @@ class SettingsFragment : PreferenceFragmentCompat() {
language!!.summary = Locale(newValue.toString()).getDisplayLanguage(Locale(newValue.toString()))
editor.apply()
AppCompatDelegate.setApplicationLocales(LocaleListCompat.forLanguageTags(newValue.toString()))
if (Build.VERSION.SDK_INT >= VERSION_CODES.TIRAMISU) requireActivity().recreate()
true
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,11 @@ class TerminalDownloadWorker(
}, 1000)
}

outputFile.appendText("${it.out}\n")
if (logDownloads && logFile.exists()){
logFile.appendText("${it.out}\n")
if (it.out.length > 5000){
outputFile.appendText("${it.out}\n")
if (logDownloads && logFile.exists()){
logFile.appendText("${it.out}\n")
}
}
notificationUtil.cancelDownloadNotification(itemId)

Expand Down
3 changes: 3 additions & 0 deletions app/src/main/res/values/arrays.xml
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,12 @@
<item>lv</item>
<item>nb</item>
<item>pl</item>
<item>pt</item>
<item>ru</item>
<item>ro</item>
<item>sq</item>
<item>tr</item>
<item>ta</item>
<item>uk</item>
<item>vi</item>
<item>zh</item>
Expand Down
3 changes: 3 additions & 0 deletions app/src/main/res/xml/locales_config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,12 @@
<locale android:name="lv"/>
<locale android:name="nb-NO"/>
<locale android:name="pl"/>
<locale android:name="pt_BR" />
<locale android:name="ru"/>
<locale android:name="ro_RO"/>
<locale android:name="sq-AL"/>
<locale android:name="tr-TR"/>
<locale android:name="ta_IN"/>
<locale android:name="uk"/>
<locale android:name="vi"/>
<locale android:name="zh-CN"/>
Expand Down

0 comments on commit 3101a32

Please sign in to comment.