mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-12-22 12:51:49 +01:00
Resume when history item is tapped (#6982)
* Remove resume button * Rename onClickItem to onClickCover * Optimize imports * Rename reference to onClickItem in HistoryController.kt Co-authored-by: CrepeTF <trungnguyen02@outlookcom>
This commit is contained in:
parent
2d01933c28
commit
070abd79ce
@ -2,32 +2,14 @@ package eu.kanade.presentation.history
|
||||
|
||||
import androidx.compose.foundation.clickable
|
||||
import androidx.compose.foundation.interaction.MutableInteractionSource
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.Row
|
||||
import androidx.compose.foundation.layout.Spacer
|
||||
import androidx.compose.foundation.layout.fillMaxHeight
|
||||
import androidx.compose.foundation.layout.height
|
||||
import androidx.compose.foundation.layout.navigationBarsPadding
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.layout.*
|
||||
import androidx.compose.foundation.lazy.LazyColumn
|
||||
import androidx.compose.foundation.lazy.rememberLazyListState
|
||||
import androidx.compose.foundation.selection.toggleable
|
||||
import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.filled.PlayArrow
|
||||
import androidx.compose.material.icons.outlined.Delete
|
||||
import androidx.compose.material3.AlertDialog
|
||||
import androidx.compose.material3.Checkbox
|
||||
import androidx.compose.material3.CircularProgressIndicator
|
||||
import androidx.compose.material3.Icon
|
||||
import androidx.compose.material3.IconButton
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.material3.TextButton
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.collectAsState
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.material3.*
|
||||
import androidx.compose.runtime.*
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.input.nestedscroll.NestedScrollConnection
|
||||
@ -56,13 +38,13 @@ import uy.kohesive.injekt.api.get
|
||||
import java.text.DateFormat
|
||||
import java.text.DecimalFormat
|
||||
import java.text.DecimalFormatSymbols
|
||||
import java.util.Date
|
||||
import java.util.*
|
||||
|
||||
@Composable
|
||||
fun HistoryScreen(
|
||||
nestedScrollInterop: NestedScrollConnection,
|
||||
presenter: HistoryPresenter,
|
||||
onClickItem: (HistoryWithRelations) -> Unit,
|
||||
onClickCover: (HistoryWithRelations) -> Unit,
|
||||
onClickResume: (HistoryWithRelations) -> Unit,
|
||||
onClickDelete: (HistoryWithRelations, Boolean) -> Unit,
|
||||
) {
|
||||
@ -81,7 +63,7 @@ fun HistoryScreen(
|
||||
HistoryContent(
|
||||
nestedScroll = nestedScrollInterop,
|
||||
history = history,
|
||||
onClickItem = onClickItem,
|
||||
onClickCover = onClickCover,
|
||||
onClickResume = onClickResume,
|
||||
onClickDelete = onClickDelete,
|
||||
)
|
||||
@ -92,7 +74,7 @@ fun HistoryScreen(
|
||||
@Composable
|
||||
fun HistoryContent(
|
||||
history: LazyPagingItems<UiModel>,
|
||||
onClickItem: (HistoryWithRelations) -> Unit,
|
||||
onClickCover: (HistoryWithRelations) -> Unit,
|
||||
onClickResume: (HistoryWithRelations) -> Unit,
|
||||
onClickDelete: (HistoryWithRelations, Boolean) -> Unit,
|
||||
preferences: PreferencesHelper = Injekt.get(),
|
||||
@ -125,7 +107,7 @@ fun HistoryContent(
|
||||
HistoryItem(
|
||||
modifier = Modifier.animateItemPlacement(),
|
||||
history = value,
|
||||
onClickItem = { onClickItem(value) },
|
||||
onClickCover = { onClickCover(value) },
|
||||
onClickResume = { onClickResume(value) },
|
||||
onClickDelete = { setRemoveState(value) },
|
||||
)
|
||||
@ -175,19 +157,21 @@ fun HistoryHeader(
|
||||
fun HistoryItem(
|
||||
modifier: Modifier = Modifier,
|
||||
history: HistoryWithRelations,
|
||||
onClickItem: () -> Unit,
|
||||
onClickCover: () -> Unit,
|
||||
onClickResume: () -> Unit,
|
||||
onClickDelete: () -> Unit,
|
||||
) {
|
||||
Row(
|
||||
modifier = modifier
|
||||
.clickable(onClick = onClickItem)
|
||||
.clickable(onClick = onClickResume)
|
||||
.height(96.dp)
|
||||
.padding(horizontal = horizontalPadding, vertical = 8.dp),
|
||||
verticalAlignment = Alignment.CenterVertically,
|
||||
) {
|
||||
MangaCover(
|
||||
modifier = Modifier.fillMaxHeight(),
|
||||
modifier = Modifier
|
||||
.fillMaxHeight()
|
||||
.clickable(onClick = onClickCover),
|
||||
data = history.thumbnailUrl,
|
||||
aspect = MangaCoverAspect.COVER
|
||||
)
|
||||
@ -221,6 +205,7 @@ fun HistoryItem(
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
IconButton(onClick = onClickDelete) {
|
||||
Icon(
|
||||
imageVector = Icons.Outlined.Delete,
|
||||
@ -228,13 +213,6 @@ fun HistoryItem(
|
||||
tint = MaterialTheme.colorScheme.onSurface,
|
||||
)
|
||||
}
|
||||
IconButton(onClick = onClickResume) {
|
||||
Icon(
|
||||
imageVector = Icons.Filled.PlayArrow,
|
||||
contentDescription = stringResource(id = R.string.action_resume),
|
||||
tint = MaterialTheme.colorScheme.onSurface,
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -33,7 +33,7 @@ class HistoryController : ComposeController<HistoryPresenter>(), RootController
|
||||
HistoryScreen(
|
||||
nestedScrollInterop = nestedScrollInterop,
|
||||
presenter = presenter,
|
||||
onClickItem = { history ->
|
||||
onClickCover = { history ->
|
||||
router.pushController(MangaController(history).withFadeTransaction())
|
||||
},
|
||||
onClickResume = { history ->
|
||||
|
Loading…
Reference in New Issue
Block a user