Binding Remaining Search Controllers and ExtensionDetailsController
This commit is contained in:
parent
811d7d3120
commit
bd136696b0
@ -46,7 +46,6 @@ import eu.kanade.tachiyomi.util.view.openInBrowser
|
|||||||
import eu.kanade.tachiyomi.util.view.scrollViewWith
|
import eu.kanade.tachiyomi.util.view.scrollViewWith
|
||||||
import eu.kanade.tachiyomi.util.view.snack
|
import eu.kanade.tachiyomi.util.view.snack
|
||||||
import eu.kanade.tachiyomi.widget.preference.ListMatPreference
|
import eu.kanade.tachiyomi.widget.preference.ListMatPreference
|
||||||
import kotlinx.android.synthetic.main.extension_detail_controller.*
|
|
||||||
import kotlinx.coroutines.MainScope
|
import kotlinx.coroutines.MainScope
|
||||||
import kotlinx.coroutines.flow.launchIn
|
import kotlinx.coroutines.flow.launchIn
|
||||||
import kotlinx.coroutines.flow.onEach
|
import kotlinx.coroutines.flow.onEach
|
||||||
@ -90,7 +89,7 @@ class ExtensionDetailsController(bundle: Bundle? = null) :
|
|||||||
@SuppressLint("PrivateResource")
|
@SuppressLint("PrivateResource")
|
||||||
override fun onViewCreated(view: View) {
|
override fun onViewCreated(view: View) {
|
||||||
super.onViewCreated(view)
|
super.onViewCreated(view)
|
||||||
scrollViewWith(extension_prefs_recycler, padBottom = true)
|
scrollViewWith(binding.extensionPrefsRecycler, padBottom = true)
|
||||||
|
|
||||||
val extension = presenter.extension ?: return
|
val extension = presenter.extension ?: return
|
||||||
val context = view.context
|
val context = view.context
|
||||||
@ -114,7 +113,7 @@ class ExtensionDetailsController(bundle: Bundle? = null) :
|
|||||||
|
|
||||||
manager.setPreferences(screen)
|
manager.setPreferences(screen)
|
||||||
|
|
||||||
extension_prefs_recycler.layoutManager =
|
binding.extensionPrefsRecycler.layoutManager =
|
||||||
androidx.recyclerview.widget.LinearLayoutManager(context)
|
androidx.recyclerview.widget.LinearLayoutManager(context)
|
||||||
val concatAdapterConfig = ConcatAdapter.Config.Builder()
|
val concatAdapterConfig = ConcatAdapter.Config.Builder()
|
||||||
.setStableIdMode(ConcatAdapter.Config.StableIdMode.ISOLATED_STABLE_IDS)
|
.setStableIdMode(ConcatAdapter.Config.StableIdMode.ISOLATED_STABLE_IDS)
|
||||||
@ -122,12 +121,12 @@ class ExtensionDetailsController(bundle: Bundle? = null) :
|
|||||||
screen.setShouldUseGeneratedIds(true)
|
screen.setShouldUseGeneratedIds(true)
|
||||||
val extHeaderAdapter = ExtensionDetailsHeaderAdapter(presenter)
|
val extHeaderAdapter = ExtensionDetailsHeaderAdapter(presenter)
|
||||||
extHeaderAdapter.setHasStableIds(true)
|
extHeaderAdapter.setHasStableIds(true)
|
||||||
extension_prefs_recycler.adapter = ConcatAdapter(
|
binding.extensionPrefsRecycler.adapter = ConcatAdapter(
|
||||||
concatAdapterConfig,
|
concatAdapterConfig,
|
||||||
extHeaderAdapter,
|
extHeaderAdapter,
|
||||||
PreferenceGroupAdapter(screen)
|
PreferenceGroupAdapter(screen)
|
||||||
)
|
)
|
||||||
extension_prefs_recycler.addItemDecoration(ExtensionSettingsDividerItemDecoration(context))
|
binding.extensionPrefsRecycler.addItemDecoration(ExtensionSettingsDividerItemDecoration(context))
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onDestroyView(view: View) {
|
override fun onDestroyView(view: View) {
|
||||||
@ -206,7 +205,7 @@ class ExtensionDetailsController(bundle: Bundle? = null) :
|
|||||||
prefs.forEach { it.isVisible = checked }
|
prefs.forEach { it.isVisible = checked }
|
||||||
true
|
true
|
||||||
} else {
|
} 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) {
|
setAction(R.string.enable) {
|
||||||
preferences.enabledLanguages() += source.lang
|
preferences.enabledLanguages() += source.lang
|
||||||
isChecked = true
|
isChecked = true
|
||||||
|
@ -14,7 +14,6 @@ import eu.kanade.tachiyomi.ui.base.controller.NucleusController
|
|||||||
import eu.kanade.tachiyomi.ui.setting.SettingsController
|
import eu.kanade.tachiyomi.ui.setting.SettingsController
|
||||||
import eu.kanade.tachiyomi.util.view.liftAppbarWith
|
import eu.kanade.tachiyomi.util.view.liftAppbarWith
|
||||||
import eu.kanade.tachiyomi.util.view.withFadeTransaction
|
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.
|
* This controller shows and manages the different search result in settings search.
|
||||||
@ -109,10 +108,10 @@ class SettingsSearchController :
|
|||||||
|
|
||||||
adapter = SettingsSearchAdapter(this)
|
adapter = SettingsSearchAdapter(this)
|
||||||
|
|
||||||
liftAppbarWith(recycler)
|
liftAppbarWith(binding.recycler)
|
||||||
// Create recycler and set adapter.
|
// Create recycler and set adapter.
|
||||||
recycler.layoutManager = LinearLayoutManager(view.context)
|
binding.recycler.layoutManager = LinearLayoutManager(view.context)
|
||||||
recycler.adapter = adapter
|
binding.recycler.adapter = adapter
|
||||||
|
|
||||||
// load all search results
|
// load all search results
|
||||||
SettingsSearchHelper.initPreferenceSearchResultCollection(presenter.preferences.context)
|
SettingsSearchHelper.initPreferenceSearchResultCollection(presenter.preferences.context)
|
||||||
|
@ -18,7 +18,6 @@ import eu.kanade.tachiyomi.util.view.activityBinding
|
|||||||
import eu.kanade.tachiyomi.util.view.scrollViewWith
|
import eu.kanade.tachiyomi.util.view.scrollViewWith
|
||||||
import eu.kanade.tachiyomi.util.view.updatePaddingRelative
|
import eu.kanade.tachiyomi.util.view.updatePaddingRelative
|
||||||
import eu.kanade.tachiyomi.util.view.withFadeTransaction
|
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.
|
* This controller shows and manages the different search result in global search.
|
||||||
@ -132,15 +131,15 @@ open class GlobalSearchController(
|
|||||||
super.onViewCreated(view)
|
super.onViewCreated(view)
|
||||||
adapter = GlobalSearchAdapter(this)
|
adapter = GlobalSearchAdapter(this)
|
||||||
|
|
||||||
recycler.updatePaddingRelative(
|
binding.recycler.updatePaddingRelative(
|
||||||
top = (activityBinding?.toolbar?.height ?: 0) +
|
top = (activityBinding?.toolbar?.height ?: 0) +
|
||||||
(activity?.window?.decorView?.rootWindowInsets?.systemWindowInsetTop ?: 0)
|
(activity?.window?.decorView?.rootWindowInsets?.systemWindowInsetTop ?: 0)
|
||||||
)
|
)
|
||||||
|
|
||||||
// Create recycler and set adapter.
|
// Create recycler and set adapter.
|
||||||
recycler.layoutManager = androidx.recyclerview.widget.LinearLayoutManager(view.context)
|
binding.recycler.layoutManager = androidx.recyclerview.widget.LinearLayoutManager(view.context)
|
||||||
recycler.adapter = adapter
|
binding.recycler.adapter = adapter
|
||||||
scrollViewWith(recycler, padBottom = true)
|
scrollViewWith(binding.recycler, padBottom = true)
|
||||||
if (extensionFilter != null) {
|
if (extensionFilter != null) {
|
||||||
customTitle = view.context?.getString(R.string.loading)
|
customTitle = view.context?.getString(R.string.loading)
|
||||||
setTitle()
|
setTitle()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user