mirror of
https://github.com/Michatec/michas-droid.git
synced 2026-05-31 02:12:42 +02:00
- Refactor code to use idiomatic Kotlin functions like isNullOrEmpty(), associateBy, and appendRange
- Increase `DiffUtil` threshold in `CursorRecyclerAdapter` to 500 and optimize equality checks - Simplify locale configuration by removing legacy Android SDK version checks - Remove unnecessary `@SuppressLint` annotations and `@Volatile` modifiers - Improve performance of collection operations in `ProductFragment` and `Preferences` using `associateBy` and `firstOrNull` - Suppress deprecation warnings for `getOpacity` in `DrawableWrapper` and `TabsFragment` - Clean up service binding logic in `Connection.kt` with better type casting
This commit is contained in:
@@ -16,10 +16,12 @@ object Preferences {
|
||||
|
||||
private val subject = PublishSubject.create<Key<*>>()
|
||||
|
||||
private val keys = sequenceOf(Key.AutoSync, Key.IncompatibleVersions, Key.ProxyHost, Key.ProxyPort, Key.ProxyType,
|
||||
Key.SortOrder, Key.Theme, Key.UpdateNotify, Key.UpdateUnstable).map { Pair(it.name, it) }.toMap()
|
||||
private val keys = sequenceOf(
|
||||
Key.AutoSync, Key.IncompatibleVersions, Key.ProxyHost, Key.ProxyPort, Key.ProxyType,
|
||||
Key.SortOrder, Key.Theme, Key.UpdateNotify, Key.UpdateUnstable
|
||||
).associateBy { it.name }
|
||||
|
||||
private val listener = SharedPreferences.OnSharedPreferenceChangeListener { _, keyString ->
|
||||
private val listener = SharedPreferences.OnSharedPreferenceChangeListener { _, keyString ->
|
||||
keys[keyString]?.let(subject::onNext)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user