diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/chapter/base/BaseChaptersAdapter.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/chapter/base/BaseChaptersAdapter.kt index a4f7300ac..826ab2a05 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/chapter/base/BaseChaptersAdapter.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/chapter/base/BaseChaptersAdapter.kt @@ -4,8 +4,9 @@ import eu.davidea.flexibleadapter.FlexibleAdapter import eu.davidea.flexibleadapter.items.IFlexible abstract class BaseChaptersAdapter>( - controller: OnChapterClickListener -) : FlexibleAdapter(null, controller, true) { + controller: OnChapterClickListener, + items: List? = null, +) : FlexibleAdapter(items, controller, true) { /** * Listener for browse item clicks. diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/recent/updates/UpdatesAdapter.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/recent/updates/UpdatesAdapter.kt index 639b6bac3..70b131225 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/recent/updates/UpdatesAdapter.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/recent/updates/UpdatesAdapter.kt @@ -8,8 +8,9 @@ import eu.kanade.tachiyomi.util.system.getResourceColor class UpdatesAdapter( val controller: UpdatesController, - context: Context -) : BaseChaptersAdapter>(controller) { + context: Context, + val items: List>? +) : BaseChaptersAdapter>(controller, items) { var readColor = context.getResourceColor(R.attr.colorOnSurface, 0.38f) var unreadColor = context.getResourceColor(R.attr.colorOnSurface) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/recent/updates/UpdatesController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/recent/updates/UpdatesController.kt index 4b95af529..c2aedebe6 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/recent/updates/UpdatesController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/recent/updates/UpdatesController.kt @@ -6,6 +6,7 @@ import android.view.MenuInflater import android.view.MenuItem import android.view.View import androidx.appcompat.view.ActionMode +import androidx.core.view.isVisible import androidx.recyclerview.widget.LinearLayoutManager import dev.chrisbanes.insetter.applyInsetter import eu.davidea.flexibleadapter.FlexibleAdapter @@ -88,10 +89,6 @@ class UpdatesController : val layoutManager = LinearLayoutManager(view.context) binding.recycler.layoutManager = layoutManager binding.recycler.setHasFixedSize(true) - adapter = UpdatesAdapter(this@UpdatesController, view.context) - binding.recycler.adapter = adapter - adapter?.fastScroller = binding.fastScroller - binding.recycler.scrollStateChanges() .onEach { // Disable swipe refresh when view is not at the top @@ -100,6 +97,7 @@ class UpdatesController : } .launchIn(viewScope) + binding.swipeRefresh.isRefreshing = true binding.swipeRefresh.setDistanceToTriggerSync((2 * 64 * view.resources.displayMetrics.density).toInt()) binding.swipeRefresh.refreshes() .onEach { @@ -212,7 +210,15 @@ class UpdatesController : */ fun onNextRecentChapters(chapters: List>) { destroyActionModeIfNeeded() - adapter?.updateDataSet(chapters) + if (adapter == null) { + adapter = UpdatesAdapter(this@UpdatesController, binding.recycler.context, chapters) + binding.recycler.adapter = adapter + adapter!!.fastScroller = binding.fastScroller + } else { + adapter?.updateDataSet(chapters) + } + binding.swipeRefresh.isRefreshing = false + binding.fastScroller.isVisible = true binding.recycler.onAnimationsFinished { (activity as? MainActivity)?.ready = true } diff --git a/app/src/main/res/layout/updates_controller.xml b/app/src/main/res/layout/updates_controller.xml index 8982a067c..ab95c93e9 100644 --- a/app/src/main/res/layout/updates_controller.xml +++ b/app/src/main/res/layout/updates_controller.xml @@ -24,6 +24,7 @@ android:layout_width="wrap_content" android:layout_height="match_parent" android:layout_gravity="end" + android:visibility="gone" app:fastScrollerBubbleEnabled="false" tools:visibility="visible" />