diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryListController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryListController.kt
index 5f7e5b44b9..6a42204ded 100644
--- a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryListController.kt
+++ b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryListController.kt
@@ -53,6 +53,7 @@ import java.util.Locale
import kotlin.math.abs
import kotlin.math.max
import kotlin.math.min
+import kotlin.math.pow
import kotlin.math.roundToInt
import kotlin.math.sign
@@ -152,10 +153,7 @@ class LibraryListController(bundle: Bundle? = null) : LibraryController(bundle),
bottom_sheet.getGlobalVisibleRect(sheetRect)
view?.getGlobalVisibleRect(recyclerRect)
- if (sheetRect.contains(event.x.toInt(), event.y.toInt()) ||
- !recyclerRect.contains(event.x.toInt(), event.y.toInt())) {
- return
- }
+
if (startPosX == null) {
startPosX = event.rawX
startPosY = event.rawY
@@ -185,8 +183,14 @@ class LibraryListController(bundle: Bundle? = null) : LibraryController(bundle),
prevCategory = newOffsetP
}
}
+ return
}
- else if (event.actionMasked != MotionEvent.ACTION_UP && startPosX != null) {
+ if (startPosX != null && startPosY != null &&
+ (sheetRect.contains(startPosX!!.toInt(), startPosY!!.toInt()) ||
+ !recyclerRect.contains(startPosX!!.toInt(), startPosY!!.toInt()))) {
+ return
+ }
+ if (event.actionMasked != MotionEvent.ACTION_UP && startPosX != null) {
val distance = abs(event.rawX - startPosX!!)
val sign = sign(event.rawX - startPosX!!)
@@ -196,26 +200,21 @@ class LibraryListController(bundle: Bundle? = null) : LibraryController(bundle),
!lockedRecycler) {
lockedRecycler = true
switchingCategories = true
- if ((prevCategory == null && sign > 0) || (nextCategory == null && sign < 0)) {
- recycler_layout.x = 0f
- recycler_layout.alpha = 1f
- return
- }
- else
- recycler.suppressLayout(true)
+ recycler.suppressLayout(true)
}
else if (!lockedRecycler && abs(event.rawY - startPosY!!) > 30) {
lockedY = true
resetRecyclerY()
return
}
- if ((prevCategory == null && sign > 0) || (nextCategory == null && sign < 0)) {
- resetRecyclerY()
- return
- }
if (abs(event.rawY - startPosY!!) <= 30 || recycler.isLayoutSuppressed
|| lockedRecycler) {
- if (distance <= swipeDistance * 1.1f) {
+
+ if ((prevCategory == null && sign > 0) || (nextCategory == null && sign < 0)) {
+ recycler_layout.x = sign * distance.pow(0.6f)
+ recycler_layout.alpha = 1f
+ }
+ else if (distance <= swipeDistance * 1.1f) {
recycler_layout.x = (max(0f, distance - 50f) * sign) / 3
recycler_layout.alpha =
(1f - (distance - (swipeDistance * 0.1f)) / swipeDistance)
@@ -454,6 +453,14 @@ class LibraryListController(bundle: Bundle? = null) : LibraryController(bundle),
headerPosition, (if (headerPosition == 0) 0 else (-28).dpToPx)
+ appbarOffset
)
+ val isCurrentController = router?.backstack?.lastOrNull()?.controller() ==
+ this
+
+ val headerItem = adapter.getItem(headerPosition) as? LibraryHeaderItem
+ if (headerItem != null) {
+ customTitleSpinner.category_title.text = headerItem.category.name
+ if (isCurrentController) setTitle()
+ }
recycler.suppressLayout(false)
}
launchUI {
@@ -790,6 +797,8 @@ class LibraryListController(bundle: Bundle? = null) : LibraryController(bundle),
if (lockedRecycler && abs(x) > 1000f) {
val sign = sign(x).roundToInt()
+ if ((sign < 0 && nextCategory == null) || (sign > 0) && prevCategory == null)
+ return
val distance = recycler_layout.alpha
val speed = max(3000f / abs(x), 0.75f)
Timber.d("Flinged $distance, velo ${abs(x)}, speed $speed")
diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/main/SearchActivity.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/main/SearchActivity.kt
index f3cfb38c4c..2bdb3b4041 100644
--- a/app/src/main/java/eu/kanade/tachiyomi/ui/main/SearchActivity.kt
+++ b/app/src/main/java/eu/kanade/tachiyomi/ui/main/SearchActivity.kt
@@ -47,6 +47,8 @@ class SearchActivity: MainActivity() {
toolbar.navigationIcon = drawerArrow
drawerArrow?.progress = 1f
+ if (to !is SpinnerTitleInterface) toolbar.removeSpinner()
+
if (to is NoToolbarElevationController) {
appbar.disableElevation()
} else {
diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaDetailsPresenter.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaDetailsPresenter.kt
index ae4975432f..08878bf885 100644
--- a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaDetailsPresenter.kt
+++ b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaDetailsPresenter.kt
@@ -98,6 +98,7 @@ class MangaDetailsPresenter(private val controller: MangaDetailsController,
fun fetchChapters() {
launch {
getChapters()
+ refreshTracking()
withContext(Dispatchers.Main) { controller.updateChapters(chapters) }
}
}
diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaHeaderHolder.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaHeaderHolder.kt
index 7fa6f69282..65cf86aae4 100644
--- a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaHeaderHolder.kt
+++ b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaHeaderHolder.kt
@@ -156,7 +156,8 @@ class MangaHeaderHolder(
with(start_reading_button) {
val nextChapter = presenter.getNextUnreadChapter()
- visibleIf(nextChapter != null && !item.isLocked)
+ visibleIf(presenter.chapters.isNotEmpty() && !item.isLocked)
+ isEnabled = (nextChapter != null)
if (nextChapter != null) {
val number = adapter.decimalFormat.format(nextChapter.chapter_number.toDouble())
text = if (nextChapter.chapter_number > 0) resources.getString(
@@ -171,6 +172,9 @@ class MangaHeaderHolder(
)
}
}
+ else {
+ text = resources.getString(R.string.all_caught_up)
+ }
}
val count = presenter.chapters.size
diff --git a/app/src/main/res/color/mtrl_btn_bg_selector.xml b/app/src/main/res/color/mtrl_btn_bg_selector.xml
new file mode 100644
index 0000000000..a802c7b846
--- /dev/null
+++ b/app/src/main/res/color/mtrl_btn_bg_selector.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/color/primary_button_text_color_selector.xml b/app/src/main/res/color/primary_button_text_color_selector.xml
new file mode 100644
index 0000000000..0770047cb9
--- /dev/null
+++ b/app/src/main/res/color/primary_button_text_color_selector.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index a7f4f7e1c3..ef3b3c7e82 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -514,6 +514,7 @@
No description
Mark all chapters as read?
Remove from library
+ All caught up
Start reading
diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml
index e943e0b88d..0342499a8f 100644
--- a/app/src/main/res/values/styles.xml
+++ b/app/src/main/res/values/styles.xml
@@ -247,8 +247,8 @@