|
@@ -47,6 +47,7 @@ import androidx.compose.ui.platform.LocalLayoutDirection
|
|
|
import androidx.compose.ui.util.fastAll
|
|
|
import androidx.compose.ui.util.fastAny
|
|
|
import androidx.compose.ui.util.fastMap
|
|
|
+import eu.kanade.presentation.components.relativeDateText
|
|
|
import eu.kanade.presentation.manga.components.ChapterDownloadAction
|
|
|
import eu.kanade.presentation.manga.components.ChapterHeader
|
|
|
import eu.kanade.presentation.manga.components.ExpandableMangaDescription
|
|
@@ -61,7 +62,6 @@ import eu.kanade.tachiyomi.data.download.model.Download
|
|
|
import eu.kanade.tachiyomi.source.getNameForMangaInfo
|
|
|
import eu.kanade.tachiyomi.ui.manga.ChapterList
|
|
|
import eu.kanade.tachiyomi.ui.manga.MangaScreenModel
|
|
|
-import eu.kanade.tachiyomi.util.lang.toRelativeString
|
|
|
import eu.kanade.tachiyomi.util.system.copyToClipboard
|
|
|
import tachiyomi.domain.chapter.model.Chapter
|
|
|
import tachiyomi.domain.chapter.service.missingChaptersCount
|
|
@@ -78,16 +78,12 @@ import tachiyomi.presentation.core.i18n.stringResource
|
|
|
import tachiyomi.presentation.core.util.isScrolledToEnd
|
|
|
import tachiyomi.presentation.core.util.isScrollingUp
|
|
|
import tachiyomi.source.local.isLocal
|
|
|
-import java.text.DateFormat
|
|
|
-import java.util.Date
|
|
|
|
|
|
@Composable
|
|
|
fun MangaScreen(
|
|
|
state: MangaScreenModel.State.Success,
|
|
|
snackbarHostState: SnackbarHostState,
|
|
|
fetchInterval: Int?,
|
|
|
- dateRelativeTime: Boolean,
|
|
|
- dateFormat: DateFormat,
|
|
|
isTabletUi: Boolean,
|
|
|
chapterSwipeStartAction: LibraryPreferences.ChapterSwipeAction,
|
|
|
chapterSwipeEndAction: LibraryPreferences.ChapterSwipeAction,
|
|
@@ -142,8 +138,6 @@ fun MangaScreen(
|
|
|
MangaScreenSmallImpl(
|
|
|
state = state,
|
|
|
snackbarHostState = snackbarHostState,
|
|
|
- dateRelativeTime = dateRelativeTime,
|
|
|
- dateFormat = dateFormat,
|
|
|
fetchInterval = fetchInterval,
|
|
|
chapterSwipeStartAction = chapterSwipeStartAction,
|
|
|
chapterSwipeEndAction = chapterSwipeEndAction,
|
|
@@ -179,10 +173,8 @@ fun MangaScreen(
|
|
|
MangaScreenLargeImpl(
|
|
|
state = state,
|
|
|
snackbarHostState = snackbarHostState,
|
|
|
- dateRelativeTime = dateRelativeTime,
|
|
|
chapterSwipeStartAction = chapterSwipeStartAction,
|
|
|
chapterSwipeEndAction = chapterSwipeEndAction,
|
|
|
- dateFormat = dateFormat,
|
|
|
fetchInterval = fetchInterval,
|
|
|
onBackClicked = onBackClicked,
|
|
|
onChapterClicked = onChapterClicked,
|
|
@@ -219,8 +211,6 @@ fun MangaScreen(
|
|
|
private fun MangaScreenSmallImpl(
|
|
|
state: MangaScreenModel.State.Success,
|
|
|
snackbarHostState: SnackbarHostState,
|
|
|
- dateRelativeTime: Boolean,
|
|
|
- dateFormat: DateFormat,
|
|
|
fetchInterval: Int?,
|
|
|
chapterSwipeStartAction: LibraryPreferences.ChapterSwipeAction,
|
|
|
chapterSwipeEndAction: LibraryPreferences.ChapterSwipeAction,
|
|
@@ -455,8 +445,6 @@ private fun MangaScreenSmallImpl(
|
|
|
manga = state.manga,
|
|
|
chapters = listItem,
|
|
|
isAnyChapterSelected = chapters.fastAny { it.selected },
|
|
|
- dateRelativeTime = dateRelativeTime,
|
|
|
- dateFormat = dateFormat,
|
|
|
chapterSwipeStartAction = chapterSwipeStartAction,
|
|
|
chapterSwipeEndAction = chapterSwipeEndAction,
|
|
|
onChapterClicked = onChapterClicked,
|
|
@@ -474,8 +462,6 @@ private fun MangaScreenSmallImpl(
|
|
|
fun MangaScreenLargeImpl(
|
|
|
state: MangaScreenModel.State.Success,
|
|
|
snackbarHostState: SnackbarHostState,
|
|
|
- dateRelativeTime: Boolean,
|
|
|
- dateFormat: DateFormat,
|
|
|
fetchInterval: Int?,
|
|
|
chapterSwipeStartAction: LibraryPreferences.ChapterSwipeAction,
|
|
|
chapterSwipeEndAction: LibraryPreferences.ChapterSwipeAction,
|
|
@@ -705,8 +691,6 @@ fun MangaScreenLargeImpl(
|
|
|
manga = state.manga,
|
|
|
chapters = listItem,
|
|
|
isAnyChapterSelected = chapters.fastAny { it.selected },
|
|
|
- dateRelativeTime = dateRelativeTime,
|
|
|
- dateFormat = dateFormat,
|
|
|
chapterSwipeStartAction = chapterSwipeStartAction,
|
|
|
chapterSwipeEndAction = chapterSwipeEndAction,
|
|
|
onChapterClicked = onChapterClicked,
|
|
@@ -768,8 +752,6 @@ private fun LazyListScope.sharedChapterItems(
|
|
|
manga: Manga,
|
|
|
chapters: List<ChapterList>,
|
|
|
isAnyChapterSelected: Boolean,
|
|
|
- dateRelativeTime: Boolean,
|
|
|
- dateFormat: DateFormat,
|
|
|
chapterSwipeStartAction: LibraryPreferences.ChapterSwipeAction,
|
|
|
chapterSwipeEndAction: LibraryPreferences.ChapterSwipeAction,
|
|
|
onChapterClicked: (Chapter) -> Unit,
|
|
@@ -788,7 +770,6 @@ private fun LazyListScope.sharedChapterItems(
|
|
|
contentType = { MangaScreenItem.CHAPTER },
|
|
|
) { item ->
|
|
|
val haptic = LocalHapticFeedback.current
|
|
|
- val context = LocalContext.current
|
|
|
|
|
|
when (item) {
|
|
|
is ChapterList.MissingCount -> {
|
|
@@ -804,15 +785,7 @@ private fun LazyListScope.sharedChapterItems(
|
|
|
} else {
|
|
|
item.chapter.name
|
|
|
},
|
|
|
- date = item.chapter.dateUpload
|
|
|
- .takeIf { it > 0L }
|
|
|
- ?.let {
|
|
|
- Date(it).toRelativeString(
|
|
|
- context,
|
|
|
- dateRelativeTime,
|
|
|
- dateFormat,
|
|
|
- )
|
|
|
- },
|
|
|
+ date = relativeDateText(item.chapter.dateUpload),
|
|
|
readProgress = item.chapter.lastPageRead
|
|
|
.takeIf { !item.chapter.read && it > 0L }
|
|
|
?.let {
|