From a86ca2e82c4f42cf6a817a8a6acb7f0759bc4486 Mon Sep 17 00:00:00 2001 From: FooIbar <118464521+FooIbar@users.noreply.github.com> Date: Sun, 6 Aug 2023 22:11:54 +0800 Subject: [PATCH] Move favorite button below header --- .../ehviewer/ui/scene/GalleryDetailScene.kt | 47 +++++++++++-------- app/src/main/res/values-de/strings.xml | 1 + app/src/main/res/values-es/strings.xml | 1 + app/src/main/res/values-fr/strings.xml | 1 + app/src/main/res/values-ja/strings.xml | 1 + app/src/main/res/values-ko/strings.xml | 1 + app/src/main/res/values-th/strings.xml | 1 + app/src/main/res/values-zh-rCN/strings.xml | 1 + app/src/main/res/values-zh-rHK/strings.xml | 1 + app/src/main/res/values-zh-rTW/strings.xml | 1 + app/src/main/res/values/strings.xml | 1 + 11 files changed, 37 insertions(+), 20 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 57f4942ba..8d3b081a8 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 @@ -68,9 +68,9 @@ import androidx.compose.material3.CircularProgressIndicator import androidx.compose.material3.DropdownMenu import androidx.compose.material3.DropdownMenuItem import androidx.compose.material3.FilledTonalButton +import androidx.compose.material3.FilledTonalIconToggleButton 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 @@ -429,20 +429,11 @@ 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 = ::showArchiveDialog) { + Icon( + imageVector = Icons.Default.FolderZip, + contentDescription = null, + ) } IconButton(onClick = ::doShareGallery) { Icon( @@ -711,6 +702,27 @@ class GalleryDetailScene : BaseScene() { 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 } + } + val favButtonText = if (favored) { + galleryDetail.favoriteName ?: stringResource(id = R.string.local_favorites) + } else { + stringResource(id = R.string.not_favorited) + } + Column(horizontalAlignment = Alignment.CenterHorizontally) { + FilledTonalIconToggleButton( + checked = favored, + onCheckedChange = { modifyFavourite() }, + ) { + Icon( + imageVector = getFavoriteIcon(favored), + contentDescription = null, + ) + } + Text(text = favButtonText) + } EhIconButton( icon = Icons.Default.Search, text = stringResource(id = R.string.similar_gallery), @@ -726,11 +738,6 @@ class GalleryDetailScene : BaseScene() { text = torrentText, onClick = ::showTorrentDialog, ) - EhIconButton( - icon = Icons.Default.FolderZip, - text = stringResource(id = R.string.archive), - onClick = ::showArchiveDialog, - ) } Spacer(modifier = Modifier.size(dimensionResource(id = R.dimen.keyline_margin))) CrystalCard( diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index 1d0d48e70..2c5ef75e1 100755 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -120,6 +120,7 @@ Bewertung fehlgeschlagen Keine Torrentdatei Torrentdateien + Nicht zu Favoriten hinzugefügt Zu Favoriten hinzufügen Zu Favoriten hinzugefügt Aus Favoriten entfernt diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml index d7cb655e2..6f91868f8 100644 --- a/app/src/main/res/values-es/strings.xml +++ b/app/src/main/res/values-es/strings.xml @@ -153,6 +153,7 @@ Valoración fallida Sin torrents Torrents + No en favoritos Añadir a favoritos - Elige categoría Eliminado de favoritos No se ha podido agregar a favoritos diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index 1287e2d7e..e04c66fab 100755 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -162,6 +162,7 @@ Échec de notation Aucun fiche torrent Fiches torrent + Non ajoutée à favoris Ajouter à favoris Ajouté à favoris Retirer de favoris diff --git a/app/src/main/res/values-ja/strings.xml b/app/src/main/res/values-ja/strings.xml index da7c6a9af..3ab693179 100644 --- a/app/src/main/res/values-ja/strings.xml +++ b/app/src/main/res/values-ja/strings.xml @@ -161,6 +161,7 @@ 評価できませんでした トレントなし トレント + 未追加 お気に入りに追加 お気に入りに追加しました。 お気に入りから削除しました。 diff --git a/app/src/main/res/values-ko/strings.xml b/app/src/main/res/values-ko/strings.xml index 81d8740fe..70bacb526 100755 --- a/app/src/main/res/values-ko/strings.xml +++ b/app/src/main/res/values-ko/strings.xml @@ -152,6 +152,7 @@ 평가에 실패했습니다. 토렌트 없음 토렌트 + 즐겨찾기에 없음 즐겨찾기에 추가 즐겨찾기에 추가했습니다. 즐겨찾기에서 제거했습니다. diff --git a/app/src/main/res/values-th/strings.xml b/app/src/main/res/values-th/strings.xml index 28e41826e..72c9cedb6 100644 --- a/app/src/main/res/values-th/strings.xml +++ b/app/src/main/res/values-th/strings.xml @@ -154,6 +154,7 @@ การให้คะแนนล้มเหลว ไม่มีไฟล์ torrents Torrents + ยังไม่เพิ่มรายการโปรด เพิ่มเข้ารายการโปรด เพิ่มเข้าในรายการโปรดแล้ว ลบออกจากรายการโปรดแล้ว diff --git a/app/src/main/res/values-zh-rCN/strings.xml b/app/src/main/res/values-zh-rCN/strings.xml index 75e39c913..ca30eaeee 100644 --- a/app/src/main/res/values-zh-rCN/strings.xml +++ b/app/src/main/res/values-zh-rCN/strings.xml @@ -155,6 +155,7 @@ 开始下载种子 无法下载种子 种子 + 未收藏 添加收藏 已添加至收藏 移除收藏 diff --git a/app/src/main/res/values-zh-rHK/strings.xml b/app/src/main/res/values-zh-rHK/strings.xml index 48bd4a79d..d68327dbd 100755 --- a/app/src/main/res/values-zh-rHK/strings.xml +++ b/app/src/main/res/values-zh-rHK/strings.xml @@ -170,6 +170,7 @@ 評分失敗 沒有種子 種子 + 未收藏 添加收藏 已添加至收藏 移除收藏 diff --git a/app/src/main/res/values-zh-rTW/strings.xml b/app/src/main/res/values-zh-rTW/strings.xml index 81b886197..d9d2c9f7b 100644 --- a/app/src/main/res/values-zh-rTW/strings.xml +++ b/app/src/main/res/values-zh-rTW/strings.xml @@ -151,6 +151,7 @@ 開始下載種子 無法下載種子 種子 + 未收藏 新增到收藏裡 已新增至收藏中 從收藏中移除 diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 0f92c2f44..4acfd051c 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -197,6 +197,7 @@ Torrent download started Failed to download torrent Torrents + Not favorited Add to favorites Added to favorites Removed from favorites