Add fastscroller to migration lists

This commit is contained in:
arkon 2020-05-16 12:15:04 -04:00
parent 39e1e11f99
commit b8ffb87f01
2 changed files with 26 additions and 8 deletions

View File

@ -38,9 +38,9 @@ class MigrationController :
super.onViewCreated(view) super.onViewCreated(view)
adapter = FlexibleAdapter(null, this) adapter = FlexibleAdapter(null, this)
binding.migrationRecycler.layoutManager = LinearLayoutManager(view.context) binding.recycler.layoutManager = LinearLayoutManager(view.context)
binding.migrationRecycler.adapter = adapter binding.recycler.adapter = adapter
binding.migrationRecycler.addItemDecoration(SourceDividerItemDecoration(view.context)) binding.recycler.addItemDecoration(SourceDividerItemDecoration(view.context))
} }
override fun onDestroyView(view: View) { override fun onDestroyView(view: View) {
@ -66,14 +66,16 @@ class MigrationController :
title = resources?.getString(R.string.label_migration) title = resources?.getString(R.string.label_migration)
if (adapter !is SourceAdapter) { if (adapter !is SourceAdapter) {
adapter = SourceAdapter(this) adapter = SourceAdapter(this)
binding.migrationRecycler.adapter = adapter binding.recycler.adapter = adapter
adapter?.fastScroller = binding.fastScroller
} }
adapter?.updateDataSet(state.sourcesWithManga) adapter?.updateDataSet(state.sourcesWithManga)
} else { } else {
title = state.selectedSource.toString() title = state.selectedSource.toString()
if (adapter !is MangaAdapter) { if (adapter !is MangaAdapter) {
adapter = MangaAdapter(this) adapter = MangaAdapter(this)
binding.migrationRecycler.adapter = adapter binding.recycler.adapter = adapter
adapter?.fastScroller = binding.fastScroller
} }
adapter?.updateDataSet(state.mangaForSource) adapter?.updateDataSet(state.mangaForSource)
} }

View File

@ -1,5 +1,21 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<androidx.recyclerview.widget.RecyclerView xmlns:android="http://schemas.android.com/apk/res/android" <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/migration_recycler" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" /> android:layout_height="wrap_content">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recycler"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<eu.kanade.tachiyomi.ui.library.MaterialFastScroll
android:id="@+id/fast_scroller"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="end"
app:fastScrollerBubbleEnabled="false"
tools:visibility="visible" />
</FrameLayout>