diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/database/models/Manga.kt b/app/src/main/java/eu/kanade/tachiyomi/data/database/models/Manga.kt index 7e63546f36..e3b07bb95e 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/database/models/Manga.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/database/models/Manga.kt @@ -36,9 +36,9 @@ interface Manga : SManga { chapter_flags = chapter_flags and mask.inv() or (flag and mask) } - fun sortDescending(): Boolean { - return chapter_flags and SORT_MASK == SORT_DESC - } + fun sortDescending(): Boolean = chapter_flags and SORT_MASK == SORT_DESC + + fun usesLocalSort(): Boolean = chapter_flags and SORT_SELF_MASK == SORT_LOCAL fun sortDescending(defaultDesc: Boolean): Boolean { return if (chapter_flags and SORT_SELF_MASK == SORT_GLOBAL) defaultDesc diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaDetailsController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaDetailsController.kt index 77ae47d00b..a132fa3fe0 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaDetailsController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaDetailsController.kt @@ -218,6 +218,7 @@ class MangaDetailsController : BaseController, array.recycle() val offset = 10.dpToPx var statusBarHeight = -1 + swipe_refresh.setDistanceToTriggerSync(70.dpToPx) recycler.doOnApplyWindowInsets { v, insets, _ -> headerHeight = appbarHeight + insets.systemWindowInsetTop 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 973033eaeb..21e4ad0972 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 @@ -3,6 +3,7 @@ package eu.kanade.tachiyomi.ui.manga import android.annotation.SuppressLint import android.content.res.ColorStateList import android.graphics.Color +import android.view.MotionEvent import android.view.View import androidx.constraintlayout.widget.ConstraintLayout import androidx.core.content.ContextCompat @@ -25,6 +26,7 @@ import eu.kanade.tachiyomi.util.view.resetStrokeColor import eu.kanade.tachiyomi.util.view.updateLayoutParams import eu.kanade.tachiyomi.util.view.visible import eu.kanade.tachiyomi.util.view.visibleIf +import kotlinx.android.synthetic.main.manga_details_controller.* import kotlinx.android.synthetic.main.manga_header_item.* import java.util.Locale @@ -41,8 +43,21 @@ class MangaHeaderHolder( } more_button.setOnClickListener { expandDesc() } manga_summary.setOnClickListener { expandDesc() } + manga_summary.setOnLongClickListener { + if (manga_summary.isTextSelectable && !adapter.recyclerView.canScrollVertically(-1)) { + (adapter.delegate as MangaDetailsController).swipe_refresh.isEnabled = false + } + false + } + manga_summary.setOnTouchListener { _, event -> + if (event.actionMasked == MotionEvent.ACTION_UP) + (adapter.delegate as MangaDetailsController).swipe_refresh.isEnabled = true + false + } less_button.setOnClickListener { + manga_summary.setTextIsSelectable(false) manga_summary.maxLines = 3 + manga_summary.setOnClickListener { expandDesc() } manga_genres_tags.gone() less_button.gone() more_button_group.visible() @@ -77,6 +92,7 @@ class MangaHeaderHolder( private fun expandDesc() { if (more_button.visibility == View.VISIBLE) { manga_summary.maxLines = Integer.MAX_VALUE + manga_summary.setTextIsSelectable(true) manga_genres_tags.visible() less_button.visible() more_button_group.gone() diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/chapter/ChaptersSortBottomSheet.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/chapter/ChaptersSortBottomSheet.kt index aa78246a79..ab8602eb8a 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/chapter/ChaptersSortBottomSheet.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/chapter/ChaptersSortBottomSheet.kt @@ -34,7 +34,7 @@ class ChaptersSortBottomSheet(controller: MangaDetailsController) : BottomSheetD sheetBehavior = BottomSheetBehavior.from(view.parent as ViewGroup) setEdgeToEdge(activity, view) val height = activity.window.decorView.rootWindowInsets.systemWindowInsetBottom - sheetBehavior.peekHeight = 380.dpToPx + height + sheetBehavior.peekHeight = 415.dpToPx + height sheetBehavior.addBottomSheetCallback(object : BottomSheetBehavior.BottomSheetCallback() { override fun onSlide(bottomSheet: View, progress: Float) { } @@ -94,10 +94,12 @@ class ChaptersSortBottomSheet(controller: MangaDetailsController) : BottomSheetD sort_method_group.check(if (presenter.manga.sorting == Manga.SORTING_SOURCE) R.id.sort_by_source else R.id.sort_by_number) - set_as_default_sort.visInvisIf(defPref != presenter.manga.sortDescending()) + set_as_default_sort.visInvisIf(defPref != presenter.manga.sortDescending() && + presenter.manga.usesLocalSort()) sort_group.setOnCheckedChangeListener { _, checkedId -> presenter.setSortOrder(checkedId == R.id.sort_newest) - set_as_default_sort.visInvisIf(defPref != presenter.manga.sortDescending()) + set_as_default_sort.visInvisIf(defPref != presenter.manga.sortDescending() && + presenter.manga.usesLocalSort()) } set_as_default_sort.setOnClickListener { diff --git a/app/src/main/res/layout/manga_details_controller.xml b/app/src/main/res/layout/manga_details_controller.xml index aa833d510a..b3fdf262ed 100644 --- a/app/src/main/res/layout/manga_details_controller.xml +++ b/app/src/main/res/layout/manga_details_controller.xml @@ -18,7 +18,6 @@ android:layout_width="match_parent" android:layout_height="match_parent" android:clipToPadding="false" - android:descendantFocusability="blocksDescendants" android:nestedScrollingEnabled="false" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" diff --git a/app/src/main/res/layout/manga_header_item.xml b/app/src/main/res/layout/manga_header_item.xml index 05e38550aa..ed7bfabc58 100644 --- a/app/src/main/res/layout/manga_header_item.xml +++ b/app/src/main/res/layout/manga_header_item.xml @@ -228,7 +228,6 @@ android:clickable="true" android:focusable="true" android:maxLines="3" - android:textIsSelectable="false" app:layout_constraintBottom_toTopOf="@id/manga_genres_tags" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent"