More FlowPreferences migrations

This commit is contained in:
arkon
2020-04-17 18:30:05 -04:00
parent beb81b657e
commit 401210da44
26 changed files with 42 additions and 86 deletions
@@ -7,7 +7,6 @@ import androidx.appcompat.app.AppCompatActivity
import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.data.preference.PreferenceValues as Values
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
import eu.kanade.tachiyomi.data.preference.getOrDefault
import eu.kanade.tachiyomi.ui.security.SecureActivityDelegate
import eu.kanade.tachiyomi.util.system.LocaleHelper
import uy.kohesive.injekt.injectLazy
@@ -20,7 +19,7 @@ abstract class BaseActivity : AppCompatActivity() {
private val secureActivityDelegate = SecureActivityDelegate(this)
private val lightTheme: Int by lazy {
when (preferences.themeLight()) {
when (preferences.themeLight().get()) {
Values.THEME_LIGHT_BLUE -> R.style.Theme_Tachiyomi_LightBlue
else -> {
when {
@@ -42,7 +41,7 @@ abstract class BaseActivity : AppCompatActivity() {
}
private val darkTheme: Int by lazy {
when (preferences.themeDark()) {
when (preferences.themeDark().get()) {
Values.THEME_DARK_BLUE -> R.style.Theme_Tachiyomi_DarkBlue
Values.THEME_DARK_AMOLED -> R.style.Theme_Tachiyomi_Amoled
else -> R.style.Theme_Tachiyomi_Dark
@@ -55,7 +54,7 @@ abstract class BaseActivity : AppCompatActivity() {
}
override fun onCreate(savedInstanceState: Bundle?) {
setTheme(when (preferences.themeMode().getOrDefault()) {
setTheme(when (preferences.themeMode().get()) {
Values.THEME_MODE_SYSTEM -> {
if (resources.configuration.uiMode and Configuration.UI_MODE_NIGHT_MASK == Configuration.UI_MODE_NIGHT_YES) {
darkTheme
@@ -12,6 +12,8 @@ import com.bluelinelabs.conductor.ControllerChangeType
import com.bluelinelabs.conductor.RestoreViewOnCreateController
import kotlinx.android.extensions.LayoutContainer
import kotlinx.android.synthetic.clearFindViewByIdCache
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import timber.log.Timber
abstract class BaseController(bundle: Bundle? = null) : RestoreViewOnCreateController(bundle),
@@ -41,6 +43,8 @@ abstract class BaseController(bundle: Bundle? = null) : RestoreViewOnCreateContr
})
}
val uiScope = CoroutineScope(Dispatchers.Main)
override val containerView: View?
get() = view
@@ -9,6 +9,8 @@ import com.bluelinelabs.conductor.RestoreViewOnCreateController
import com.bluelinelabs.conductor.Router
import com.bluelinelabs.conductor.RouterTransaction
import com.bluelinelabs.conductor.changehandler.SimpleSwapChangeHandler
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
/**
* A controller that displays a dialog window, floating on top of its activity's window.
@@ -24,6 +26,8 @@ abstract class DialogController : RestoreViewOnCreateController {
private var dismissed = false
val uiScope = CoroutineScope(Dispatchers.Main)
/**
* Convenience constructor for use when no arguments are needed.
*/