@@ -31,7 +31,10 @@ class AppPrefs(
31
31
* The type is automatically derived from the given [default] value.
32
32
* @return The value for [key] or [default].
33
33
*/
34
- private inline fun <reified T > getPref (key : String , default : T ): T {
34
+ private inline fun <reified T > getPref (
35
+ key : String ,
36
+ default : T ,
37
+ ): T {
35
38
return when {
36
39
false is T -> {
37
40
shared.getBoolean(key, default as Boolean ) as T
@@ -53,7 +56,10 @@ class AppPrefs(
53
56
* Sets the [value] for [key] in the shared preferences, puts the value into the corresponding
54
57
* cache and returns it.
55
58
*/
56
- private inline fun <reified T > setPref (key : String , value : T ) {
59
+ private inline fun <reified T > setPref (
60
+ key : String ,
61
+ value : T ,
62
+ ) {
57
63
when {
58
64
false is T -> {
59
65
shared.edit().putBoolean(key, value as Boolean ).apply ()
@@ -114,6 +120,7 @@ class AppPrefs(
114
120
const val PID = " general__pid"
115
121
const val LAST_BUILD_GIT_HASH = " general__last_build_git_hash"
116
122
}
123
+
117
124
var lastVersionName: String
118
125
get() = prefs.getPref(LAST_VERSION_NAME , " " )
119
126
set(v) = prefs.setPref(LAST_VERSION_NAME , v)
@@ -173,6 +180,7 @@ class AppPrefs(
173
180
const val DELETE_CANDIDATE_TIMEOUT = " keyboard__key_delete_candidate_timeout"
174
181
const val SHOULD_LONG_CLICK_DELETE_CANDIDATE = " keyboard__long_click_delete_candidate"
175
182
}
183
+
176
184
var inlinePreedit: InlineModeType
177
185
get() = InlineModeType .fromString(prefs.getPref(INLINE_PREEDIT_MODE , " preview" ))
178
186
set(v) = prefs.setPref(INLINE_PREEDIT_MODE , v)
@@ -298,6 +306,7 @@ class AppPrefs(
298
306
const val AUTO_DARK = " theme_auto_dark"
299
307
const val USE_MINI_KEYBOARD = " theme_use_mini_keyboard"
300
308
}
309
+
301
310
var selectedTheme: String
302
311
get() = prefs.getPref(SELECTED_THEME , " trime" )
303
312
set(v) = prefs.setPref(SELECTED_THEME , v)
@@ -326,6 +335,7 @@ class AppPrefs(
326
335
const val LAST_BACKGROUND_SYNC = " profile_last_background_sync"
327
336
val EXTERNAL_PATH_PREFIX : String = PathUtils .getExternalStoragePath()
328
337
}
338
+
329
339
var sharedDataDir: String
330
340
get() = prefs.getPref(SHARED_DATA_DIR , " $EXTERNAL_PATH_PREFIX /rime" )
331
341
set(v) = prefs.setPref(SHARED_DATA_DIR , v)
@@ -358,6 +368,7 @@ class AppPrefs(
358
368
const val DRAFT_LIMIT = " clipboard_draft_limit"
359
369
const val CLIPBOARD_LIMIT = " clipboard_clipboard_limit"
360
370
}
371
+
361
372
var clipboardCompareRules: List <String >
362
373
get() = prefs.getPref(CLIPBOARD_COMPARE_RULES , " " ).trim().split(' \n ' )
363
374
set(v) = prefs.setPref(CLIPBOARD_COMPARE_RULES , v.joinToString(" \n " ))
@@ -388,6 +399,7 @@ class AppPrefs(
388
399
const val SHOW_STATUS_BAR_ICON = " other__show_status_bar_icon"
389
400
const val DESTROY_ON_QUIT = " other__destroy_on_quit"
390
401
}
402
+
391
403
var uiMode: String
392
404
get() = prefs.getPref(UI_MODE , " auto" )
393
405
set(v) = prefs.setPref(UI_MODE , v)
0 commit comments