Albirew/tachiyomi
Archivé
1
0
Bifurcation 0

Give view pager unique ids, avoiding subtle bugs

Cette révision appartient à :
inorichi 2017-12-04 22:22:35 +01:00
Parent 8bcb14c65d
révision 08baf798aa
6 fichiers modifiés avec 18 ajouts et 16 suppressions

Voir le fichier

@ -138,8 +138,8 @@ class LibraryController(
super.onViewCreated(view)
adapter = LibraryAdapter(this)
view_pager.adapter = adapter
view_pager.pageSelections().skip(1).subscribeUntilDestroy {
library_pager.adapter = adapter
library_pager.pageSelections().skip(1).subscribeUntilDestroy {
preferences.lastUsedCategory().set(it)
activeCategory = it
}
@ -158,7 +158,7 @@ class LibraryController(
override fun onChangeStarted(handler: ControllerChangeHandler, type: ControllerChangeType) {
super.onChangeStarted(handler, type)
if (type.isEnter) {
activity?.tabs?.setupWithViewPager(view_pager)
activity?.tabs?.setupWithViewPager(library_pager)
presenter.subscribeLibrary()
}
}
@ -232,7 +232,7 @@ class LibraryController(
// Get the current active category.
val activeCat = if (adapter.categories.isNotEmpty())
view_pager.currentItem
library_pager.currentItem
else
activeCategory
@ -240,14 +240,14 @@ class LibraryController(
adapter.categories = categories
// Restore active category.
view_pager.setCurrentItem(activeCat, false)
library_pager.setCurrentItem(activeCat, false)
tabsVisibilityRelay.call(categories.size > 1)
// Delay the scroll position to allow the view to be properly measured.
view.post {
if (isAttached) {
activity?.tabs?.setScrollPosition(view_pager.currentItem, 0f, true)
activity?.tabs?.setScrollPosition(library_pager.currentItem, 0f, true)
}
}
@ -292,11 +292,11 @@ class LibraryController(
private fun reattachAdapter() {
val adapter = adapter ?: return
val position = view_pager.currentItem
val position = library_pager.currentItem
adapter.recycle = false
view_pager.adapter = adapter
view_pager.currentItem = position
library_pager.adapter = adapter
library_pager.currentItem = position
adapter.recycle = true
}

Voir le fichier

@ -87,11 +87,11 @@ class MangaController : RxController, TabbedController {
requestPermissionsSafe(arrayOf(WRITE_EXTERNAL_STORAGE), 301)
adapter = MangaDetailAdapter()
view_pager.offscreenPageLimit = 3
view_pager.adapter = adapter
manga_pager.offscreenPageLimit = 3
manga_pager.adapter = adapter
if (!fromCatalogue)
view_pager.currentItem = CHAPTERS_CONTROLLER
manga_pager.currentItem = CHAPTERS_CONTROLLER
}
override fun onDestroyView(view: View) {
@ -102,7 +102,7 @@ class MangaController : RxController, TabbedController {
override fun onChangeStarted(handler: ControllerChangeHandler, type: ControllerChangeType) {
super.onChangeStarted(handler, type)
if (type.isEnter) {
activity?.tabs?.setupWithViewPager(view_pager)
activity?.tabs?.setupWithViewPager(manga_pager)
trackingIconSubscription = trackingIconRelay.subscribe { setTrackingIconInternal(it) }
}
}

Voir le fichier

@ -118,7 +118,7 @@ abstract class PagerReader : BaseReader() {
this.pager = pager.apply {
setLayoutParams(ViewGroup.LayoutParams(MATCH_PARENT, MATCH_PARENT))
setOffscreenPageLimit(1)
setId(R.id.view_pager)
setId(R.id.reader_pager)
setOnChapterBoundariesOutListener(object : OnChapterBoundariesOutListener {
override fun onFirstPageOutEvent() {
readerActivity.requestPreviousChapter()

Voir le fichier

@ -8,7 +8,7 @@
<android.support.v4.view.ViewPager
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/view_pager"/>
android:id="@+id/library_pager"/>
<eu.kanade.tachiyomi.widget.EmptyView
android:id="@+id/empty_view"

Voir le fichier

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.view.ViewPager
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/view_pager"
android:id="@+id/manga_pager"
android:layout_width="match_parent"
android:layout_height="match_parent" />

Voir le fichier

@ -3,4 +3,6 @@
<item name="catalogue_filter_sort_group" type="id"/>
<item name="catalogue_filter_sort_item" type="id"/>
<item name="reader_pager" type="id"/>
</resources>