Binding Remaining Search Controllers and ExtensionDetailsController

This commit is contained in:
Jays2Kings 2021-03-29 23:24:09 -04:00
parent 811d7d3120
commit bd136696b0
3 changed files with 12 additions and 15 deletions

View File

@ -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

View File

@ -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)

View File

@ -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()