mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-11-14 04:15:09 +01:00
Tapping manga info summary collapses summary
Fixes #673 Co-Authored-By: Carlos <2092019+CarlosEsco@users.noreply.github.com>
This commit is contained in:
parent
434926351c
commit
c50c1f9b10
@ -30,6 +30,7 @@ import eu.kanade.tachiyomi.util.view.visibleIf
|
||||
import kotlinx.android.synthetic.main.manga_details_controller.*
|
||||
import kotlinx.android.synthetic.main.manga_header_item.*
|
||||
|
||||
@SuppressLint("ClickableViewAccessibility")
|
||||
class MangaHeaderHolder(
|
||||
private val view: View,
|
||||
private val adapter: MangaDetailsAdapter,
|
||||
@ -38,6 +39,7 @@ class MangaHeaderHolder(
|
||||
|
||||
private var showReadingButton = true
|
||||
private var showMoreButton = true
|
||||
var hadSelection = false
|
||||
|
||||
init {
|
||||
chapter_layout.setOnClickListener { adapter.delegate.showChapterFilter() }
|
||||
@ -47,7 +49,15 @@ class MangaHeaderHolder(
|
||||
height = adapter.delegate.topCoverHeight()
|
||||
}
|
||||
more_button.setOnClickListener { expandDesc() }
|
||||
manga_summary.setOnClickListener { expandDesc() }
|
||||
manga_summary.setOnClickListener {
|
||||
if (more_button.isVisible()) {
|
||||
expandDesc()
|
||||
} else if (!hadSelection) {
|
||||
collapseDesc()
|
||||
} else {
|
||||
hadSelection = false
|
||||
}
|
||||
}
|
||||
manga_summary.setOnLongClickListener {
|
||||
if (manga_summary.isTextSelectable && !adapter.recyclerView.canScrollVertically(-1)) {
|
||||
(adapter.delegate as MangaDetailsController).swipe_refresh.isEnabled = false
|
||||
@ -55,8 +65,14 @@ class MangaHeaderHolder(
|
||||
false
|
||||
}
|
||||
manga_summary.setOnTouchListener { _, event ->
|
||||
if (event.actionMasked == MotionEvent.ACTION_UP) (adapter.delegate as MangaDetailsController).swipe_refresh.isEnabled =
|
||||
true
|
||||
if (event.action == MotionEvent.ACTION_DOWN) {
|
||||
view.requestFocus()
|
||||
}
|
||||
if (event.actionMasked == MotionEvent.ACTION_UP) {
|
||||
hadSelection = manga_summary.hasSelection()
|
||||
(adapter.delegate as MangaDetailsController).swipe_refresh.isEnabled =
|
||||
true
|
||||
}
|
||||
false
|
||||
}
|
||||
if (!itemView.resources.isLTR) {
|
||||
@ -109,8 +125,8 @@ class MangaHeaderHolder(
|
||||
|
||||
private fun collapseDesc() {
|
||||
manga_summary.setTextIsSelectable(false)
|
||||
manga_summary.isClickable = true
|
||||
manga_summary.maxLines = 3
|
||||
manga_summary.setOnClickListener { expandDesc() }
|
||||
manga_genres_tags.gone()
|
||||
less_button.gone()
|
||||
more_button_group.visible()
|
||||
|
Loading…
Reference in New Issue
Block a user