[feat] Comic Reader

This commit is contained in:
acite
2025-09-01 20:41:28 +08:00
parent ea574895ab
commit daa66a9ecc
12 changed files with 703 additions and 41 deletions

View File

@@ -1,8 +1,50 @@
package com.acitelight.aether.model
data class Comic(
val comic_name: String,
val page_count: Int,
val bookmarks: List<BookMark>,
val pages: List<String>
)
import com.acitelight.aether.service.ApiClient
class Comic(
val comic: ComicResponse,
val id: String,
val token: String
)
{
fun getPage(pageNumber: Int): String
{
return "${ApiClient.base}api/image/$id/${comic.list[pageNumber]}?token=$token"
}
fun getPage(pageName: String): String?
{
val v = comic.list.indexOf(pageName)
if(v >= 0)
{
return getPage(v)
}
return null
}
fun getPageIndex(pageName: String): Int
{
return comic.list.indexOf(pageName)
}
fun getChapterLength(pageName: String): Int
{
var v = comic.list.indexOf(pageName)
if(v >= 0)
{
var r: Int = 1
v+=1
while(v < comic.list.size && !comic.bookmarks.any{
x -> x.page == comic.list[v]
}){
r++
v+=1
}
return r
}
return -1
}
}

View File

@@ -0,0 +1,9 @@
package com.acitelight.aether.model
data class ComicResponse(
val comic_name: String,
val page_count: Int,
val bookmarks: List<BookMark>,
val list: List<String>,
val author: String
)