Show gallery pages in history

This commit is contained in:
FooIbar committed 2024-02-27 17:29:35 +08:00
1 parent 7cbc641178
commit 2ff9df4c07
7 files changed
+15 -9

No files matched your search

@@ -113,6 +113,7 @@ object Settings : DataStorePreferences(null) {
val meteredNetworkWarning = boolPref("cellular_network_warning", false)
val blackDarkTheme = boolPref("black_dark_theme", false)
val gridView = boolPref("grid_view", false)
val showGalleryPages = boolPref("show_gallery_pages", true)
val recentDownloadLabel = stringOrNullPref("recent_download_label", null)
var downloadScheme by stringOrNullPref("image_scheme", null)
@@ -136,7 +137,6 @@ object Settings : DataStorePreferences(null) {
var requestNews by boolPref("request_news", false).observed { updateWhenRequestNewsChanges() }
var hideHvEvents by boolPref("hide_hv_events", false)
var showJpnTitle by boolPref("show_jpn_title", false)
var showGalleryPages by boolPref("show_gallery_pages", true)
var showTagTranslations by boolPref(KEY_SHOW_TAG_TRANSLATIONS, false).observed { updateWhenTagTranslationChanges() }
var appLinkVerifyTip by boolPref("app_link_verify_tip", false)
var enabledSecurity by boolPref("enable_secure", false)
@@ -433,7 +433,7 @@ object EhEngine {
val hasTags = any { !it.simpleTags.isNullOrEmpty() }
val hasPages = any { it.pages != 0 }
val hasRated = any { it.rated }
val needApi = filter && needTags() && !hasTags || Settings.showGalleryPages && !hasPages || hasRated
val needApi = filter && needTags() && !hasTags || Settings.showGalleryPages.value && !hasPages || hasRated
if (needApi) fillGalleryListByApi(this@fillInfo, url)
if (filter) removeAllSuspend { filterUploader(it) || filterTag(it) || filterTagNamespace(it) }
}
@@ -93,9 +93,9 @@ fun GalleryInfoListItem(
onClick: () -> Unit,
onLongClick: () -> Unit,
info: GalleryInfo,
showPages: Boolean,
modifier: Modifier = Modifier,
isInFavScene: Boolean = false,
showPages: Boolean = false,
interactionSource: MutableInteractionSource = remember { MutableInteractionSource() },
) = CrystalCard(
modifier = modifier,
@@ -254,7 +254,7 @@ fun FavouritesScreen(navigator: DestinationsNavigator) {
) { contentPadding ->
val listMode by Settings.listMode.collectAsState()
val height by collectListThumbSizeAsState()
val showPages = Settings.showGalleryPages
val showPages by Settings.showGalleryPages.collectAsState()
val searchBarConnection = remember {
val slop = ViewConfiguration.get(context).scaledTouchSlop
val topPaddingPx = with(density) { contentPadding.calculateTopPadding().roundToPx() }
@@ -295,9 +295,9 @@ fun FavouritesScreen(navigator: DestinationsNavigator) {
checkedInfoMap[info.gid] = info
},
info = info,
isInFavScene = true,
showPages = showPages,
modifier = Modifier.height(height),
isInFavScene = true,
interactionSource = interactionSource,
)
}
@@ -633,7 +633,7 @@ fun GalleryListScreen(lub: ListUrlBuilder, navigator: DestinationsNavigator) {
}
val height by collectListThumbSizeAsState()
val showPages = Settings.showGalleryPages
val showPages by Settings.showGalleryPages.collectAsState()
val searchBarConnection = remember {
val slop = ViewConfiguration.get(context).scaledTouchSlop
val topPaddingPx = with(density) { contentPadding.calculateTopPadding().roundToPx() }
@@ -672,7 +672,6 @@ fun GalleryListScreen(lub: ListUrlBuilder, navigator: DestinationsNavigator) {
}
},
info = info,
isInFavScene = false,
showPages = showPages,
modifier = Modifier.height(height),
)
@@ -38,6 +38,8 @@ import androidx.paging.compose.itemContentType
import androidx.paging.compose.itemKey
import com.hippo.ehviewer.EhDB
import com.hippo.ehviewer.R
import com.hippo.ehviewer.Settings
import com.hippo.ehviewer.collectAsState
import com.hippo.ehviewer.icons.EhIcons
import com.hippo.ehviewer.icons.big.History
import com.hippo.ehviewer.ui.LocalNavDrawerState
@@ -98,6 +100,7 @@ fun HistoryScreen(navigator: DestinationsNavigator) {
) { paddingValues ->
val marginH = dimensionResource(id = R.dimen.gallery_list_margin_h)
val cardHeight by collectListThumbSizeAsState()
val showPages by Settings.showGalleryPages.collectAsState()
FastScrollLazyColumn(
modifier = Modifier.padding(horizontal = marginH).fillMaxSize(),
contentPadding = paddingValues,
@@ -135,6 +138,7 @@ fun HistoryScreen(navigator: DestinationsNavigator) {
}
},
info = info,
showPages = showPages,
modifier = Modifier.height(cardHeight),
)
}
@@ -58,6 +58,7 @@ import com.hippo.ehviewer.ui.tools.toAnnotatedString
import com.hippo.ehviewer.util.copyTextToClipboard
import com.hippo.ehviewer.util.displayString
import com.hippo.ehviewer.util.isAtLeastT
import com.jamal.composeprefs3.ui.prefs.SwitchPref
import com.ramcosta.composedestinations.annotation.Destination
import com.ramcosta.composedestinations.navigation.DestinationsNavigator
import eu.kanade.tachiyomi.util.lang.withIOContext
@@ -302,10 +303,12 @@ fun EhScreen(navigator: DestinationsNavigator) {
summary = stringResource(id = R.string.settings_eh_force_eh_thumb_summary),
value = Settings::forceEhThumb,
)
SwitchPreference(
var showGalleryPages by Settings.showGalleryPages.asMutableState()
SwitchPref(
checked = showGalleryPages,
onMutate = { showGalleryPages = !showGalleryPages },
title = stringResource(id = R.string.settings_eh_show_gallery_pages),
summary = stringResource(id = R.string.settings_eh_show_gallery_pages_summary),
value = Settings::showGalleryPages,
)
val showComments = Settings::showComments.observed
SwitchPreference(