Skip to content

Commit

Permalink
Make migration changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Animeboynz committed Nov 3, 2024
1 parent 298a113 commit c6a2947
Show file tree
Hide file tree
Showing 9 changed files with 142 additions and 87 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -358,22 +358,22 @@ fun FailedUpdatesBottomActionMenu(
.padding(horizontal = 8.dp, vertical = 12.dp),
) {
Button(
title = stringResource(R.string.action_delete),
title = stringResource(MR.strings.action_delete),
icon = Icons.Outlined.Delete,
toConfirm = confirm[0],
onLongClick = { onLongClickItem(0) },
onClick = onDeleteClicked,
)
Button(
title = stringResource(R.string.action_dismiss),
title = stringResource(MR.strings.action_dismiss),
icon = Icons.Outlined.VisibilityOff,
toConfirm = confirm[1],
onLongClick = { onLongClickItem(1) },
onClick = onDismissClicked,
)
if (groupingMode == GroupByMode.NONE && selected.size <= 1) {
Button(
title = stringResource(R.string.action_info),
title = stringResource(MR.strings.action_info),
icon = Icons.Outlined.Info,
toConfirm = confirm[2],
onLongClick = { onLongClickItem(2) },
Expand Down
44 changes: 26 additions & 18 deletions app/src/main/java/eu/kanade/presentation/updates/UpdatesScreen.kt
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import eu.kanade.tachiyomi.data.download.model.Download
import eu.kanade.tachiyomi.ui.updates.UpdatesItem
import eu.kanade.tachiyomi.ui.updates.UpdatesScreenModel
import kotlinx.collections.immutable.persistentListOf
import kotlinx.collections.immutable.toImmutableList
import kotlinx.coroutines.delay
import kotlinx.coroutines.launch
import tachiyomi.i18n.MR
Expand Down Expand Up @@ -152,26 +153,33 @@ private fun UpdatesAppBar(
modifier = modifier,
title = stringResource(MR.strings.label_recent_updates),
actions = {
val actions = mutableListOf<AppBar.Action>()
if (hasFailedUpdates) { // only add the warning icon if it is enabled
actions += AppBar.Action(
title = stringResource(R.string.action_update_warning),
icon = Icons.Rounded.Warning,
onClick = onUpdateWarning,
iconTint = warningIconTint,
val actions = mutableListOf<AppBar.Action>().apply {
if (hasFailedUpdates) {
add(
AppBar.Action(
title = stringResource(MR.strings.action_update_warning),
icon = Icons.Rounded.Warning,
onClick = onUpdateWarning,
iconTint = warningIconTint,
),
)
}
add(
AppBar.Action(
title = stringResource(MR.strings.action_view_upcoming),
icon = Icons.Outlined.CalendarMonth,
onClick = onCalendarClicked,
),
)
add(
AppBar.Action(
title = stringResource(MR.strings.action_update_library),
icon = Icons.Outlined.Refresh,
onClick = onUpdateLibrary,
),
)
}
actions += AppBar.Action(
title = stringResource(MR.strings.action_view_upcoming),
icon = Icons.Outlined.CalendarMonth,
onClick = onCalendarClicked,
)
actions += AppBar.Action(
title = stringResource(R.string.action_update_library),
icon = Icons.Outlined.Refresh,
onClick = onUpdateLibrary,
)
AppBarActions(actions)
AppBarActions(actions.toImmutableList())
},
actionModeCounter = actionModeCounter,
onCancelActionMode = onCancelActionMode,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.KeyboardArrowUp
import androidx.compose.material.icons.rounded.Warning
import androidx.compose.material.ripple.rememberRipple
import androidx.compose.material3.CardDefaults
import androidx.compose.material3.ElevatedCard
import androidx.compose.material3.HorizontalDivider
Expand All @@ -38,6 +37,7 @@ import androidx.compose.material3.LocalContentColor
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.material3.minimumInteractiveComponentSize
import androidx.compose.material3.ripple
import androidx.compose.runtime.Composable
import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.runtime.getValue
Expand Down Expand Up @@ -313,11 +313,13 @@ fun LazyListScope.failedUpdatesGroupUiItem(
if (expanded[errorMessageHeaderId] == null) {
onExpandedMapChange(errorMessageHeaderId, true)
} else {
onExpandedMapChange(errorMessageHeaderId, !expanded[errorMessageHeaderId]!!)
onExpandedMapChange(
errorMessageHeaderId,
!expanded[errorMessageHeaderId]!!,
)
}
},
onLongClick =
{ onGroupSelected(items) },
onLongClick = { onGroupSelected(items) },
)
.padding(
horizontal = 12.dp,
Expand Down Expand Up @@ -390,7 +392,9 @@ fun LazyListScope.failedUpdatesGroupUiItem(
val isLastItem = index == items.lastIndex
AnimatedVisibility(
modifier = Modifier,
visible = expanded[errorMessageHeaderId] == true && expanded[GroupKey(id, Pair("", ""))] == true,
visible =
expanded[errorMessageHeaderId] == true &&
expanded[GroupKey(id, Pair("", ""))] == true,
) {
FailedUpdatesUiItem(
modifier = Modifier
Expand Down Expand Up @@ -443,10 +447,12 @@ fun CustomIconButton(
enabled = enabled,
role = Role.Button,
interactionSource = interactionSource,
indication = rememberRipple(
bounded = false,
radius = 20.dp,
),
indication = remember {
ripple(
bounded = false,
radius = 20.dp,
)
},
),
contentAlignment = Alignment.Center,
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ fun ErrorMessageDialog(
TextButton(onClick = {
onCopyClick()
onDismissRequest()
},) {
}) {
Text(text = stringResource(R.string.copy))
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,16 +51,16 @@ import eu.kanade.presentation.util.Screen
import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.ui.manga.MangaScreen
import eu.kanade.tachiyomi.util.system.copyToClipboard
import kotlinx.collections.immutable.toImmutableList
import tachiyomi.domain.manga.model.Manga
import tachiyomi.i18n.MR
import tachiyomi.presentation.core.components.FastScrollLazyColumn
import tachiyomi.presentation.core.components.Pill
import tachiyomi.presentation.core.components.SortItem
import tachiyomi.presentation.core.components.material.ExtendedFloatingActionButton
import tachiyomi.presentation.core.components.material.Scaffold
import tachiyomi.presentation.core.screens.EmptyScreen
import tachiyomi.presentation.core.screens.LoadingScreen
import tachiyomi.presentation.core.util.isScrolledToEnd
import tachiyomi.presentation.core.util.isScrollingUp
import tachiyomi.source.local.isLocal

class FailedUpdatesScreen : Screen() {
Expand Down Expand Up @@ -120,7 +120,8 @@ class FailedUpdatesScreen : Screen() {
text = { Text(text = stringResource(R.string.label_help)) },
icon = { Icon(imageVector = Icons.Outlined.HelpOutline, contentDescription = null) },
onClick = { uriHandler.openUri("https://tachiyomi.org/help/guides/troubleshooting") },
expanded = failedUpdatesListState.isScrollingUp() || failedUpdatesListState.isScrolledToEnd(),
// Revisit
// expanded = failedUpdatesListState.isScrollingUp() || failedUpdatesListState.isScrolledToEnd(),
)
}
},
Expand All @@ -129,7 +130,7 @@ class FailedUpdatesScreen : Screen() {
state.isLoading -> LoadingScreen(modifier = Modifier.padding(contentPadding))

state.items.isEmpty() -> EmptyScreen(
textResource = R.string.information_no_update_errors,
stringRes = MR.strings.information_no_update_errors,
modifier = Modifier.padding(contentPadding),
happyFace = true,
)
Expand Down Expand Up @@ -363,7 +364,7 @@ private fun FailedUpdatesAppBar(
onClick = { onClickGroup(GroupByMode.NONE) },
)
}
AppBarActions(actions)
AppBarActions(actions.toImmutableList())
}
},
scrollBehavior = scrollBehavior,
Expand Down Expand Up @@ -399,7 +400,7 @@ private fun FailedUpdatesActionAppBar(
icon = Icons.Outlined.FlipToBack,
onClick = onInvertSelection,
),
),
).toImmutableList(),
)
},
scrollBehavior = scrollBehavior,
Expand Down
Loading

0 comments on commit c6a2947

Please sign in to comment.