mirror of
https://github.com/Helium314/HeliBoard.git
synced 2025-04-21 22:59:10 +00:00
a bunch of minor fixes
This commit is contained in:
parent
09803fdf92
commit
8c40d4f3e8
3 changed files with 9 additions and 7 deletions
|
@ -326,10 +326,10 @@ class AdvancedSettingsFragment : SubScreenFragment() {
|
|||
zipStream.closeEntry()
|
||||
}
|
||||
zipStream.putNextEntry(ZipEntry(PREFS_FILE_NAME))
|
||||
settingsToJsonStream2(sharedPreferences.all, zipStream)
|
||||
settingsToJsonStream(sharedPreferences.all, zipStream)
|
||||
zipStream.closeEntry()
|
||||
zipStream.putNextEntry(ZipEntry(PROTECTED_PREFS_FILE_NAME))
|
||||
settingsToJsonStream2(PreferenceManager.getDefaultSharedPreferences(requireContext()).all, zipStream)
|
||||
settingsToJsonStream(PreferenceManager.getDefaultSharedPreferences(requireContext()).all, zipStream)
|
||||
zipStream.closeEntry()
|
||||
zipStream.close()
|
||||
}
|
||||
|
@ -346,12 +346,13 @@ class AdvancedSettingsFragment : SubScreenFragment() {
|
|||
ZipInputStream(inputStream).use { zip ->
|
||||
var entry: ZipEntry? = zip.nextEntry
|
||||
val filesDir = requireContext().filesDir?.path ?: return
|
||||
val deviceProtectedFilesDir = DeviceProtectedUtils.getDeviceProtectedContext(requireContext()).filesDir?.path ?: return
|
||||
while (entry != null) {
|
||||
if (entry.name.startsWith("unprotected${File.separator}")) {
|
||||
val adjustedName = entry.name.substringAfter("unprotected${File.separator}")
|
||||
if (backupFilePatterns.any { adjustedName.matches(it) }) {
|
||||
val targetFileName = upgradeFileNames(adjustedName)
|
||||
val file = File(filesDir, targetFileName)
|
||||
val file = File(deviceProtectedFilesDir, targetFileName)
|
||||
FileUtils.copyStreamToNewFile(zip, file)
|
||||
}
|
||||
} else if (backupFilePatterns.any { entry!!.name.matches(it) }) {
|
||||
|
@ -447,7 +448,7 @@ class AdvancedSettingsFragment : SubScreenFragment() {
|
|||
|
||||
companion object {
|
||||
@Suppress("UNCHECKED_CAST") // it is checked... but whatever (except string set, because can't check for that))
|
||||
private fun settingsToJsonStream2(settings: Map<String, Any?>, out: OutputStream) {
|
||||
private fun settingsToJsonStream(settings: Map<String, Any?>, out: OutputStream) {
|
||||
val booleans = settings.filterValues { it is Boolean } as Map<String, Boolean>
|
||||
val ints = settings.filterValues { it is Int } as Map<String, Int>
|
||||
val longs = settings.filterValues { it is Long } as Map<String, Long>
|
||||
|
|
|
@ -145,7 +145,8 @@ public class UserDictionaryListFragment extends SubScreenFragment {
|
|||
} else {
|
||||
newPref.setTitle(UserDictionarySettings.getLocaleDisplayName(requireContext(), locale));
|
||||
}
|
||||
newPref.getExtras().putString("locale", locale.toLanguageTag());
|
||||
if (locale == UserDictionarySettings.emptyLocale) newPref.getExtras().putString("locale", "");
|
||||
else newPref.getExtras().putString("locale", locale.toLanguageTag());
|
||||
newPref.setIconSpaceReserved(false);
|
||||
newPref.setFragment(UserDictionarySettings.class.getName());
|
||||
|
||||
|
|
|
@ -64,9 +64,9 @@
|
|||
<!-- Option to show shortcut key to emoji palettes -->
|
||||
<string name="show_emoji_key">Emoji key</string>
|
||||
<!-- Units abbreviation for the duration (milliseconds) [CHAR LIMIT=10] -->
|
||||
<string name="abbreviation_unit_milliseconds"><xliff:g id="MILLISECONDS">%s</xliff:g>ms</string>
|
||||
<string name="abbreviation_unit_milliseconds"><xliff:g id="MILLISECONDS">%s</xliff:g> ms</string>
|
||||
<!-- Units abbreviation for the duration (minutes) [CHAR LIMIT=10] -->
|
||||
<string name="abbreviation_unit_minutes"><xliff:g id="MINUTES">%s</xliff:g>min.</string>
|
||||
<string name="abbreviation_unit_minutes"><xliff:g id="MINUTES">%s</xliff:g> min</string>
|
||||
<!-- The text that represents the current settings value is the system default [CHAR LIMIT=25] -->
|
||||
<string name="settings_system_default">System default</string>
|
||||
<!-- The text that represents an unlimited delay [CHAR LIMIT=25] -->
|
||||
|
|
Loading…
Add table
Reference in a new issue