From bd136696b0a0ba769b938037dbd735f7fa679661 Mon Sep 17 00:00:00 2001 From: Jays2Kings Date: Mon, 29 Mar 2021 23:24:09 -0400 Subject: [PATCH] Binding Remaining Search Controllers and ExtensionDetailsController --- .../extension/details/ExtensionDetailsController.kt | 11 +++++------ .../ui/setting/search/SettingsSearchController.kt | 7 +++---- .../ui/source/global_search/GlobalSearchController.kt | 9 ++++----- 3 files changed, 12 insertions(+), 15 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/extension/details/ExtensionDetailsController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/extension/details/ExtensionDetailsController.kt index 4fc9c6b20c..1cc5ce9a67 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/extension/details/ExtensionDetailsController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/extension/details/ExtensionDetailsController.kt @@ -46,7 +46,6 @@ import eu.kanade.tachiyomi.util.view.openInBrowser import eu.kanade.tachiyomi.util.view.scrollViewWith import eu.kanade.tachiyomi.util.view.snack import eu.kanade.tachiyomi.widget.preference.ListMatPreference -import kotlinx.android.synthetic.main.extension_detail_controller.* import kotlinx.coroutines.MainScope import kotlinx.coroutines.flow.launchIn import kotlinx.coroutines.flow.onEach @@ -90,7 +89,7 @@ class ExtensionDetailsController(bundle: Bundle? = null) : @SuppressLint("PrivateResource") override fun onViewCreated(view: View) { super.onViewCreated(view) - scrollViewWith(extension_prefs_recycler, padBottom = true) + scrollViewWith(binding.extensionPrefsRecycler, padBottom = true) val extension = presenter.extension ?: return val context = view.context @@ -114,7 +113,7 @@ class ExtensionDetailsController(bundle: Bundle? = null) : manager.setPreferences(screen) - extension_prefs_recycler.layoutManager = + binding.extensionPrefsRecycler.layoutManager = androidx.recyclerview.widget.LinearLayoutManager(context) val concatAdapterConfig = ConcatAdapter.Config.Builder() .setStableIdMode(ConcatAdapter.Config.StableIdMode.ISOLATED_STABLE_IDS) @@ -122,12 +121,12 @@ class ExtensionDetailsController(bundle: Bundle? = null) : screen.setShouldUseGeneratedIds(true) val extHeaderAdapter = ExtensionDetailsHeaderAdapter(presenter) extHeaderAdapter.setHasStableIds(true) - extension_prefs_recycler.adapter = ConcatAdapter( + binding.extensionPrefsRecycler.adapter = ConcatAdapter( concatAdapterConfig, extHeaderAdapter, PreferenceGroupAdapter(screen) ) - extension_prefs_recycler.addItemDecoration(ExtensionSettingsDividerItemDecoration(context)) + binding.extensionPrefsRecycler.addItemDecoration(ExtensionSettingsDividerItemDecoration(context)) } override fun onDestroyView(view: View) { @@ -206,7 +205,7 @@ class ExtensionDetailsController(bundle: Bundle? = null) : prefs.forEach { it.isVisible = checked } true } else { - coordinator.snack(context.getString(R.string._must_be_enabled_first, title), Snackbar.LENGTH_LONG) { + binding.coordinator.snack(context.getString(R.string._must_be_enabled_first, title), Snackbar.LENGTH_LONG) { setAction(R.string.enable) { preferences.enabledLanguages() += source.lang isChecked = true diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/search/SettingsSearchController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/search/SettingsSearchController.kt index 4b69d9aa5e..802fc7c447 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/search/SettingsSearchController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/search/SettingsSearchController.kt @@ -14,7 +14,6 @@ import eu.kanade.tachiyomi.ui.base.controller.NucleusController import eu.kanade.tachiyomi.ui.setting.SettingsController import eu.kanade.tachiyomi.util.view.liftAppbarWith import eu.kanade.tachiyomi.util.view.withFadeTransaction -import kotlinx.android.synthetic.main.settings_search_controller.* /** * This controller shows and manages the different search result in settings search. @@ -109,10 +108,10 @@ class SettingsSearchController : adapter = SettingsSearchAdapter(this) - liftAppbarWith(recycler) + liftAppbarWith(binding.recycler) // Create recycler and set adapter. - recycler.layoutManager = LinearLayoutManager(view.context) - recycler.adapter = adapter + binding.recycler.layoutManager = LinearLayoutManager(view.context) + binding.recycler.adapter = adapter // load all search results SettingsSearchHelper.initPreferenceSearchResultCollection(presenter.preferences.context) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/source/global_search/GlobalSearchController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/source/global_search/GlobalSearchController.kt index 7512f8ca81..1edf1159bb 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/source/global_search/GlobalSearchController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/source/global_search/GlobalSearchController.kt @@ -18,7 +18,6 @@ import eu.kanade.tachiyomi.util.view.activityBinding import eu.kanade.tachiyomi.util.view.scrollViewWith import eu.kanade.tachiyomi.util.view.updatePaddingRelative import eu.kanade.tachiyomi.util.view.withFadeTransaction -import kotlinx.android.synthetic.main.source_global_search_controller.* /** * This controller shows and manages the different search result in global search. @@ -132,15 +131,15 @@ open class GlobalSearchController( super.onViewCreated(view) adapter = GlobalSearchAdapter(this) - recycler.updatePaddingRelative( + binding.recycler.updatePaddingRelative( top = (activityBinding?.toolbar?.height ?: 0) + (activity?.window?.decorView?.rootWindowInsets?.systemWindowInsetTop ?: 0) ) // Create recycler and set adapter. - recycler.layoutManager = androidx.recyclerview.widget.LinearLayoutManager(view.context) - recycler.adapter = adapter - scrollViewWith(recycler, padBottom = true) + binding.recycler.layoutManager = androidx.recyclerview.widget.LinearLayoutManager(view.context) + binding.recycler.adapter = adapter + scrollViewWith(binding.recycler, padBottom = true) if (extensionFilter != null) { customTitle = view.context?.getString(R.string.loading) setTitle()