[feat] Comic Bookmark

This commit is contained in:
acite
2025-09-05 12:57:50 +08:00
parent 18d021a8e5
commit 514e99d7db
7 changed files with 161 additions and 50 deletions

View File

@@ -2,12 +2,9 @@ package com.acitelight.aether.view
import androidx.compose.foundation.background
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.PaddingValues
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
@@ -22,36 +19,28 @@ import androidx.compose.material3.Card
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateListOf
import androidx.compose.runtime.remember
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.Brush
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.layout.ContentScale
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import androidx.lifecycle.viewmodel.compose.viewModel
import androidx.navigation.NavHostController
import coil3.compose.AsyncImage
import coil3.request.ImageRequest
import com.acitelight.aether.Global
import com.acitelight.aether.ToggleFullScreen
import com.acitelight.aether.model.BookMark
import com.acitelight.aether.model.Comic
import com.acitelight.aether.model.ComicRecordDatabase
import com.acitelight.aether.viewModel.ComicGridViewModel
import java.util.EnumSet.range
import java.util.stream.IntStream.range
@Composable
fun ComicGridView(comicId: String, navController: NavHostController, comicGridViewModel: ComicGridViewModel = viewModel()) {
comicGridViewModel.SetupClient()
comicGridViewModel.Resolve(comicId.hexToString())
comicGridViewModel.resolve(comicId.hexToString())
comicGridViewModel.updateProcess(comicId.hexToString()){}
ToggleFullScreen(false)
@@ -104,9 +93,9 @@ fun ComicGridView(comicId: String, navController: NavHostController, comicGridVi
comicGridViewModel.updateProcess(comicId.hexToString())
{
if(record != null) {
val k = comic!!.getPageChapterIndex(record!!.position)!!
val k = comic!!.getPageChapterIndex(record!!.position)
val route = "comic_page_route/${"${comic!!.id}".toHex()}/${
comic!!.getPageIndex(k.first.page)
record!!.position
}"
navController.navigate(route)
}else
@@ -121,7 +110,7 @@ fun ComicGridView(comicId: String, navController: NavHostController, comicGridVi
Row(Modifier.fillMaxWidth().align(Alignment.Center).padding(horizontal = 8.dp)) {
if(record != null)
{
val k = comic!!.getPageChapterIndex(record!!.position)!!
val k = comic!!.getPageChapterIndex(record!!.position)
Text(
text = "Last Read Position: ${k.first.name} ${k.second}/${comic!!.getChapterLength(k.first.page)}",