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 a59015a15..57f4942ba 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 @@ -35,10 +35,10 @@ import android.widget.ArrayAdapter import androidx.activity.result.contract.ActivityResultContracts import androidx.annotation.StringRes import androidx.compose.foundation.clickable +import androidx.compose.foundation.horizontalScroll import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Column -import androidx.compose.foundation.layout.FlowRow import androidx.compose.foundation.layout.PaddingValues import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.Spacer @@ -53,13 +53,14 @@ import androidx.compose.foundation.lazy.grid.GridItemSpan import androidx.compose.foundation.lazy.grid.LazyGridScope import androidx.compose.foundation.lazy.grid.LazyVerticalGrid import androidx.compose.foundation.lazy.grid.items +import androidx.compose.foundation.rememberScrollState import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.material.icons.Icons import androidx.compose.material.icons.filled.ArrowBack -import androidx.compose.material.icons.filled.CloudDone -import androidx.compose.material.icons.filled.Difference +import androidx.compose.material.icons.filled.FolderZip import androidx.compose.material.icons.filled.ImageSearch import androidx.compose.material.icons.filled.MoreVert +import androidx.compose.material.icons.filled.Search import androidx.compose.material.icons.filled.Share import androidx.compose.material.icons.filled.SwapVerticalCircle import androidx.compose.material3.Button @@ -69,6 +70,7 @@ import androidx.compose.material3.DropdownMenuItem import androidx.compose.material3.FilledTonalButton import androidx.compose.material3.Icon import androidx.compose.material3.IconButton +import androidx.compose.material3.IconToggleButton import androidx.compose.material3.LargeTopAppBar import androidx.compose.material3.Scaffold import androidx.compose.material3.Surface @@ -93,6 +95,7 @@ import androidx.compose.ui.layout.LocalPinnableContainer import androidx.compose.ui.platform.ComposeView import androidx.compose.ui.res.dimensionResource import androidx.compose.ui.res.stringResource +import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.unit.dp import androidx.compose.ui.viewinterop.AndroidView import androidx.core.content.ContextCompat @@ -156,7 +159,6 @@ import com.hippo.ehviewer.ui.setMD3Content import com.hippo.ehviewer.ui.tools.CrystalCard import com.hippo.ehviewer.ui.tools.DialogState import com.hippo.ehviewer.ui.tools.FilledTertiaryIconButton -import com.hippo.ehviewer.ui.tools.FilledTertiaryIconToggleButton import com.hippo.ehviewer.ui.tools.GalleryDetailRating import com.hippo.ehviewer.util.AppHelper import com.hippo.ehviewer.util.ExceptionUtils @@ -191,7 +193,6 @@ class GalleryDetailScene : BaseScene() { private var downloadButtonText by mutableStateOf("") private var ratingText by mutableStateOf("") private var torrentText by mutableStateOf("") - private var favButtonText by mutableStateOf("") private var getDetailError by mutableStateOf("") private var mTorrentList: TorrentResult? = null @@ -412,6 +413,7 @@ class GalleryDetailScene : BaseScene() { Text( text = EhUtils.getSuitableTitle(it), maxLines = 2, + overflow = TextOverflow.Ellipsis, ) } }, @@ -427,6 +429,27 @@ class GalleryDetailScene : BaseScene() { }, scrollBehavior = scrollBehavior, actions = { + composeBindingGD?.let { galleryDetail -> + val favored by produceState(initialValue = false) { + value = galleryDetail.favoriteSlot != NOT_FAVORITED + FavouriteStatusRouter.stateFlow(galleryDetail.gid).collect { value = it != NOT_FAVORITED } + } + IconToggleButton( + checked = favored, + onCheckedChange = { modifyFavourite() }, + ) { + Icon( + imageVector = getFavoriteIcon(favored), + contentDescription = null, + ) + } + } + IconButton(onClick = ::doShareGallery) { + Icon( + imageVector = Icons.Default.Share, + contentDescription = null, + ) + } var dropdown by remember { mutableStateOf(false) } IconButton(onClick = { dropdown = !dropdown }) { Icon( @@ -660,12 +683,16 @@ class GalleryDetailScene : BaseScene() { @Composable fun EhIconButton( icon: ImageVector, + text: String, onClick: () -> Unit, - ) = FilledTertiaryIconButton(onClick = onClick) { - Icon( - imageVector = icon, - contentDescription = null, - ) + ) = Column(horizontalAlignment = Alignment.CenterHorizontally) { + FilledTertiaryIconButton(onClick = onClick) { + Icon( + imageVector = icon, + contentDescription = null, + ) + } + Text(text = text) } Spacer(modifier = Modifier.size(dimensionResource(id = R.dimen.keyline_margin))) if (galleryDetail.newerVersions.isNotEmpty()) { @@ -680,41 +707,28 @@ class GalleryDetailScene : BaseScene() { } Spacer(modifier = Modifier.size(dimensionResource(id = R.dimen.keyline_margin))) } - FlowRow( - modifier = Modifier.fillMaxWidth(), - horizontalArrangement = Arrangement.Center, + Row( + modifier = Modifier.fillMaxWidth().horizontalScroll(rememberScrollState()), + horizontalArrangement = Arrangement.spacedBy(12.dp, Alignment.CenterHorizontally), ) { - val favored by produceState(initialValue = false) { - value = galleryDetail.favoriteSlot != NOT_FAVORITED - FavouriteStatusRouter.stateFlow(galleryDetail.gid).collect { value = it != NOT_FAVORITED } - } - FilledTertiaryIconToggleButton( - checked = favored, - onCheckedChange = { modifyFavourite() }, - ) { - Icon( - imageVector = getFavoriteIcon(favored), - contentDescription = null, - ) - } EhIconButton( - icon = Icons.Default.Difference, + icon = Icons.Default.Search, + text = stringResource(id = R.string.similar_gallery), onClick = ::showSimilarGalleryList, ) EhIconButton( icon = Icons.Default.ImageSearch, + text = stringResource(id = R.string.search_cover), onClick = ::showCoverGalleryList, ) - EhIconButton( - icon = Icons.Default.Share, - onClick = ::doShareGallery, - ) EhIconButton( icon = Icons.Default.SwapVerticalCircle, + text = torrentText, onClick = ::showTorrentDialog, ) EhIconButton( - icon = Icons.Default.CloudDone, + icon = Icons.Default.FolderZip, + text = stringResource(id = R.string.archive), onClick = ::showArchiveDialog, ) } @@ -861,13 +875,6 @@ class GalleryDetailScene : BaseScene() { galleryDetailUrl?.let { AppHelper.share(requireActivity(), it) } } - private fun updateFavoriteDrawable() { - val gd = composeBindingGD ?: return - lifecycleScope.launchIO { - favButtonText = gd.favoriteName ?: getString(R.string.local_favorites) - } - } - private fun modifyFavourite() { val galleryDetail = composeBindingGD ?: return lifecycleScope.launchIO { @@ -880,9 +887,6 @@ class GalleryDetailScene : BaseScene() { } else { showTip(R.string.add_to_favorite_success, LENGTH_SHORT) } - withUIContext { - onModifyFavoritesSuccess() - } }.onFailure { if (it !is CancellationException) { if (remove) { @@ -892,10 +896,6 @@ class GalleryDetailScene : BaseScene() { } } } - withUIContext { - // Update UI - updateFavoriteDrawable() - } } } } @@ -953,7 +953,6 @@ class GalleryDetailScene : BaseScene() { composeBindingGI = gd.galleryInfo composeBindingGD = gd updateDownloadText() - updateFavoriteDrawable() ratingText = getAllRatingText(gd.rating, gd.ratingCount) torrentText = resources.getString(R.string.torrent_count, gd.torrentCount) } @@ -1249,12 +1248,6 @@ class GalleryDetailScene : BaseScene() { updateDownloadText() } - private fun onModifyFavoritesSuccess() { - if (composeBindingGD != null) { - updateFavoriteDrawable() - } - } - private inner class DeleteDialogHelper( private val mGalleryInfo: GalleryInfo, private val mBuilder: CheckBoxDialogBuilder, diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index 9fd5067a9..1d0d48e70 100755 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -105,6 +105,8 @@ Lesen Teilen Bewerten + Ähnlich + Nach dem Umschlag suchen Kein Etikett Kein Kommentar Keine weiteren Kommentare @@ -309,6 +311,7 @@ Keine Archivdatei Archivdatei wird heruntergeladen Fehler beim Herunterladen der Archivdatei + Archivdateien H@H-Klient ist für das Herunterladen der Archivdateien erforderlich Datenschutzoptionen Screenshot verhindern diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml index 1e77ef9b0..d7cb655e2 100644 --- a/app/src/main/res/values-es/strings.xml +++ b/app/src/main/res/values-es/strings.xml @@ -138,6 +138,8 @@ Torrent (%d) Compartir Valorar + Similar + Buscar portada Sin etiquetas Sin comentarios No hay más comentarios @@ -408,6 +410,7 @@ Cancelar voto negativo Limpiar todo Comentario fallido + Archivo Eliminar Descarga fallida Descarga en pausa diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index 0cb10c2af..1287e2d7e 100755 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -147,6 +147,8 @@ Torrent (%d) Partager Noter + Similaire(s) + Chercher le couverture Aucun tag Aucun commentaire Pas d\'autres commentaires @@ -442,6 +444,7 @@ Aucun fiche archives Téléchargement du fiche archives a commencé Téléchargement du fiche archives a échoué + Fiches archives Client H@H est nécessaire pour le téléchargement de fiches archives Confidentialité Empêcher les captures d\'ecran diff --git a/app/src/main/res/values-ja/strings.xml b/app/src/main/res/values-ja/strings.xml index fab8a68f4..da7c6a9af 100644 --- a/app/src/main/res/values-ja/strings.xml +++ b/app/src/main/res/values-ja/strings.xml @@ -146,6 +146,8 @@ トレント (%d) 共有 評価 + 類似のギャラリー + カバーを検索 タグなし コメントなし コメントはこれ以上ありません @@ -433,6 +435,7 @@ 圧縮パッケージなし 圧縮パッケージのダウンロードを開始しました 圧縮パッケージをダウンロードできませんでした + 圧縮パッケージ 圧縮パッケージのダウンロードにはH@Hクライアントが必要です プライバシー スクリーンキャプチャを防ぐ diff --git a/app/src/main/res/values-ko/strings.xml b/app/src/main/res/values-ko/strings.xml index c7b2c40f6..81d8740fe 100755 --- a/app/src/main/res/values-ko/strings.xml +++ b/app/src/main/res/values-ko/strings.xml @@ -137,6 +137,8 @@ 토렌트 (%d) 공유 평가 + 유사 + 커버 검색 태그 없음 코멘트 없음 코멘트가 더 없음 @@ -406,6 +408,7 @@ 아카이브 없음 아카이브 다운로드가 시작되었습니다. 아카이브 다운로드에 실패했습니다. + 아카이브 아카이브를 다운로드하려면 H@H 클라이언트가 필요합니다. 개인 정보 화면 캡처 허용 안 함 diff --git a/app/src/main/res/values-nb-rNO/strings.xml b/app/src/main/res/values-nb-rNO/strings.xml index e59e93901..711fb4d3b 100644 --- a/app/src/main/res/values-nb-rNO/strings.xml +++ b/app/src/main/res/values-nb-rNO/strings.xml @@ -13,6 +13,7 @@ Nedlastninger Registrering Ugyldig nummer + Lignende Hjemmeside Historikk Abonnement @@ -44,6 +45,7 @@ Søk Bildesøk Normalt søk + Søk i omslag Bildesøk Angi opplaster Angi etikett diff --git a/app/src/main/res/values-th/strings.xml b/app/src/main/res/values-th/strings.xml index 69d6d4855..28e41826e 100644 --- a/app/src/main/res/values-th/strings.xml +++ b/app/src/main/res/values-th/strings.xml @@ -139,6 +139,8 @@ Torrent (%d) แชร์ คะแนน + เหมือน + ค้นหาปก ไม่มีแท็ก ไม่มีความคิดเห็น ไม่มีความเห็นเพิ่มเติมแล้ว @@ -421,6 +423,7 @@ ยังไม่มีไฟล์บีบอัด เริ่มการดาวน์โหลดบีบอัด การดาวน์โหลดไฟล์บีบอัดล้มเหลว + การบีบอัด ต้องการ H@H client เพื่อโหลดไฟล์บีบอัด ความเป็นส่วนตัว ป้องกันการบันทึกภาพหน้าจอ diff --git a/app/src/main/res/values-zh-rCN/strings.xml b/app/src/main/res/values-zh-rCN/strings.xml index 605503cc1..75e39c913 100644 --- a/app/src/main/res/values-zh-rCN/strings.xml +++ b/app/src/main/res/values-zh-rCN/strings.xml @@ -137,6 +137,8 @@ 种子 (%d) 分享 评分 + 相似画廊 + 搜索封面 暂无标签 暂无评论 已显示所有评论 @@ -450,6 +452,7 @@ 没有压缩包 开始下载压缩包 无法下载压缩包 + 压缩包 免费 原始档案 重采样档案 diff --git a/app/src/main/res/values-zh-rHK/strings.xml b/app/src/main/res/values-zh-rHK/strings.xml index a730abebb..48bd4a79d 100755 --- a/app/src/main/res/values-zh-rHK/strings.xml +++ b/app/src/main/res/values-zh-rHK/strings.xml @@ -155,6 +155,8 @@ 種子 (%d) 分享 評分 + 相似畫廊 + 搜索封面 暫無標籤 暫無評論 已顯示所有評論 @@ -462,6 +464,7 @@ 沒有壓縮包 開始下載壓縮包 無法下載壓縮包 + 壓縮包 下載壓縮包需要 H@H 客户端 隱私 不允許荧幕抓取 diff --git a/app/src/main/res/values-zh-rTW/strings.xml b/app/src/main/res/values-zh-rTW/strings.xml index d0817b85d..81b886197 100644 --- a/app/src/main/res/values-zh-rTW/strings.xml +++ b/app/src/main/res/values-zh-rTW/strings.xml @@ -134,6 +134,8 @@ 種子 (%d) 分享 評分 + 類似的圖庫 + 以封面搜尋 還沒有標籤 沒有留言 已顯示所有的留言了 @@ -439,6 +441,7 @@ 沒有壓縮檔 開始下載壓縮檔 下載失敗 + 壓縮檔 免費 原始檔案 重新採樣檔案 diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 9b16486fd..0f92c2f44 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -179,6 +179,8 @@ Torrent (%d) Share Rate + Similar + Search Cover No tags No comments No more comments @@ -515,6 +517,7 @@ No Archives Archive download started Failed to download archive + Archive Free Original archive Resample archive