Minor cleanup

- Use outlined icons where appropriate to match previous UI
- Allow tapping entire ChapterHeader to bring up sheet
This commit is contained in:
arkon 2022-06-25 11:20:34 -04:00
parent 470a576441
commit 8ec91cddab
11 changed files with 83 additions and 88 deletions

View File

@ -299,7 +299,7 @@ fun ExtensionItemContent(
if (warning != null) {
Text(
text = stringResource(id = warning).uppercase(),
text = stringResource(warning).uppercase(),
style = MaterialTheme.typography.bodySmall.copy(
color = MaterialTheme.colorScheme.error,
),
@ -370,7 +370,7 @@ fun ExtensionHeader(
action: @Composable RowScope.() -> Unit = {},
) {
ExtensionHeader(
text = stringResource(id = textRes),
text = stringResource(textRes),
modifier = modifier,
action = action,
)

View File

@ -219,7 +219,7 @@ fun SourceOptionsDialog(
Column {
val textId = if (Pin.Pinned in source.pin) R.string.action_unpin else R.string.action_pin
Text(
text = stringResource(id = textId),
text = stringResource(textId),
modifier = Modifier
.clickable(onClick = onClickPin)
.fillMaxWidth()

View File

@ -61,7 +61,7 @@ fun ChapterDownloadIndicator(
)
DropdownMenu(expanded = isMenuExpanded, onDismissRequest = { isMenuExpanded = false }) {
DropdownMenuItem(
text = { Text(text = stringResource(id = R.string.action_delete)) },
text = { Text(text = stringResource(R.string.action_delete)) },
onClick = {
onClick(ChapterDownloadAction.DELETE)
isMenuExpanded = false
@ -122,14 +122,14 @@ fun ChapterDownloadIndicator(
)
DropdownMenu(expanded = isMenuExpanded, onDismissRequest = { isMenuExpanded = false }) {
DropdownMenuItem(
text = { Text(text = stringResource(id = R.string.action_start_downloading_now)) },
text = { Text(text = stringResource(R.string.action_start_downloading_now)) },
onClick = {
onClick(ChapterDownloadAction.START_NOW)
isMenuExpanded = false
},
)
DropdownMenuItem(
text = { Text(text = stringResource(id = R.string.action_cancel)) },
text = { Text(text = stringResource(R.string.action_cancel)) },
onClick = {
onClick(ChapterDownloadAction.CANCEL)
isMenuExpanded = false

View File

@ -17,7 +17,7 @@ fun EmptyScreen(
actions: List<EmptyView.Action>? = null,
) {
EmptyScreen(
message = stringResource(id = textResource),
message = stringResource(textResource),
actions = actions,
)
}

View File

@ -365,7 +365,7 @@ private fun MangaScreenSmallImpl(
} else {
R.string.action_start
}
Text(text = stringResource(id = id))
Text(text = stringResource(id))
},
icon = { Icon(imageVector = Icons.Default.PlayArrow, contentDescription = null) },
onClick = onContinueReading,
@ -410,7 +410,7 @@ private fun MangaScreenSmallImpl(
MangaChapterListItem(
title = chapterTitle,
date = date,
readProgress = lastPageRead?.let { stringResource(id = R.string.chapter_progress, it + 1) },
readProgress = lastPageRead?.let { stringResource(R.string.chapter_progress, it + 1) },
scanlator = scanlator,
read = chapter.read,
bookmark = chapter.bookmark,
@ -599,7 +599,7 @@ fun MangaScreenLargeImpl(
} else {
R.string.action_start
}
Text(text = stringResource(id = id))
Text(text = stringResource(id))
},
icon = { Icon(imageVector = Icons.Default.PlayArrow, contentDescription = null) },
onClick = onContinueReading,

View File

@ -1,17 +1,15 @@
package eu.kanade.presentation.manga.components
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.FilterList
import androidx.compose.material3.Icon
import androidx.compose.material3.IconButton
import androidx.compose.material3.LocalMinimumTouchTargetEnforcement
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
@ -31,12 +29,13 @@ fun ChapterHeader(
Row(
modifier = Modifier
.fillMaxWidth()
.padding(start = 16.dp, top = 4.dp, end = 8.dp, bottom = 4.dp),
.clickable(onClick = onFilterButtonClicked)
.padding(horizontal = 16.dp, vertical = 4.dp),
verticalAlignment = Alignment.CenterVertically,
) {
Text(
text = if (chapterCount == null) {
stringResource(id = R.string.chapters)
stringResource(R.string.chapters)
} else {
quantityStringResource(id = R.plurals.manga_num_chapters, quantity = chapterCount)
},
@ -44,11 +43,9 @@ fun ChapterHeader(
modifier = Modifier.weight(1f),
color = MaterialTheme.colorScheme.onBackground,
)
CompositionLocalProvider(LocalMinimumTouchTargetEnforcement provides false) {
IconButton(onClick = onFilterButtonClicked) {
Icon(
imageVector = Icons.Default.FilterList,
contentDescription = stringResource(id = R.string.action_filter),
contentDescription = stringResource(R.string.action_filter),
tint = if (isChapterFiltered) {
Color(LocalContext.current.getResourceColor(R.attr.colorFilterActive))
} else {
@ -56,6 +53,4 @@ fun ChapterHeader(
},
)
}
}
}
}

View File

@ -18,10 +18,10 @@ import androidx.compose.foundation.layout.size
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.BookmarkAdd
import androidx.compose.material.icons.filled.BookmarkRemove
import androidx.compose.material.icons.filled.Delete
import androidx.compose.material.icons.filled.DoneAll
import androidx.compose.material.icons.filled.Download
import androidx.compose.material.icons.filled.RemoveDone
import androidx.compose.material.icons.outlined.Delete
import androidx.compose.material.icons.outlined.Download
import androidx.compose.material.ripple.rememberRipple
import androidx.compose.material3.Icon
import androidx.compose.material3.MaterialTheme
@ -89,7 +89,7 @@ fun MangaBottomActionMenu(
) {
if (onBookmarkClicked != null) {
Button(
title = stringResource(id = R.string.action_bookmark),
title = stringResource(R.string.action_bookmark),
icon = Icons.Default.BookmarkAdd,
toConfirm = confirm[0],
onLongClick = { onLongClickItem(0) },
@ -98,7 +98,7 @@ fun MangaBottomActionMenu(
}
if (onRemoveBookmarkClicked != null) {
Button(
title = stringResource(id = R.string.action_remove_bookmark),
title = stringResource(R.string.action_remove_bookmark),
icon = Icons.Default.BookmarkRemove,
toConfirm = confirm[1],
onLongClick = { onLongClickItem(1) },
@ -107,7 +107,7 @@ fun MangaBottomActionMenu(
}
if (onMarkAsReadClicked != null) {
Button(
title = stringResource(id = R.string.action_mark_as_read),
title = stringResource(R.string.action_mark_as_read),
icon = Icons.Default.DoneAll,
toConfirm = confirm[2],
onLongClick = { onLongClickItem(2) },
@ -116,7 +116,7 @@ fun MangaBottomActionMenu(
}
if (onMarkAsUnreadClicked != null) {
Button(
title = stringResource(id = R.string.action_mark_as_unread),
title = stringResource(R.string.action_mark_as_unread),
icon = Icons.Default.RemoveDone,
toConfirm = confirm[3],
onLongClick = { onLongClickItem(3) },
@ -125,7 +125,7 @@ fun MangaBottomActionMenu(
}
if (onMarkPreviousAsReadClicked != null) {
Button(
title = stringResource(id = R.string.action_mark_previous_as_read),
title = stringResource(R.string.action_mark_previous_as_read),
icon = ImageVector.vectorResource(id = R.drawable.ic_done_prev_24dp),
toConfirm = confirm[4],
onLongClick = { onLongClickItem(4) },
@ -134,8 +134,8 @@ fun MangaBottomActionMenu(
}
if (onDownloadClicked != null) {
Button(
title = stringResource(id = R.string.action_download),
icon = Icons.Default.Download,
title = stringResource(R.string.action_download),
icon = Icons.Outlined.Download,
toConfirm = confirm[5],
onLongClick = { onLongClickItem(5) },
onClick = onDownloadClicked,
@ -143,8 +143,8 @@ fun MangaBottomActionMenu(
}
if (onDeleteClicked != null) {
Button(
title = stringResource(id = R.string.action_delete),
icon = Icons.Default.Delete,
title = stringResource(R.string.action_delete),
icon = Icons.Outlined.Delete,
toConfirm = confirm[6],
onLongClick = { onLongClickItem(6) },
onClick = onDeleteClicked,

View File

@ -74,7 +74,7 @@ fun MangaChapterListItem(
if (bookmark) {
Icon(
imageVector = Icons.Default.Bookmark,
contentDescription = stringResource(id = R.string.action_filter_bookmarked),
contentDescription = stringResource(R.string.action_filter_bookmarked),
modifier = Modifier
.sizeIn(maxHeight = with(LocalDensity.current) { textHeight.toDp() - 2.dp }),
tint = textColor,

View File

@ -64,20 +64,20 @@ fun MangaCoverDialog(
IconButton(onClick = onDismissRequest) {
Icon(
imageVector = Icons.Default.Close,
contentDescription = stringResource(id = R.string.action_close),
contentDescription = stringResource(R.string.action_close),
)
}
Spacer(modifier = Modifier.weight(1f))
IconButton(onClick = onShareClick) {
Icon(
imageVector = Icons.Outlined.Share,
contentDescription = stringResource(id = R.string.action_share),
contentDescription = stringResource(R.string.action_share),
)
}
IconButton(onClick = onSaveClick) {
Icon(
imageVector = Icons.Outlined.Save,
contentDescription = stringResource(id = R.string.action_save),
contentDescription = stringResource(R.string.action_save),
)
}
if (onEditClick != null) {
@ -88,7 +88,7 @@ fun MangaCoverDialog(
) {
Icon(
imageVector = Icons.Outlined.Edit,
contentDescription = stringResource(id = R.string.action_edit_cover),
contentDescription = stringResource(R.string.action_edit_cover),
)
}
DropdownMenu(
@ -96,14 +96,14 @@ fun MangaCoverDialog(
onDismissRequest = { onExpand(false) },
) {
DropdownMenuItem(
text = { Text(text = stringResource(id = R.string.action_edit)) },
text = { Text(text = stringResource(R.string.action_edit)) },
onClick = {
onEditClick(EditCoverAction.EDIT)
onExpand(false)
},
)
DropdownMenuItem(
text = { Text(text = stringResource(id = R.string.action_delete)) },
text = { Text(text = stringResource(R.string.action_delete)) },
onClick = {
onEditClick(EditCoverAction.DELETE)
onExpand(false)

View File

@ -165,9 +165,9 @@ fun MangaInfoHeader(
val defaultActionButtonColor = MaterialTheme.colorScheme.onSurface.copy(alpha = .38f)
MangaActionButton(
title = if (favorite) {
stringResource(id = R.string.in_library)
stringResource(R.string.in_library)
} else {
stringResource(id = R.string.add_to_library)
stringResource(R.string.add_to_library)
},
icon = if (favorite) Icons.Default.Favorite else Icons.Default.FavoriteBorder,
color = if (favorite) MaterialTheme.colorScheme.primary else defaultActionButtonColor,
@ -177,7 +177,7 @@ fun MangaInfoHeader(
if (onTrackingClicked != null) {
MangaActionButton(
title = if (trackingCount == 0) {
stringResource(id = R.string.manga_tracking_tab)
stringResource(R.string.manga_tracking_tab)
} else {
quantityStringResource(id = R.plurals.num_trackers, quantity = trackingCount, trackingCount)
},
@ -188,7 +188,7 @@ fun MangaInfoHeader(
}
if (onWebViewClicked != null) {
MangaActionButton(
title = stringResource(id = R.string.action_web_view),
title = stringResource(R.string.action_web_view),
icon = Icons.Default.Public,
color = defaultActionButtonColor,
onClick = onWebViewClicked,
@ -287,7 +287,7 @@ private fun MangaAndSourceTitlesLarge(
)
Spacer(modifier = Modifier.height(16.dp))
Text(
text = title.takeIf { it.isNotBlank() } ?: stringResource(id = R.string.unknown),
text = title.takeIf { it.isNotBlank() } ?: stringResource(R.string.unknown),
style = MaterialTheme.typography.titleLarge,
modifier = Modifier.clickableNoIndication(
onLongClick = { if (title.isNotBlank()) context.copyToClipboard(title, title) },
@ -297,7 +297,7 @@ private fun MangaAndSourceTitlesLarge(
)
Spacer(modifier = Modifier.height(2.dp))
Text(
text = author?.takeIf { it.isNotBlank() } ?: stringResource(id = R.string.unknown_author),
text = author?.takeIf { it.isNotBlank() } ?: stringResource(R.string.unknown_author),
style = MaterialTheme.typography.titleSmall,
modifier = Modifier
.secondaryItemAlpha()
@ -350,13 +350,13 @@ private fun MangaAndSourceTitlesLarge(
ProvideTextStyle(MaterialTheme.typography.bodyMedium) {
Text(
text = when (status) {
SManga.ONGOING.toLong() -> stringResource(id = R.string.ongoing)
SManga.COMPLETED.toLong() -> stringResource(id = R.string.completed)
SManga.LICENSED.toLong() -> stringResource(id = R.string.licensed)
SManga.PUBLISHING_FINISHED.toLong() -> stringResource(id = R.string.publishing_finished)
SManga.CANCELLED.toLong() -> stringResource(id = R.string.cancelled)
SManga.ON_HIATUS.toLong() -> stringResource(id = R.string.on_hiatus)
else -> stringResource(id = R.string.unknown)
SManga.ONGOING.toLong() -> stringResource(R.string.ongoing)
SManga.COMPLETED.toLong() -> stringResource(R.string.completed)
SManga.LICENSED.toLong() -> stringResource(R.string.licensed)
SManga.PUBLISHING_FINISHED.toLong() -> stringResource(R.string.publishing_finished)
SManga.CANCELLED.toLong() -> stringResource(R.string.cancelled)
SManga.ON_HIATUS.toLong() -> stringResource(R.string.on_hiatus)
else -> stringResource(R.string.unknown)
},
)
DotSeparatorText()
@ -406,7 +406,7 @@ private fun MangaAndSourceTitlesSmall(
)
Column(modifier = Modifier.padding(start = 16.dp)) {
Text(
text = title.ifBlank { stringResource(id = R.string.unknown) },
text = title.ifBlank { stringResource(R.string.unknown) },
style = MaterialTheme.typography.titleLarge,
modifier = Modifier.clickableNoIndication(
onLongClick = { if (title.isNotBlank()) context.copyToClipboard(title, title) },
@ -415,7 +415,7 @@ private fun MangaAndSourceTitlesSmall(
)
Spacer(modifier = Modifier.height(2.dp))
Text(
text = author?.takeIf { it.isNotBlank() } ?: stringResource(id = R.string.unknown_author),
text = author?.takeIf { it.isNotBlank() } ?: stringResource(R.string.unknown_author),
style = MaterialTheme.typography.titleSmall,
modifier = Modifier
.secondaryItemAlpha()
@ -466,13 +466,13 @@ private fun MangaAndSourceTitlesSmall(
ProvideTextStyle(MaterialTheme.typography.bodyMedium) {
Text(
text = when (status) {
SManga.ONGOING.toLong() -> stringResource(id = R.string.ongoing)
SManga.COMPLETED.toLong() -> stringResource(id = R.string.completed)
SManga.LICENSED.toLong() -> stringResource(id = R.string.licensed)
SManga.PUBLISHING_FINISHED.toLong() -> stringResource(id = R.string.publishing_finished)
SManga.CANCELLED.toLong() -> stringResource(id = R.string.cancelled)
SManga.ON_HIATUS.toLong() -> stringResource(id = R.string.on_hiatus)
else -> stringResource(id = R.string.unknown)
SManga.ONGOING.toLong() -> stringResource(R.string.ongoing)
SManga.COMPLETED.toLong() -> stringResource(R.string.completed)
SManga.LICENSED.toLong() -> stringResource(R.string.licensed)
SManga.PUBLISHING_FINISHED.toLong() -> stringResource(R.string.publishing_finished)
SManga.CANCELLED.toLong() -> stringResource(R.string.cancelled)
SManga.ON_HIATUS.toLong() -> stringResource(R.string.on_hiatus)
else -> stringResource(R.string.unknown)
},
)
DotSeparatorText()

View File

@ -13,11 +13,11 @@ import androidx.compose.foundation.layout.windowInsetsPadding
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.ArrowBack
import androidx.compose.material.icons.filled.Close
import androidx.compose.material.icons.filled.Download
import androidx.compose.material.icons.filled.FlipToBack
import androidx.compose.material.icons.filled.MoreVert
import androidx.compose.material.icons.filled.SelectAll
import androidx.compose.material.icons.filled.Share
import androidx.compose.material.icons.outlined.Download
import androidx.compose.material.icons.outlined.Share
import androidx.compose.material3.DropdownMenuItem
import androidx.compose.material3.Icon
import androidx.compose.material3.IconButton
@ -81,7 +81,7 @@ fun MangaSmallAppBar(
IconButton(onClick = onBackClicked) {
Icon(
imageVector = if (isActionMode) Icons.Default.Close else Icons.Default.ArrowBack,
contentDescription = stringResource(id = R.string.abc_action_bar_up_description),
contentDescription = stringResource(R.string.abc_action_bar_up_description),
)
}
},
@ -90,21 +90,21 @@ fun MangaSmallAppBar(
IconButton(onClick = onSelectAll) {
Icon(
imageVector = Icons.Default.SelectAll,
contentDescription = stringResource(id = R.string.action_select_all),
contentDescription = stringResource(R.string.action_select_all),
)
}
IconButton(onClick = onInvertSelection) {
Icon(
imageVector = Icons.Default.FlipToBack,
contentDescription = stringResource(id = R.string.action_select_inverse),
contentDescription = stringResource(R.string.action_select_inverse),
)
}
} else {
if (onShareClicked != null) {
IconButton(onClick = onShareClicked) {
Icon(
imageVector = Icons.Default.Share,
contentDescription = stringResource(id = R.string.action_share),
imageVector = Icons.Outlined.Share,
contentDescription = stringResource(R.string.action_share),
)
}
}
@ -114,8 +114,8 @@ fun MangaSmallAppBar(
Box {
IconButton(onClick = { onDownloadExpanded(!downloadExpanded) }) {
Icon(
imageVector = Icons.Default.Download,
contentDescription = stringResource(id = R.string.manga_download),
imageVector = Icons.Outlined.Download,
contentDescription = stringResource(R.string.manga_download),
)
}
val onDismissRequest = { onDownloadExpanded(false) }
@ -124,42 +124,42 @@ fun MangaSmallAppBar(
onDismissRequest = onDismissRequest,
) {
DropdownMenuItem(
text = { Text(text = stringResource(id = R.string.download_1)) },
text = { Text(text = stringResource(R.string.download_1)) },
onClick = {
onDownloadClicked(DownloadAction.NEXT_1_CHAPTER)
onDismissRequest()
},
)
DropdownMenuItem(
text = { Text(text = stringResource(id = R.string.download_5)) },
text = { Text(text = stringResource(R.string.download_5)) },
onClick = {
onDownloadClicked(DownloadAction.NEXT_5_CHAPTERS)
onDismissRequest()
},
)
DropdownMenuItem(
text = { Text(text = stringResource(id = R.string.download_10)) },
text = { Text(text = stringResource(R.string.download_10)) },
onClick = {
onDownloadClicked(DownloadAction.NEXT_10_CHAPTERS)
onDismissRequest()
},
)
DropdownMenuItem(
text = { Text(text = stringResource(id = R.string.download_custom)) },
text = { Text(text = stringResource(R.string.download_custom)) },
onClick = {
onDownloadClicked(DownloadAction.CUSTOM)
onDismissRequest()
},
)
DropdownMenuItem(
text = { Text(text = stringResource(id = R.string.download_unread)) },
text = { Text(text = stringResource(R.string.download_unread)) },
onClick = {
onDownloadClicked(DownloadAction.UNREAD_CHAPTERS)
onDismissRequest()
},
)
DropdownMenuItem(
text = { Text(text = stringResource(id = R.string.download_all)) },
text = { Text(text = stringResource(R.string.download_all)) },
onClick = {
onDownloadClicked(DownloadAction.ALL_CHAPTERS)
onDismissRequest()
@ -175,7 +175,7 @@ fun MangaSmallAppBar(
IconButton(onClick = { onMoreExpanded(!moreExpanded) }) {
Icon(
imageVector = Icons.Default.MoreVert,
contentDescription = stringResource(id = R.string.abc_action_menu_overflow_description),
contentDescription = stringResource(R.string.abc_action_menu_overflow_description),
)
}
val onDismissRequest = { onMoreExpanded(false) }
@ -184,14 +184,14 @@ fun MangaSmallAppBar(
onDismissRequest = onDismissRequest,
) {
DropdownMenuItem(
text = { Text(text = stringResource(id = R.string.action_edit_categories)) },
text = { Text(text = stringResource(R.string.action_edit_categories)) },
onClick = {
onEditCategoryClicked()
onDismissRequest()
},
)
DropdownMenuItem(
text = { Text(text = stringResource(id = R.string.action_migrate)) },
text = { Text(text = stringResource(R.string.action_migrate)) },
onClick = {
onMigrateClicked()
onDismissRequest()
@ -211,7 +211,7 @@ fun MangaSmallAppBar(
if (downloadedOnlyMode) {
Text(
text = stringResource(id = R.string.label_downloaded_only),
text = stringResource(R.string.label_downloaded_only),
modifier = Modifier
.background(color = MaterialTheme.colorScheme.tertiary)
.fillMaxWidth()
@ -223,7 +223,7 @@ fun MangaSmallAppBar(
}
if (incognitoMode) {
Text(
text = stringResource(id = R.string.pref_incognito_mode),
text = stringResource(R.string.pref_incognito_mode),
modifier = Modifier
.background(color = MaterialTheme.colorScheme.primary)
.fillMaxWidth()