Toggle about section when tapping on header/empty space

(cherry picked from commit d7a70b962b28160b524d69c6767c6624079bf0b4)
This commit is contained in:
arkon 2020-07-17 16:29:59 -04:00 committed by Jobobby04
parent 29ad0e091f
commit f66aff9ed7

View File

@ -38,8 +38,10 @@ import exh.util.makeSearchChip
import exh.util.setChipsExtended import exh.util.setChipsExtended
import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.Job import kotlinx.coroutines.Job
import kotlinx.coroutines.flow.launchIn import kotlinx.coroutines.flow.launchIn
import kotlinx.coroutines.flow.merge
import kotlinx.coroutines.flow.onEach import kotlinx.coroutines.flow.onEach
import reactivecircus.flowbinding.android.view.clicks import reactivecircus.flowbinding.android.view.clicks
import reactivecircus.flowbinding.android.view.longClicks import reactivecircus.flowbinding.android.view.longClicks
@ -249,6 +251,7 @@ class MangaInfoHeaderAdapter(
* @param manga manga object containing information about manga. * @param manga manga object containing information about manga.
* @param source the source of the manga. * @param source the source of the manga.
*/ */
@ExperimentalCoroutinesApi
private fun setMangaInfo(manga: Manga, source: Source?) { private fun setMangaInfo(manga: Manga, source: Source?) {
// Update full title TextView. // Update full title TextView.
binding.mangaFullTitle.text = if (manga.title.isBlank()) { binding.mangaFullTitle.text = if (manga.title.isBlank()) {
@ -349,10 +352,7 @@ class MangaInfoHeaderAdapter(
} }
// Handle showing more or less info // Handle showing more or less info
binding.mangaSummary.clicks() merge(view.clicks(), binding.mangaSummary.clicks(), binding.mangaInfoToggle.clicks())
.onEach { toggleMangaInfo(view.context) }
.launchIn(scope)
binding.mangaInfoToggle.clicks()
.onEach { toggleMangaInfo(view.context) } .onEach { toggleMangaInfo(view.context) }
.launchIn(scope) .launchIn(scope)