File tree Expand file tree Collapse file tree 1 file changed +21
-6
lines changed
app/src/main/kotlin/com/njlabs/showjava/utils Expand file tree Collapse file tree 1 file changed +21
-6
lines changed Original file line number Diff line number Diff line change @@ -63,16 +63,31 @@ class UserPreferences(private val prefs: SharedPreferences) {
6363 get() = prefs.getBoolean(" showSystemApps" , DEFAULTS .SHOW_SYSTEM_APPS )
6464
6565 val chunkSize: Int
66- get() = prefs.getString(" chunkSize" , DEFAULTS .CHUNK_SIZE .toString().trim())?.toInt()
67- ? : DEFAULTS .CHUNK_SIZE
66+ get() = try {
67+ prefs.getString(" chunkSize" , DEFAULTS .CHUNK_SIZE .toString())?.trim()?.toInt()
68+ ? : DEFAULTS .CHUNK_SIZE
69+ } catch (ignored: Exception ) {
70+ DEFAULTS .CHUNK_SIZE
71+ }
6872
6973 val maxAttempts: Int
70- get() = prefs.getString(" maxAttempts" , DEFAULTS .MAX_ATTEMPTS .toString().trim())?.toInt()
71- ? : DEFAULTS .MAX_ATTEMPTS
74+ get() = try {
75+ prefs.getString(" maxAttempts" , DEFAULTS .MAX_ATTEMPTS .toString())?.trim()?.toInt()
76+ ? : DEFAULTS .MAX_ATTEMPTS
77+ } catch (ignored: Exception ) {
78+ DEFAULTS .MAX_ATTEMPTS
79+ }
7280
7381 val memoryThreshold: Int
74- get() = prefs.getString(" memoryThreshold" , DEFAULTS .MEMORY_THRESHOLD .toString().trim())?.toInt()
75- ? : DEFAULTS .MEMORY_THRESHOLD
82+ get() = try {
83+ prefs.getString(
84+ " memoryThreshold" ,
85+ DEFAULTS .MEMORY_THRESHOLD .toString()
86+ )?.trim()?.toInt()
87+ ? : DEFAULTS .MEMORY_THRESHOLD
88+ } catch (ignored: Exception ) {
89+ DEFAULTS .MEMORY_THRESHOLD
90+ }
7691
7792 val consentStatus: Int
7893 get() = prefs.getInt(" consentStatus" , ConsentStatus .UNKNOWN .ordinal)
You can’t perform that action at this time.
0 commit comments