fix: clean up some warnings
This commit is contained in:
parent
ab7bc15573
commit
1b50ffcf11
32 changed files with 50 additions and 301 deletions
|
@ -1,6 +1,5 @@
|
|||
package ani.dantotsu.settings.paging
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.view.LayoutInflater
|
||||
import android.view.ViewGroup
|
||||
import android.view.animation.LinearInterpolator
|
||||
|
@ -38,7 +37,7 @@ import kotlinx.coroutines.isActive
|
|||
import kotlinx.coroutines.launch
|
||||
import kotlinx.coroutines.withContext
|
||||
|
||||
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
class AnimeExtensionsViewModelFactory(
|
||||
private val animeExtensionManager: AnimeExtensionManager
|
||||
) : ViewModelProvider.Factory {
|
||||
|
@ -49,7 +48,7 @@ class AnimeExtensionsViewModelFactory(
|
|||
|
||||
|
||||
class AnimeExtensionsViewModel(
|
||||
private val animeExtensionManager: AnimeExtensionManager
|
||||
animeExtensionManager: AnimeExtensionManager
|
||||
) : ViewModel() {
|
||||
private val searchQuery = MutableStateFlow("")
|
||||
private var currentPagingSource: AnimeExtensionPagingSource? = null
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package ani.dantotsu.settings.paging
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.view.LayoutInflater
|
||||
import android.view.ViewGroup
|
||||
import android.view.animation.LinearInterpolator
|
||||
|
@ -38,6 +37,7 @@ import kotlinx.coroutines.isActive
|
|||
import kotlinx.coroutines.launch
|
||||
import kotlinx.coroutines.withContext
|
||||
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
class MangaExtensionsViewModelFactory(
|
||||
private val mangaExtensionManager: MangaExtensionManager
|
||||
) : ViewModelProvider.Factory {
|
||||
|
@ -47,7 +47,7 @@ class MangaExtensionsViewModelFactory(
|
|||
}
|
||||
|
||||
class MangaExtensionsViewModel(
|
||||
private val mangaExtensionManager: MangaExtensionManager
|
||||
mangaExtensionManager: MangaExtensionManager
|
||||
) : ViewModel() {
|
||||
private val searchQuery = MutableStateFlow("")
|
||||
private var currentPagingSource: MangaExtensionPagingSource? = null
|
||||
|
|
|
@ -97,7 +97,6 @@ class NovelExtensionPagingSource(
|
|||
val availableExtensions =
|
||||
availableExtensionsFlow.filterNot { it.pkgName in installedExtensions }
|
||||
val query = searchQuery
|
||||
val isNsfwEnabled: Boolean = PrefManager.getVal(PrefName.NSFWExtension)
|
||||
val filteredExtensions = if (query.isEmpty()) {
|
||||
availableExtensions
|
||||
} else {
|
||||
|
|
|
@ -10,7 +10,7 @@ abstract class SharedPreferenceLiveData<T>(
|
|||
) : LiveData<T>() {
|
||||
|
||||
private val preferenceChangeListener =
|
||||
SharedPreferences.OnSharedPreferenceChangeListener { sharedPreferences, key ->
|
||||
SharedPreferences.OnSharedPreferenceChangeListener { _, key ->
|
||||
if (key == this.key) {
|
||||
value = getValueFromPreferences(key, defValue)
|
||||
}
|
||||
|
@ -78,9 +78,11 @@ class SharedPreferenceStringSetLiveData(
|
|||
sharedPrefs.getStringSet(key, defValue)?.toSet() ?: defValue
|
||||
}
|
||||
|
||||
@Suppress("unused")
|
||||
fun SharedPreferences.intLiveData(key: String, defValue: Int): SharedPreferenceLiveData<Int> {
|
||||
return SharedPreferenceIntLiveData(this, key, defValue)
|
||||
}
|
||||
@Suppress("unused")
|
||||
|
||||
fun SharedPreferences.stringLiveData(
|
||||
key: String,
|
||||
|
@ -89,6 +91,7 @@ fun SharedPreferences.stringLiveData(
|
|||
return SharedPreferenceStringLiveData(this, key, defValue)
|
||||
}
|
||||
|
||||
@Suppress("unused")
|
||||
fun SharedPreferences.booleanLiveData(
|
||||
key: String,
|
||||
defValue: Boolean
|
||||
|
@ -96,14 +99,17 @@ fun SharedPreferences.booleanLiveData(
|
|||
return SharedPreferenceBooleanLiveData(this, key, defValue)
|
||||
}
|
||||
|
||||
@Suppress("unused")
|
||||
fun SharedPreferences.floatLiveData(key: String, defValue: Float): SharedPreferenceLiveData<Float> {
|
||||
return SharedPreferenceFloatLiveData(this, key, defValue)
|
||||
}
|
||||
|
||||
@Suppress("unused")
|
||||
fun SharedPreferences.longLiveData(key: String, defValue: Long): SharedPreferenceLiveData<Long> {
|
||||
return SharedPreferenceLongLiveData(this, key, defValue)
|
||||
}
|
||||
|
||||
@Suppress("unused")
|
||||
fun SharedPreferences.stringSetLiveData(
|
||||
key: String,
|
||||
defValue: Set<String>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue