Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hide smart update icon when disabled #1031

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions app/src/main/java/eu/kanade/presentation/manga/MangaScreen.kt
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ fun MangaScreen(
state: MangaScreenModel.State.Success,
snackbarHostState: SnackbarHostState,
nextUpdate: Instant?,
isUpdateIntervalEnabled: Boolean,
isTabletUi: Boolean,
chapterSwipeStartAction: LibraryPreferences.ChapterSwipeAction,
chapterSwipeEndAction: LibraryPreferences.ChapterSwipeAction,
Expand Down Expand Up @@ -139,6 +140,7 @@ fun MangaScreen(
state = state,
snackbarHostState = snackbarHostState,
nextUpdate = nextUpdate,
isUpdateIntervalEnabled = isUpdateIntervalEnabled,
chapterSwipeStartAction = chapterSwipeStartAction,
chapterSwipeEndAction = chapterSwipeEndAction,
onBackClicked = onBackClicked,
Expand Down Expand Up @@ -176,6 +178,7 @@ fun MangaScreen(
chapterSwipeStartAction = chapterSwipeStartAction,
chapterSwipeEndAction = chapterSwipeEndAction,
nextUpdate = nextUpdate,
isUpdateIntervalEnabled = isUpdateIntervalEnabled,
onBackClicked = onBackClicked,
onChapterClicked = onChapterClicked,
onDownloadChapter = onDownloadChapter,
Expand Down Expand Up @@ -212,6 +215,7 @@ private fun MangaScreenSmallImpl(
state: MangaScreenModel.State.Success,
snackbarHostState: SnackbarHostState,
nextUpdate: Instant?,
isUpdateIntervalEnabled: Boolean,
chapterSwipeStartAction: LibraryPreferences.ChapterSwipeAction,
chapterSwipeEndAction: LibraryPreferences.ChapterSwipeAction,
onBackClicked: () -> Unit,
Expand Down Expand Up @@ -400,6 +404,7 @@ private fun MangaScreenSmallImpl(
favorite = state.manga.favorite,
trackingCount = state.trackingCount,
nextUpdate = nextUpdate,
isUpdateIntervalEnabled = isUpdateIntervalEnabled,
isUserIntervalMode = state.manga.fetchInterval < 0,
onAddToLibraryClicked = onAddToLibraryClicked,
onWebViewClicked = onWebViewClicked,
Expand Down Expand Up @@ -460,6 +465,7 @@ fun MangaScreenLargeImpl(
state: MangaScreenModel.State.Success,
snackbarHostState: SnackbarHostState,
nextUpdate: Instant?,
isUpdateIntervalEnabled: Boolean,
chapterSwipeStartAction: LibraryPreferences.ChapterSwipeAction,
chapterSwipeEndAction: LibraryPreferences.ChapterSwipeAction,
onBackClicked: () -> Unit,
Expand Down Expand Up @@ -636,6 +642,7 @@ fun MangaScreenLargeImpl(
favorite = state.manga.favorite,
trackingCount = state.trackingCount,
nextUpdate = nextUpdate,
isUpdateIntervalEnabled = isUpdateIntervalEnabled,
isUserIntervalMode = state.manga.fetchInterval < 0,
onAddToLibraryClicked = onAddToLibraryClicked,
onWebViewClicked = onWebViewClicked,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,11 +162,13 @@ fun MangaInfoBox(
}
}

@Suppress("CyclomaticComplexMethod")
@Composable
fun MangaActionRow(
favorite: Boolean,
trackingCount: Int,
nextUpdate: Instant?,
isUpdateIntervalEnabled: Boolean,
isUserIntervalMode: Boolean,
onAddToLibraryClicked: () -> Unit,
onWebViewClicked: (() -> Unit)?,
Expand Down Expand Up @@ -200,20 +202,22 @@ fun MangaActionRow(
onClick = onAddToLibraryClicked,
onLongClick = onEditCategory,
)
MangaActionButton(
title = when (nextUpdateDays) {
null -> stringResource(MR.strings.not_applicable)
0 -> stringResource(MR.strings.manga_interval_expected_update_soon)
else -> pluralStringResource(
MR.plurals.day,
count = nextUpdateDays,
nextUpdateDays,
)
},
icon = Icons.Default.HourglassEmpty,
color = if (isUserIntervalMode) MaterialTheme.colorScheme.primary else defaultActionButtonColor,
onClick = { onEditIntervalClicked?.invoke() },
)
if (nextUpdateDays != null || isUpdateIntervalEnabled) {
MangaActionButton(
title = when (nextUpdateDays) {
null -> stringResource(MR.strings.not_applicable)
0 -> stringResource(MR.strings.manga_interval_expected_update_soon)
else -> pluralStringResource(
MR.plurals.day,
count = nextUpdateDays,
nextUpdateDays,
)
},
icon = Icons.Default.HourglassEmpty,
color = if (isUserIntervalMode) MaterialTheme.colorScheme.primary else defaultActionButtonColor,
onClick = { onEditIntervalClicked?.invoke() },
)
}
MangaActionButton(
title = if (trackingCount == 0) {
stringResource(MR.strings.manga_tracking_tab)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ class MangaScreen(
state = successState,
snackbarHostState = screenModel.snackbarHostState,
nextUpdate = successState.manga.expectedNextUpdate,
isUpdateIntervalEnabled = screenModel.isUpdateIntervalEnabled,
isTabletUi = isTabletUi(),
chapterSwipeStartAction = screenModel.chapterSwipeStartAction,
chapterSwipeEndAction = screenModel.chapterSwipeEndAction,
Expand Down