From 95ca7b23d39a6aef084f8412c84beaefd25c4318 Mon Sep 17 00:00:00 2001 From: tarsin Date: Fri, 17 Mar 2023 21:28:13 +0800 Subject: [PATCH] Restore click tip to refresh --- .../ehviewer/ui/scene/GalleryDetailScene.kt | 25 +++++-------------- 1 file changed, 6 insertions(+), 19 deletions(-) diff --git a/app/src/main/java/com/hippo/ehviewer/ui/scene/GalleryDetailScene.kt b/app/src/main/java/com/hippo/ehviewer/ui/scene/GalleryDetailScene.kt index 7a6ee2ab7..56573a709 100755 --- a/app/src/main/java/com/hippo/ehviewer/ui/scene/GalleryDetailScene.kt +++ b/app/src/main/java/com/hippo/ehviewer/ui/scene/GalleryDetailScene.kt @@ -16,6 +16,7 @@ package com.hippo.ehviewer.ui.scene import android.Manifest +import android.annotation.SuppressLint import android.app.Activity import android.app.Dialog import android.app.DownloadManager @@ -37,6 +38,7 @@ import android.widget.ListView import android.widget.TextView import androidx.activity.result.contract.ActivityResultContracts import androidx.annotation.StringRes +import androidx.compose.foundation.clickable import androidx.compose.foundation.combinedClickable import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Box @@ -341,7 +343,7 @@ class GalleryDetailScene : BaseScene(), DownloadInfoListener { } private fun actionRefresh() { - if (composeBindingGD == null) return + if (composeBindingGD == null && getDetailError == "") return getDetailError = "" composeBindingGD = null request() @@ -462,7 +464,8 @@ class GalleryDetailScene : BaseScene(), DownloadInfoListener { ) { Icon( painter = painterResource(id = R.drawable.big_sad_pandroid), - contentDescription = null + contentDescription = null, + modifier = Modifier.clickable(onClick = ::actionRefresh) ) Spacer(modifier = Modifier.size(8.dp)) Text(text = getDetailError) @@ -1063,6 +1066,7 @@ class GalleryDetailScene : BaseScene(), DownloadInfoListener { navigate(R.id.galleryCommentsScene, args) } + @SuppressLint("InflateParams") @Composable private fun GalleryDetailComment(commentsList: Array?) { val maxShowCount = 2 @@ -1200,23 +1204,6 @@ class GalleryDetailScene : BaseScene(), DownloadInfoListener { helper.setDialog(dialog, galleryDetail.rating) } - fun onClick(v: View) { - /* - val context = context - val activity = mainActivity - if (null == context || null == activity) { - return - } - if (binding.tip === v) { - if (request()) { - adjustViewVisibility(STATE_REFRESH) - } - return - } - - */ - } - private fun showFilterTagDialog(tag: String) { val context = context ?: return BaseDialogBuilder(context)