mirror of
https://github.com/mihonapp/mihon.git
synced 2024-11-07 03:07:25 +01:00
parent
8d00ff1b40
commit
46e3b9e40d
@ -110,7 +110,7 @@ abstract class TrackService(val id: Long) {
|
|||||||
val hasReadChapters = allChapters.any { it.read }
|
val hasReadChapters = allChapters.any { it.read }
|
||||||
bind(item, hasReadChapters)
|
bind(item, hasReadChapters)
|
||||||
|
|
||||||
val track = item.toDomainTrack(idRequired = false) ?: return@withIOContext
|
var track = item.toDomainTrack(idRequired = false) ?: return@withIOContext
|
||||||
|
|
||||||
Injekt.get<InsertTrack>().await(track)
|
Injekt.get<InsertTrack>().await(track)
|
||||||
|
|
||||||
@ -123,10 +123,10 @@ abstract class TrackService(val id: Long) {
|
|||||||
?.chapterNumber?.toDouble() ?: -1.0
|
?.chapterNumber?.toDouble() ?: -1.0
|
||||||
|
|
||||||
if (latestLocalReadChapterNumber > track.lastChapterRead) {
|
if (latestLocalReadChapterNumber > track.lastChapterRead) {
|
||||||
val updatedTrack = track.copy(
|
track = track.copy(
|
||||||
lastChapterRead = latestLocalReadChapterNumber,
|
lastChapterRead = latestLocalReadChapterNumber,
|
||||||
)
|
)
|
||||||
setRemoteLastChapterRead(updatedTrack.toDbTrack(), latestLocalReadChapterNumber.toInt())
|
setRemoteLastChapterRead(track.toDbTrack(), latestLocalReadChapterNumber.toInt())
|
||||||
}
|
}
|
||||||
|
|
||||||
if (track.startDate <= 0) {
|
if (track.startDate <= 0) {
|
||||||
@ -137,6 +137,9 @@ abstract class TrackService(val id: Long) {
|
|||||||
|
|
||||||
firstReadChapterDate?.let {
|
firstReadChapterDate?.let {
|
||||||
val startDate = firstReadChapterDate.time.convertEpochMillisZone(ZoneOffset.systemDefault(), ZoneOffset.UTC)
|
val startDate = firstReadChapterDate.time.convertEpochMillisZone(ZoneOffset.systemDefault(), ZoneOffset.UTC)
|
||||||
|
track = track.copy(
|
||||||
|
startDate = startDate,
|
||||||
|
)
|
||||||
setRemoteStartDate(track.toDbTrack(), startDate)
|
setRemoteStartDate(track.toDbTrack(), startDate)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
package androidx.recyclerview.widget
|
package androidx.recyclerview.widget
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
import androidx.recyclerview.widget.RecyclerView.NO_POSITION
|
import androidx.recyclerview.widget.RecyclerView.NO_POSITION
|
||||||
import eu.kanade.tachiyomi.ui.reader.ReaderActivity
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Layout manager used by the webtoon viewer. Item prefetch is disabled because the extra layout
|
* Layout manager used by the webtoon viewer. Item prefetch is disabled because the extra layout
|
||||||
@ -13,12 +13,12 @@ import eu.kanade.tachiyomi.ui.reader.ReaderActivity
|
|||||||
* This layout manager uses the same package name as the support library in order to use a package
|
* This layout manager uses the same package name as the support library in order to use a package
|
||||||
* protected method.
|
* protected method.
|
||||||
*/
|
*/
|
||||||
class WebtoonLayoutManager(activity: ReaderActivity) : LinearLayoutManager(activity) {
|
class WebtoonLayoutManager(context: Context) : LinearLayoutManager(context) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Extra layout space is set to half the screen height.
|
* Extra layout space is set to half the screen height.
|
||||||
*/
|
*/
|
||||||
private val extraLayoutSpace = activity.resources.displayMetrics.heightPixels / 2
|
private val extraLayoutSpace = context.resources.displayMetrics.heightPixels / 2
|
||||||
|
|
||||||
init {
|
init {
|
||||||
isItemPrefetchEnabled = false
|
isItemPrefetchEnabled = false
|
||||||
|
Loading…
Reference in New Issue
Block a user