Allow to top align the cover in manga info view (#816)
* Add Appearance option to set if cover should be vertically aligned in the manga info view * Apply align modifier with `CenterVertically` or `Top` instead of using `.apply` * Change option to align cover to top
This commit is contained in:
parent
192a692c52
commit
40927153ca
4 changed files with 15 additions and 3 deletions
|
|
@ -70,6 +70,8 @@ class UiPreferences(
|
|||
fun usePanoramaCoverAlways() = preferenceStore.getBoolean("use_panorama_cover_grid", true)
|
||||
|
||||
fun usePanoramaCoverMangaInfo() = preferenceStore.getBoolean("use_panorama_cover_manga_info", false)
|
||||
|
||||
fun topAlignCover() = preferenceStore.getBoolean("top_align_cover", false)
|
||||
// KMK <--
|
||||
|
||||
fun recommendsInOverflow() = preferenceStore.getBoolean("recommends_in_overflow", false)
|
||||
|
|
|
|||
|
|
@ -127,6 +127,7 @@ fun MangaInfoBox(
|
|||
) {
|
||||
// KMK -->
|
||||
val usePanoramaCover by Injekt.get<UiPreferences>().usePanoramaCoverMangaInfo().collectAsState()
|
||||
val topAlignCover by Injekt.get<UiPreferences>().topAlignCover().collectAsState()
|
||||
// KMK <--
|
||||
Box(modifier = modifier) {
|
||||
// Backdrop
|
||||
|
|
@ -184,6 +185,7 @@ fun MangaInfoBox(
|
|||
onCoverLoaded = onCoverLoaded,
|
||||
coverRatio = coverRatio,
|
||||
usePanoramaCover = usePanoramaCover,
|
||||
topAlignCover = topAlignCover,
|
||||
// KMK <--
|
||||
)
|
||||
} else {
|
||||
|
|
@ -553,6 +555,7 @@ private fun MangaAndSourceTitlesSmall(
|
|||
onCoverLoaded: (DomainMangaCover) -> Unit,
|
||||
coverRatio: MutableFloatState,
|
||||
usePanoramaCover: Boolean = false,
|
||||
topAlignCover: Boolean = false,
|
||||
// KMK <--
|
||||
) {
|
||||
Row(
|
||||
|
|
@ -560,7 +563,7 @@ private fun MangaAndSourceTitlesSmall(
|
|||
.fillMaxWidth()
|
||||
.padding(start = 16.dp, top = appBarPadding + 16.dp, end = 16.dp),
|
||||
horizontalArrangement = Arrangement.spacedBy(16.dp),
|
||||
verticalAlignment = Alignment.CenterVertically,
|
||||
verticalAlignment = if (topAlignCover) Alignment.Top else Alignment.CenterVertically,
|
||||
) {
|
||||
// KMK -->
|
||||
if (usePanoramaCover && coverRatio.floatValue <= RatioSwitchToPanorama) {
|
||||
|
|
@ -568,7 +571,7 @@ private fun MangaAndSourceTitlesSmall(
|
|||
modifier = Modifier
|
||||
.sizeIn(maxHeight = 100.dp)
|
||||
// KMK -->
|
||||
.align(Alignment.CenterVertically),
|
||||
.align(if (topAlignCover) Alignment.Top else Alignment.CenterVertically),
|
||||
// KMK <--
|
||||
data = ImageRequest.Builder(LocalContext.current)
|
||||
.data(manga)
|
||||
|
|
@ -590,7 +593,7 @@ private fun MangaAndSourceTitlesSmall(
|
|||
modifier = Modifier
|
||||
.sizeIn(maxWidth = 100.dp)
|
||||
// KMK -->
|
||||
.align(Alignment.CenterVertically),
|
||||
.align(if (topAlignCover) Alignment.Top else Alignment.CenterVertically),
|
||||
// KMK <--
|
||||
data = ImageRequest.Builder(LocalContext.current)
|
||||
.data(manga)
|
||||
|
|
|
|||
|
|
@ -204,6 +204,11 @@ object SettingsAppearanceScreen : SearchableSettings {
|
|||
title = stringResource(KMR.strings.pref_panorama_cover),
|
||||
subtitle = stringResource(KMR.strings.pref_panorama_cover_summary),
|
||||
),
|
||||
Preference.PreferenceItem.SwitchPreference(
|
||||
preference = uiPreferences.topAlignCover(),
|
||||
title = stringResource(KMR.strings.pref_top_align_cover),
|
||||
subtitle = stringResource(KMR.strings.pref_top_align_cover_summary),
|
||||
),
|
||||
),
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,6 +38,8 @@
|
|||
<string name="pref_panorama_cover_summary">Show cover in landscape mode if it\'s a wide image</string>
|
||||
<string name="pref_panorama_cover_flow">Panorama Cover Flow</string>
|
||||
<string name="pref_panorama_cover_flow_summary">Show panorama cover in Global Search & Suggestions</string>
|
||||
<string name="pref_top_align_cover">Align Cover to Top</string>
|
||||
<string name="pref_top_align_cover_summary">Show the cover aligned to the top alongside manga info</string>
|
||||
<string name="action_display_comfortable_grid_panorama">Panorama comfortable grid</string>
|
||||
<string name="pref_expand_related_mangas">Expand Suggestions</string>
|
||||
<string name="pref_expand_related_mangas_summary">If turned off, Suggestions won\'t automatically load & show expanded</string>
|
||||
|
|
|
|||
Loading…
Reference in a new issue