move "no limit" clipboard history retantion time to the right side

sort of fixes GH-1425 (at least the unclarity about finding the setting)
This commit is contained in:
Helium314 2025-03-22 19:05:24 +01:00
parent a3bada8d25
commit 7228fa06d1
4 changed files with 18 additions and 15 deletions

View file

@ -13,7 +13,7 @@ android {
applicationId = "helium314.keyboard"
minSdk = 21
targetSdk = 34
versionCode = 3001
versionCode = 3002
versionName = "3.0-alpha2"
ndk {
abiFilters.clear()

View file

@ -530,18 +530,21 @@ fun checkVersionUpgrade(context: Context) {
prefs.edit().remove("auto_correction_confidence").putFloat(Settings.PREF_AUTO_CORRECT_THRESHOLD, value).apply()
}
}
if (oldVersion <= 2310) {
listOf(
Settings.PREF_ENABLED_SUBTYPES,
Settings.PREF_SELECTED_SUBTYPE,
Settings.PREF_ADDITIONAL_SUBTYPES
).forEach { key ->
val value = prefs.getString(key, "")!!
if ("bengali," in value) {
prefs.edit().putString(key, value.replace("bengali,", "bengali_inscript,")).apply()
}
if (oldVersion <= 2310) {
listOf(
Settings.PREF_ENABLED_SUBTYPES,
Settings.PREF_SELECTED_SUBTYPE,
Settings.PREF_ADDITIONAL_SUBTYPES
).forEach { key ->
val value = prefs.getString(key, "")!!
if ("bengali," in value) {
prefs.edit().putString(key, value.replace("bengali,", "bengali_inscript,")).apply()
}
}
}
if (oldVersion <= 3001 && prefs.getInt(Settings.PREF_CLIPBOARD_HISTORY_RETENTION_TIME, Defaults.PREF_CLIPBOARD_HISTORY_RETENTION_TIME) <= 0) {
prefs.edit().putInt(Settings.PREF_CLIPBOARD_HISTORY_RETENTION_TIME, 121).apply()
}
}
upgradeToolbarPrefs(prefs)
LayoutUtilsCustom.onLayoutFileChanged() // just to be sure
prefs.edit { putInt(Settings.PREF_VERSION_CODE, BuildConfig.VERSION_CODE) }

View file

@ -120,7 +120,7 @@ class ClipboardHistoryManager(
private fun checkClipRetentionElapsed() {
val mins = latinIME.mSettings.current.mClipboardHistoryRetentionTime
if (mins <= 0) return // No retention limit
if (mins > 120) return // No retention limit, changed from <= 0 because we want it to be larger than all other choices
val maxClipRetentionTime = mins * 60 * 1000L
val now = System.currentTimeMillis()
historyEntries.removeAll { !it.isPinned && (now - it.timeStamp) > maxClipRetentionTime }

View file

@ -156,10 +156,10 @@ fun createPreferencesSettings(context: Context) = listOf(
key = setting.key,
default = Defaults.PREF_CLIPBOARD_HISTORY_RETENTION_TIME,
description = {
if (it < 0) stringResource(R.string.settings_no_limit)
if (it > 120) stringResource(R.string.settings_no_limit)
else stringResource(R.string.abbreviation_unit_minutes, it.toString())
},
range = -1f..120f,
range = 1f..121f,
)
},
Setting(context, Settings.PREF_VIBRATION_DURATION_SETTINGS, R.string.prefs_keypress_vibration_duration_settings) { setting ->