Compare commits
No commits in common. '210da5db8aaa07aa1d072eb36d773a2236f5dc54' and 'bb21f9cfad5a9d6e0979aee6dd3505fa6dedcdb7' have entirely different histories.
210da5db8a
...
bb21f9cfad
@ -1,13 +0,0 @@
|
||||
package org.xtimms.shirizu.core.database.entity
|
||||
|
||||
import androidx.room.Embedded
|
||||
import androidx.room.Relation
|
||||
|
||||
class TrackWithManga(
|
||||
@Embedded val track: TrackEntity,
|
||||
@Relation(
|
||||
parentColumn = "manga_id",
|
||||
entityColumn = "manga_id",
|
||||
)
|
||||
val manga: MangaEntity,
|
||||
)
|
||||
@ -1,16 +0,0 @@
|
||||
package org.xtimms.shirizu.core.database.migrations
|
||||
|
||||
import androidx.room.migration.Migration
|
||||
import androidx.sqlite.db.SupportSQLiteDatabase
|
||||
|
||||
class Migration2To3 : Migration(2, 3) {
|
||||
|
||||
override fun migrate(db: SupportSQLiteDatabase) {
|
||||
db.execSQL("CREATE TABLE tracks_bk (manga_id INTEGER NOT NULL, chapters_total INTEGER NOT NULL, last_chapter_id INTEGER NOT NULL, chapters_new INTEGER NOT NULL, last_check INTEGER NOT NULL, last_notified_id INTEGER NOT NULL, PRIMARY KEY(manga_id))")
|
||||
db.execSQL("INSERT INTO tracks_bk SELECT manga_id, chapters_total, last_chapter_id, chapters_new, last_check, last_notified_id FROM tracks")
|
||||
db.execSQL("DROP TABLE tracks")
|
||||
db.execSQL("CREATE TABLE tracks (`manga_id` INTEGER NOT NULL, `last_chapter_id` INTEGER NOT NULL, `chapters_new` INTEGER NOT NULL, `last_check_time` INTEGER NOT NULL, `last_chapter_date` INTEGER NOT NULL, `last_result` INTEGER NOT NULL, PRIMARY KEY(`manga_id`), FOREIGN KEY(`manga_id`) REFERENCES `manga`(`manga_id`) ON UPDATE NO ACTION ON DELETE CASCADE )")
|
||||
db.execSQL("INSERT INTO tracks SELECT manga_id, last_chapter_id, chapters_new, last_check AS last_check_time, 0 AS last_chapter_date, 0 AS last_result FROM tracks_bk")
|
||||
db.execSQL("DROP TABLE tracks_bk")
|
||||
}
|
||||
}
|
||||
@ -1,4 +1,4 @@
|
||||
package org.xtimms.shirizu.core.ui.screens
|
||||
package org.xtimms.shirizu.core.screens
|
||||
|
||||
import androidx.annotation.StringRes
|
||||
import androidx.compose.foundation.layout.Arrangement
|
||||
@ -1,4 +1,4 @@
|
||||
package org.xtimms.shirizu.core.ui.screens
|
||||
package org.xtimms.shirizu.core.screens
|
||||
|
||||
import androidx.compose.animation.AnimatedContent
|
||||
import androidx.compose.animation.core.RepeatMode
|
||||
@ -1,4 +1,4 @@
|
||||
package org.xtimms.shirizu.core.ui.screens
|
||||
package org.xtimms.shirizu.core.screens
|
||||
|
||||
import androidx.compose.foundation.layout.Box
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
@ -1,244 +0,0 @@
|
||||
package org.xtimms.shirizu.sections.details
|
||||
|
||||
import android.net.Uri
|
||||
import androidx.compose.foundation.clickable
|
||||
import androidx.compose.foundation.layout.Arrangement
|
||||
import androidx.compose.foundation.layout.Box
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.Spacer
|
||||
import androidx.compose.foundation.layout.aspectRatio
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.height
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.layout.sizeIn
|
||||
import androidx.compose.foundation.shape.CircleShape
|
||||
import androidx.compose.material3.LocalContentColor
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.CompositionLocalProvider
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.draw.alpha
|
||||
import androidx.compose.ui.draw.blur
|
||||
import androidx.compose.ui.draw.clip
|
||||
import androidx.compose.ui.draw.drawWithContent
|
||||
import androidx.compose.ui.graphics.Brush
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.layout.ContentScale
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.semantics.Role
|
||||
import androidx.compose.ui.unit.Dp
|
||||
import androidx.compose.ui.unit.dp
|
||||
import coil.ImageLoader
|
||||
import org.koitharu.kotatsu.parsers.model.MangaSource
|
||||
import org.koitharu.kotatsu.parsers.model.MangaState
|
||||
import org.xtimms.shirizu.R
|
||||
import org.xtimms.shirizu.core.AsyncImageImpl
|
||||
import org.xtimms.shirizu.core.components.MangaCover
|
||||
import org.xtimms.shirizu.sections.details.data.ReadingTime
|
||||
import org.xtimms.shirizu.sections.details.model.HistoryInfo
|
||||
|
||||
@Composable
|
||||
fun ClassicDetailsInfoBox(
|
||||
coil: ImageLoader,
|
||||
imageUrl: String,
|
||||
favicon: Uri,
|
||||
title: String,
|
||||
altTitle: String,
|
||||
author: String,
|
||||
isNsfw: Boolean,
|
||||
state: MangaState?,
|
||||
source: MangaSource,
|
||||
historyInfo: HistoryInfo,
|
||||
readingTime: ReadingTime?,
|
||||
isTabletUi: Boolean,
|
||||
appBarPadding: Dp,
|
||||
modifier: Modifier = Modifier,
|
||||
onCoverClick: () -> Unit,
|
||||
isInShelf: Boolean,
|
||||
onAddToShelfClicked: () -> Unit,
|
||||
onSourceClicked: () -> Unit,
|
||||
onDownloadClick: () -> Unit,
|
||||
) {
|
||||
|
||||
Box(modifier = modifier) {
|
||||
// Backdrop
|
||||
val backdropGradientColors = listOf(
|
||||
Color.Transparent,
|
||||
MaterialTheme.colorScheme.background,
|
||||
)
|
||||
AsyncImageImpl(
|
||||
coil = coil,
|
||||
model = imageUrl,
|
||||
contentDescription = null,
|
||||
contentScale = ContentScale.Crop,
|
||||
modifier = Modifier
|
||||
.matchParentSize()
|
||||
.drawWithContent {
|
||||
drawContent()
|
||||
drawRect(
|
||||
brush = Brush.verticalGradient(colors = backdropGradientColors),
|
||||
)
|
||||
}
|
||||
.blur(3.dp)
|
||||
.alpha(0.33f),
|
||||
)
|
||||
|
||||
// Manga & source info
|
||||
CompositionLocalProvider(LocalContentColor provides MaterialTheme.colorScheme.onSurface) {
|
||||
if (!isTabletUi) {
|
||||
MangaInfoSmall(
|
||||
coil = coil,
|
||||
appBarPadding = appBarPadding,
|
||||
imageUrl = imageUrl,
|
||||
favicon = favicon,
|
||||
title = title,
|
||||
altTitle = altTitle,
|
||||
author = author,
|
||||
state = state,
|
||||
source = source,
|
||||
isInShelf = isInShelf,
|
||||
onAddToShelfClicked = onAddToShelfClicked,
|
||||
onCoverClick = onCoverClick,
|
||||
onSourceClicked = onSourceClicked,
|
||||
historyInfo = historyInfo,
|
||||
readingTime = readingTime,
|
||||
onDownloadClick = onDownloadClick
|
||||
)
|
||||
} else {
|
||||
MangaInfoLarge(
|
||||
coil = coil,
|
||||
appBarPadding = appBarPadding,
|
||||
imageUrl = imageUrl,
|
||||
favicon = favicon,
|
||||
title = title,
|
||||
altTitle = altTitle,
|
||||
author = author,
|
||||
state = state,
|
||||
source = source,
|
||||
isInShelf = isInShelf,
|
||||
onAddToShelfClicked = onAddToShelfClicked,
|
||||
onCoverClick = onCoverClick,
|
||||
onSourceClicked = onSourceClicked,
|
||||
historyInfo = historyInfo,
|
||||
readingTime = readingTime,
|
||||
onDownloadClick = onDownloadClick
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun MangaInfoLarge(
|
||||
coil: ImageLoader,
|
||||
appBarPadding: Dp,
|
||||
imageUrl: String,
|
||||
favicon: Uri,
|
||||
title: String,
|
||||
altTitle: String,
|
||||
author: String,
|
||||
source: MangaSource,
|
||||
state: MangaState?,
|
||||
historyInfo: HistoryInfo,
|
||||
readingTime: ReadingTime?,
|
||||
isInShelf: Boolean,
|
||||
onAddToShelfClicked: () -> Unit,
|
||||
onCoverClick: () -> Unit,
|
||||
onSourceClicked: () -> Unit,
|
||||
onDownloadClick: () -> Unit,
|
||||
) {
|
||||
Column(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.padding(start = 16.dp, top = appBarPadding + 16.dp, end = 16.dp),
|
||||
horizontalAlignment = Alignment.CenterHorizontally,
|
||||
) {
|
||||
MangaCover.Book(
|
||||
coil = coil,
|
||||
modifier = Modifier
|
||||
.fillMaxWidth(0.65f)
|
||||
.clickable(
|
||||
role = Role.Button,
|
||||
onClick = onCoverClick
|
||||
),
|
||||
data = imageUrl,
|
||||
contentDescription = stringResource(R.string.manga_cover),
|
||||
)
|
||||
Spacer(modifier = Modifier.height(16.dp))
|
||||
DetailsContentInfo(
|
||||
coil = coil,
|
||||
favicon = favicon,
|
||||
title = title,
|
||||
altTitle = altTitle,
|
||||
author = author,
|
||||
state = state,
|
||||
source = source.title,
|
||||
isInShelf = isInShelf,
|
||||
onAddToShelfClicked = onAddToShelfClicked,
|
||||
onSourceClicked = onSourceClicked,
|
||||
historyInfo = historyInfo,
|
||||
readingTime = readingTime,
|
||||
onDownloadClick = onDownloadClick
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun MangaInfoSmall(
|
||||
coil: ImageLoader,
|
||||
appBarPadding: Dp,
|
||||
imageUrl: String,
|
||||
favicon: Uri,
|
||||
title: String,
|
||||
altTitle: String,
|
||||
author: String,
|
||||
state: MangaState?,
|
||||
source: MangaSource,
|
||||
historyInfo: HistoryInfo,
|
||||
readingTime: ReadingTime?,
|
||||
isInShelf: Boolean,
|
||||
onAddToShelfClicked: () -> Unit,
|
||||
onCoverClick: () -> Unit,
|
||||
onSourceClicked: () -> Unit,
|
||||
onDownloadClick: () -> Unit,
|
||||
) {
|
||||
Column(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.padding(top = appBarPadding + 32.dp),
|
||||
verticalArrangement = Arrangement.spacedBy(8.dp),
|
||||
horizontalAlignment = Alignment.CenterHorizontally,
|
||||
) {
|
||||
AsyncImageImpl(
|
||||
coil = coil,
|
||||
modifier = Modifier
|
||||
.padding(horizontal = 16.dp)
|
||||
.sizeIn(maxWidth = 54.dp)
|
||||
.align(Alignment.Start)
|
||||
.aspectRatio(1f)
|
||||
.clip(CircleShape)
|
||||
.clickable(
|
||||
role = Role.Button,
|
||||
onClick = onCoverClick
|
||||
),
|
||||
model = imageUrl,
|
||||
contentDescription = stringResource(R.string.manga_cover),
|
||||
)
|
||||
DetailsContentInfo(
|
||||
coil = coil,
|
||||
favicon = favicon,
|
||||
title = title,
|
||||
altTitle = altTitle,
|
||||
author = author,
|
||||
state = state,
|
||||
source = source.title,
|
||||
isInShelf = isInShelf,
|
||||
onAddToShelfClicked = onAddToShelfClicked,
|
||||
onSourceClicked = onSourceClicked,
|
||||
historyInfo = historyInfo,
|
||||
readingTime = readingTime,
|
||||
onDownloadClick = onDownloadClick
|
||||
)
|
||||
}
|
||||
}
|
||||
@ -1,129 +0,0 @@
|
||||
package org.xtimms.shirizu.sections.details
|
||||
|
||||
import android.net.Uri
|
||||
import androidx.compose.foundation.BorderStroke
|
||||
import androidx.compose.foundation.clickable
|
||||
import androidx.compose.foundation.layout.Box
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.aspectRatio
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.material3.AssistChipDefaults
|
||||
import androidx.compose.material3.ElevatedAssistChip
|
||||
import androidx.compose.material3.LocalContentColor
|
||||
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.draw.clip
|
||||
import androidx.compose.ui.layout.ContentScale
|
||||
import androidx.compose.ui.semantics.Role
|
||||
import androidx.compose.ui.unit.Dp
|
||||
import androidx.compose.ui.unit.dp
|
||||
import coil.ImageLoader
|
||||
import org.koitharu.kotatsu.parsers.model.MangaSource
|
||||
import org.koitharu.kotatsu.parsers.model.MangaState
|
||||
import org.xtimms.shirizu.core.AsyncImageImpl
|
||||
import org.xtimms.shirizu.sections.details.data.ReadingTime
|
||||
import org.xtimms.shirizu.sections.details.model.HistoryInfo
|
||||
|
||||
@Composable
|
||||
fun ModernDetailsInfoBox(
|
||||
coil: ImageLoader,
|
||||
imageUrl: String,
|
||||
favicon: Uri,
|
||||
title: String,
|
||||
altTitle: String,
|
||||
author: String,
|
||||
isNsfw: Boolean,
|
||||
state: MangaState?,
|
||||
source: MangaSource,
|
||||
historyInfo: HistoryInfo,
|
||||
readingTime: ReadingTime?,
|
||||
isTabletUi: Boolean,
|
||||
appBarPadding: Dp,
|
||||
modifier: Modifier = Modifier,
|
||||
onCoverClick: () -> Unit,
|
||||
isInShelf: Boolean,
|
||||
onAddToShelfClicked: () -> Unit,
|
||||
onSourceClicked: () -> Unit,
|
||||
onDownloadClick: () -> Unit,
|
||||
) {
|
||||
Column(modifier = modifier) {
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth(),
|
||||
contentAlignment = Alignment.BottomEnd,
|
||||
) {
|
||||
AsyncImageImpl(
|
||||
coil = coil,
|
||||
model = imageUrl,
|
||||
contentDescription = null,
|
||||
contentScale = ContentScale.Crop,
|
||||
modifier = Modifier
|
||||
.padding(start = 16.dp, end = 16.dp)
|
||||
.aspectRatio(1f)
|
||||
.clickable(
|
||||
role = Role.Button,
|
||||
onClick = onCoverClick
|
||||
)
|
||||
.clip(MaterialTheme.shapes.large)
|
||||
)
|
||||
if (isNsfw) {
|
||||
ElevatedAssistChip(
|
||||
modifier = Modifier.padding(end = 32.dp, bottom = 8.dp),
|
||||
onClick = { /*TODO*/ },
|
||||
label = {
|
||||
Text(
|
||||
text = "18+",
|
||||
color = MaterialTheme.colorScheme.onErrorContainer
|
||||
)
|
||||
},
|
||||
border = BorderStroke(1.dp, MaterialTheme.colorScheme.errorContainer),
|
||||
colors = AssistChipDefaults.elevatedAssistChipColors()
|
||||
.copy(containerColor = MaterialTheme.colorScheme.errorContainer)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
CompositionLocalProvider(LocalContentColor provides MaterialTheme.colorScheme.onSurface) {
|
||||
if (!isTabletUi) {
|
||||
MangaAndSourceTitlesSmall(
|
||||
coil = coil,
|
||||
favicon = favicon,
|
||||
title = title,
|
||||
altTitle = altTitle,
|
||||
author = author,
|
||||
state = state,
|
||||
source = source,
|
||||
isInShelf = isInShelf,
|
||||
onAddToShelfClicked = onAddToShelfClicked,
|
||||
onSourceClicked = onSourceClicked,
|
||||
historyInfo = historyInfo,
|
||||
readingTime = readingTime,
|
||||
onDownloadClick = onDownloadClick
|
||||
)
|
||||
} else {
|
||||
MangaAndSourceTitlesLarge(
|
||||
coil = coil,
|
||||
appBarPadding = appBarPadding,
|
||||
imageUrl = imageUrl,
|
||||
favicon = favicon,
|
||||
title = title,
|
||||
altTitle = altTitle,
|
||||
author = author,
|
||||
state = state,
|
||||
source = source,
|
||||
isInShelf = isInShelf,
|
||||
onAddToShelfClicked = onAddToShelfClicked,
|
||||
onSourceClicked = onSourceClicked,
|
||||
historyInfo = historyInfo,
|
||||
readingTime = readingTime,
|
||||
onDownloadClick = onDownloadClick
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue