Fix crash when returning to theme selector

This commit is contained in:
Moez Bhatti
2018-07-31 00:16:52 -04:00
parent 54facab486
commit e0e50c98f3
6 changed files with 41 additions and 25 deletions
@@ -67,12 +67,7 @@ class SettingsController : QkController<SettingsView, SettingsState, SettingsPre
.subscribe { activity?.recreate() }
}
override fun onAttach(view: View) {
super.onAttach(view)
presenter.bindIntents(this)
setTitle(R.string.title_settings)
showBackButton(true)
override fun onViewCreated() {
preferences.postDelayed({ preferences.animateLayoutChanges = true }, 100)
nightModeDialog.adapter.setData(R.array.night_modes)
@@ -83,6 +78,13 @@ class SettingsController : QkController<SettingsView, SettingsState, SettingsPre
about.summary = context.getString(R.string.settings_version, BuildConfig.VERSION_NAME)
}
override fun onAttach(view: View) {
super.onAttach(view)
presenter.bindIntents(this)
setTitle(R.string.title_settings)
showBackButton(true)
}
override fun preferenceClicks(): Observable<PreferenceView> = (0 until preferences.childCount)
.map { index -> preferences.getChildAt(index) }
.mapNotNull { view -> view as? PreferenceView }
@@ -20,13 +20,15 @@ class AboutController : QkController<AboutView, Unit, AboutPresenter>(), AboutVi
layoutRes = R.layout.about_controller
}
override fun onViewCreated() {
version.summary = BuildConfig.VERSION_NAME
}
override fun onAttach(view: View) {
super.onAttach(view)
presenter.bindIntents(this)
setTitle(R.string.about_title)
showBackButton(true)
version.summary = BuildConfig.VERSION_NAME
}
override fun preferenceClicks(): Observable<PreferenceView> = (0 until preferences.childCount)
@@ -54,12 +54,7 @@ class SwipeActionsController : QkController<SwipeActionsView, SwipeActionsState,
actionsDialog.adapter.setData(R.array.settings_swipe_actions)
}
override fun onAttach(view: View) {
super.onAttach(view)
presenter.bindIntents(this)
setTitle(R.string.settings_swipe_actions)
showBackButton(true)
override fun onViewCreated() {
colors.theme().let { theme ->
rightIcon.setBackgroundTint(theme.theme)
rightIcon.setTint(theme.textPrimary)
@@ -77,6 +72,13 @@ class SwipeActionsController : QkController<SwipeActionsView, SwipeActionsState,
.subscribe(actionClicks)
}
override fun onAttach(view: View) {
super.onAttach(view)
presenter.bindIntents(this)
setTitle(R.string.settings_swipe_actions)
showBackButton(true)
}
override fun actionClicks(): Observable<SwipeActionsView.Action> = actionClicks
override fun actionSelected(): Observable<Int> = actionsDialog.adapter.menuItemClicks