Cleanup data classes
This commit is contained in:
1
.idea/gradle.xml
generated
1
.idea/gradle.xml
generated
@@ -14,7 +14,6 @@
|
|||||||
<option value="$PROJECT_DIR$/app" />
|
<option value="$PROJECT_DIR$/app" />
|
||||||
</set>
|
</set>
|
||||||
</option>
|
</option>
|
||||||
<option name="resolveModulePerSourceSet" value="false" />
|
|
||||||
</GradleProjectSettings>
|
</GradleProjectSettings>
|
||||||
</option>
|
</option>
|
||||||
</component>
|
</component>
|
||||||
|
|||||||
@@ -13,8 +13,8 @@ android {
|
|||||||
applicationId 'org.koitharu.kotatsu'
|
applicationId 'org.koitharu.kotatsu'
|
||||||
minSdkVersion 21
|
minSdkVersion 21
|
||||||
targetSdkVersion 31
|
targetSdkVersion 31
|
||||||
versionCode 370
|
versionCode 371
|
||||||
versionName '2.0-b2'
|
versionName '2.0-b3'
|
||||||
generatedDensities = []
|
generatedDensities = []
|
||||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||||
|
|
||||||
|
|||||||
4
app/proguard-rules.pro
vendored
4
app/proguard-rules.pro
vendored
@@ -5,9 +5,7 @@
|
|||||||
public static void checkReturnedValueIsNotNull(...);
|
public static void checkReturnedValueIsNotNull(...);
|
||||||
public static void checkFieldIsNotNull(...);
|
public static void checkFieldIsNotNull(...);
|
||||||
public static void checkParameterIsNotNull(...);
|
public static void checkParameterIsNotNull(...);
|
||||||
|
public static void checkNotNullParameter(...);
|
||||||
}
|
}
|
||||||
-keep class org.koitharu.kotatsu.core.db.entity.* { *; }
|
-keep class org.koitharu.kotatsu.core.db.entity.* { *; }
|
||||||
-keepclassmembers public class * extends org.koitharu.kotatsu.core.parser.MangaRepository {
|
|
||||||
public <init>(...);
|
|
||||||
}
|
|
||||||
-dontwarn okhttp3.internal.platform.ConscryptPlatform
|
-dontwarn okhttp3.internal.platform.ConscryptPlatform
|
||||||
@@ -5,7 +5,7 @@ import android.net.Uri
|
|||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import org.koitharu.kotatsu.core.model.Manga
|
import org.koitharu.kotatsu.core.model.Manga
|
||||||
|
|
||||||
data class MangaIntent(
|
class MangaIntent(
|
||||||
val manga: Manga?,
|
val manga: Manga?,
|
||||||
val mangaId: Long,
|
val mangaId: Long,
|
||||||
val uri: Uri?
|
val uri: Uri?
|
||||||
|
|||||||
@@ -96,11 +96,32 @@ class ChipsView @JvmOverloads constructor(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
data class ChipModel(
|
class ChipModel(
|
||||||
@DrawableRes val icon: Int,
|
@DrawableRes val icon: Int,
|
||||||
val title: CharSequence,
|
val title: CharSequence,
|
||||||
val data: Any? = null
|
val data: Any? = null
|
||||||
)
|
) {
|
||||||
|
|
||||||
|
override fun equals(other: Any?): Boolean {
|
||||||
|
if (this === other) return true
|
||||||
|
if (javaClass != other?.javaClass) return false
|
||||||
|
|
||||||
|
other as ChipModel
|
||||||
|
|
||||||
|
if (icon != other.icon) return false
|
||||||
|
if (title != other.title) return false
|
||||||
|
if (data != other.data) return false
|
||||||
|
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun hashCode(): Int {
|
||||||
|
var result = icon
|
||||||
|
result = 31 * result + title.hashCode()
|
||||||
|
result = 31 * result + data.hashCode()
|
||||||
|
return result
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fun interface OnChipClickListener {
|
fun interface OnChipClickListener {
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ package org.koitharu.kotatsu.core.backup
|
|||||||
|
|
||||||
import org.json.JSONArray
|
import org.json.JSONArray
|
||||||
|
|
||||||
data class BackupEntry(
|
class BackupEntry(
|
||||||
val name: String,
|
val name: String,
|
||||||
val data: JSONArray
|
val data: JSONArray
|
||||||
) {
|
) {
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import org.koitharu.kotatsu.core.model.MangaState
|
|||||||
import org.koitharu.kotatsu.core.model.MangaTag
|
import org.koitharu.kotatsu.core.model.MangaTag
|
||||||
|
|
||||||
@Entity(tableName = "manga")
|
@Entity(tableName = "manga")
|
||||||
data class MangaEntity(
|
class MangaEntity(
|
||||||
@PrimaryKey(autoGenerate = false)
|
@PrimaryKey(autoGenerate = false)
|
||||||
@ColumnInfo(name = "manga_id") val id: Long,
|
@ColumnInfo(name = "manga_id") val id: Long,
|
||||||
@ColumnInfo(name = "title") val title: String,
|
@ColumnInfo(name = "title") val title: String,
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ import androidx.room.PrimaryKey
|
|||||||
onDelete = ForeignKey.CASCADE
|
onDelete = ForeignKey.CASCADE
|
||||||
)]
|
)]
|
||||||
)
|
)
|
||||||
data class MangaPrefsEntity(
|
class MangaPrefsEntity(
|
||||||
@PrimaryKey(autoGenerate = false)
|
@PrimaryKey(autoGenerate = false)
|
||||||
@ColumnInfo(name = "manga_id") val mangaId: Long,
|
@ColumnInfo(name = "manga_id") val mangaId: Long,
|
||||||
@ColumnInfo(name = "mode") val mode: Int
|
@ColumnInfo(name = "mode") val mode: Int
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ import androidx.room.ForeignKey
|
|||||||
)
|
)
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
data class MangaTagsEntity(
|
class MangaTagsEntity(
|
||||||
@ColumnInfo(name = "manga_id", index = true) val mangaId: Long,
|
@ColumnInfo(name = "manga_id", index = true) val mangaId: Long,
|
||||||
@ColumnInfo(name = "tag_id", index = true) val tagId: Long
|
@ColumnInfo(name = "tag_id", index = true) val tagId: Long
|
||||||
)
|
)
|
||||||
@@ -5,7 +5,7 @@ import androidx.room.Junction
|
|||||||
import androidx.room.Relation
|
import androidx.room.Relation
|
||||||
import org.koitharu.kotatsu.utils.ext.mapToSet
|
import org.koitharu.kotatsu.utils.ext.mapToSet
|
||||||
|
|
||||||
data class MangaWithTags(
|
class MangaWithTags(
|
||||||
@Embedded val manga: MangaEntity,
|
@Embedded val manga: MangaEntity,
|
||||||
@Relation(
|
@Relation(
|
||||||
parentColumn = "manga_id",
|
parentColumn = "manga_id",
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ import androidx.room.PrimaryKey
|
|||||||
)
|
)
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
data class SuggestionEntity(
|
class SuggestionEntity(
|
||||||
@PrimaryKey(autoGenerate = false)
|
@PrimaryKey(autoGenerate = false)
|
||||||
@ColumnInfo(name = "manga_id", index = true) val mangaId: Long,
|
@ColumnInfo(name = "manga_id", index = true) val mangaId: Long,
|
||||||
@ColumnInfo(name = "relevance") val relevance: Float,
|
@ColumnInfo(name = "relevance") val relevance: Float,
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import org.koitharu.kotatsu.core.model.MangaTag
|
|||||||
import org.koitharu.kotatsu.utils.ext.longHashCode
|
import org.koitharu.kotatsu.utils.ext.longHashCode
|
||||||
|
|
||||||
@Entity(tableName = "tags")
|
@Entity(tableName = "tags")
|
||||||
data class TagEntity(
|
class TagEntity(
|
||||||
@PrimaryKey(autoGenerate = false)
|
@PrimaryKey(autoGenerate = false)
|
||||||
@ColumnInfo(name = "tag_id") val id: Long,
|
@ColumnInfo(name = "tag_id") val id: Long,
|
||||||
@ColumnInfo(name = "title") val title: String,
|
@ColumnInfo(name = "title") val title: String,
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ import androidx.room.PrimaryKey
|
|||||||
)
|
)
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
data class TrackEntity(
|
class TrackEntity(
|
||||||
@PrimaryKey(autoGenerate = false)
|
@PrimaryKey(autoGenerate = false)
|
||||||
@ColumnInfo(name = "manga_id") val mangaId: Long,
|
@ColumnInfo(name = "manga_id") val mangaId: Long,
|
||||||
@ColumnInfo(name = "chapters_total") val totalChapters: Int,
|
@ColumnInfo(name = "chapters_total") val totalChapters: Int,
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ import androidx.room.PrimaryKey
|
|||||||
)
|
)
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
data class TrackLogEntity(
|
class TrackLogEntity(
|
||||||
@PrimaryKey(autoGenerate = true)
|
@PrimaryKey(autoGenerate = true)
|
||||||
@ColumnInfo(name = "id") val id: Long = 0L,
|
@ColumnInfo(name = "id") val id: Long = 0L,
|
||||||
@ColumnInfo(name = "manga_id", index = true) val mangaId: Long,
|
@ColumnInfo(name = "manga_id", index = true) val mangaId: Long,
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import org.koitharu.kotatsu.core.model.TrackingLogItem
|
|||||||
import org.koitharu.kotatsu.utils.ext.mapToSet
|
import org.koitharu.kotatsu.utils.ext.mapToSet
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
|
||||||
data class TrackLogWithManga(
|
class TrackLogWithManga(
|
||||||
@Embedded val trackLog: TrackLogEntity,
|
@Embedded val trackLog: TrackLogEntity,
|
||||||
@Relation(
|
@Relation(
|
||||||
parentColumn = "manga_id",
|
parentColumn = "manga_id",
|
||||||
|
|||||||
@@ -2,12 +2,12 @@ package org.koitharu.kotatsu.core.github
|
|||||||
|
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
|
||||||
data class VersionId(
|
class VersionId(
|
||||||
val major: Int,
|
val major: Int,
|
||||||
val minor: Int,
|
val minor: Int,
|
||||||
val build: Int,
|
val build: Int,
|
||||||
val variantType: String,
|
val variantType: String,
|
||||||
val variantNumber: Int
|
val variantNumber: Int,
|
||||||
) : Comparable<VersionId> {
|
) : Comparable<VersionId> {
|
||||||
|
|
||||||
override fun compareTo(other: VersionId): Int {
|
override fun compareTo(other: VersionId): Int {
|
||||||
@@ -30,6 +30,30 @@ data class VersionId(
|
|||||||
return variantNumber.compareTo(other.variantNumber)
|
return variantNumber.compareTo(other.variantNumber)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun equals(other: Any?): Boolean {
|
||||||
|
if (this === other) return true
|
||||||
|
if (javaClass != other?.javaClass) return false
|
||||||
|
|
||||||
|
other as VersionId
|
||||||
|
|
||||||
|
if (major != other.major) return false
|
||||||
|
if (minor != other.minor) return false
|
||||||
|
if (build != other.build) return false
|
||||||
|
if (variantType != other.variantType) return false
|
||||||
|
if (variantNumber != other.variantNumber) return false
|
||||||
|
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun hashCode(): Int {
|
||||||
|
var result = major
|
||||||
|
result = 31 * result + minor
|
||||||
|
result = 31 * result + build
|
||||||
|
result = 31 * result + variantType.hashCode()
|
||||||
|
result = 31 * result + variantNumber
|
||||||
|
return result
|
||||||
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
|
||||||
private fun variantWeight(variantType: String) =
|
private fun variantWeight(variantType: String) =
|
||||||
|
|||||||
@@ -9,8 +9,13 @@ data class MangaChapter(
|
|||||||
val name: String,
|
val name: String,
|
||||||
val number: Int,
|
val number: Int,
|
||||||
val url: String,
|
val url: String,
|
||||||
val scanlator: String? = null,
|
val scanlator: String?,
|
||||||
val uploadDate: Long,
|
val uploadDate: Long,
|
||||||
val branch: String? = null,
|
val branch: String?,
|
||||||
val source: MangaSource
|
val source: MangaSource,
|
||||||
) : Parcelable
|
) : Parcelable, Comparable<MangaChapter> {
|
||||||
|
|
||||||
|
override fun compareTo(other: MangaChapter): Int {
|
||||||
|
return number.compareTo(other.number)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -10,5 +10,5 @@ data class MangaHistory(
|
|||||||
val updatedAt: Date,
|
val updatedAt: Date,
|
||||||
val chapterId: Long,
|
val chapterId: Long,
|
||||||
val page: Int,
|
val page: Int,
|
||||||
val scroll: Int
|
val scroll: Int,
|
||||||
) : Parcelable
|
) : Parcelable
|
||||||
@@ -8,6 +8,6 @@ data class MangaPage(
|
|||||||
val id: Long,
|
val id: Long,
|
||||||
val url: String,
|
val url: String,
|
||||||
val referer: String,
|
val referer: String,
|
||||||
val preview: String? = null,
|
val preview: String?,
|
||||||
val source: MangaSource
|
val source: MangaSource,
|
||||||
) : Parcelable
|
) : Parcelable
|
||||||
@@ -14,7 +14,7 @@ import org.koitharu.kotatsu.local.domain.LocalMangaRepository
|
|||||||
enum class MangaSource(
|
enum class MangaSource(
|
||||||
val title: String,
|
val title: String,
|
||||||
val locale: String?,
|
val locale: String?,
|
||||||
val cls: Class<out MangaRepository>
|
val cls: Class<out MangaRepository>,
|
||||||
) : Parcelable {
|
) : Parcelable {
|
||||||
LOCAL("Local", null, LocalMangaRepository::class.java),
|
LOCAL("Local", null, LocalMangaRepository::class.java),
|
||||||
READMANGA_RU("ReadManga", "ru", ReadmangaRepository::class.java),
|
READMANGA_RU("ReadManga", "ru", ReadmangaRepository::class.java),
|
||||||
|
|||||||
@@ -7,5 +7,5 @@ import kotlinx.parcelize.Parcelize
|
|||||||
data class MangaTag(
|
data class MangaTag(
|
||||||
val title: String,
|
val title: String,
|
||||||
val key: String,
|
val key: String,
|
||||||
val source: MangaSource
|
val source: MangaSource,
|
||||||
) : Parcelable
|
) : Parcelable
|
||||||
@@ -87,8 +87,10 @@ class AnibelRepository(loaderContext: MangaLoaderContext) : RemoteMangaRepositor
|
|||||||
name = "Глава " + a.selectFirst("a")?.text().orEmpty(),
|
name = "Глава " + a.selectFirst("a")?.text().orEmpty(),
|
||||||
number = i + 1,
|
number = i + 1,
|
||||||
url = href,
|
url = href,
|
||||||
|
scanlator = null,
|
||||||
|
branch = null,
|
||||||
uploadDate = 0L,
|
uploadDate = 0L,
|
||||||
source = source
|
source = source,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
@@ -115,8 +117,9 @@ class AnibelRepository(loaderContext: MangaLoaderContext) : RemoteMangaRepositor
|
|||||||
MangaPage(
|
MangaPage(
|
||||||
id = generateUid(url),
|
id = generateUid(url),
|
||||||
url = url,
|
url = url,
|
||||||
|
preview = null,
|
||||||
referer = fullUrl,
|
referer = fullUrl,
|
||||||
source = source
|
source = source,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -88,8 +88,10 @@ abstract class ChanRepository(loaderContext: MangaLoaderContext) : RemoteMangaRe
|
|||||||
name = tr.selectFirst("a")?.text().orEmpty(),
|
name = tr.selectFirst("a")?.text().orEmpty(),
|
||||||
number = i + 1,
|
number = i + 1,
|
||||||
url = href,
|
url = href,
|
||||||
|
scanlator = null,
|
||||||
|
branch = null,
|
||||||
uploadDate = dateFormat.tryParse(tr.selectFirst("div.date")?.text()),
|
uploadDate = dateFormat.tryParse(tr.selectFirst("div.date")?.text()),
|
||||||
source = source
|
source = source,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
@@ -117,8 +119,9 @@ abstract class ChanRepository(loaderContext: MangaLoaderContext) : RemoteMangaRe
|
|||||||
MangaPage(
|
MangaPage(
|
||||||
id = generateUid(url),
|
id = generateUid(url),
|
||||||
url = url,
|
url = url,
|
||||||
|
preview = null,
|
||||||
referer = fullUrl,
|
referer = fullUrl,
|
||||||
source = source
|
source = source,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -101,7 +101,9 @@ class DesuMeRepository(loaderContext: MangaLoaderContext) : RemoteMangaRepositor
|
|||||||
url = "$baseChapterUrl$chid",
|
url = "$baseChapterUrl$chid",
|
||||||
uploadDate = it.getLong("date") * 1000,
|
uploadDate = it.getLong("date") * 1000,
|
||||||
name = if (title.isEmpty()) volChap else "$volChap: $title",
|
name = if (title.isEmpty()) volChap else "$volChap: $title",
|
||||||
number = totalChapters - i
|
number = totalChapters - i,
|
||||||
|
scanlator = null,
|
||||||
|
branch = null,
|
||||||
)
|
)
|
||||||
}.reversed()
|
}.reversed()
|
||||||
)
|
)
|
||||||
@@ -116,8 +118,9 @@ class DesuMeRepository(loaderContext: MangaLoaderContext) : RemoteMangaRepositor
|
|||||||
MangaPage(
|
MangaPage(
|
||||||
id = generateUid(jo.getLong("id")),
|
id = generateUid(jo.getLong("id")),
|
||||||
referer = fullUrl,
|
referer = fullUrl,
|
||||||
|
preview = null,
|
||||||
source = chapter.source,
|
source = chapter.source,
|
||||||
url = jo.getString("img")
|
url = jo.getString("img"),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -143,6 +143,8 @@ class ExHentaiRepository(
|
|||||||
url = url,
|
url = url,
|
||||||
uploadDate = 0L,
|
uploadDate = 0L,
|
||||||
source = source,
|
source = source,
|
||||||
|
scanlator = null,
|
||||||
|
branch = null,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
chapters
|
chapters
|
||||||
|
|||||||
@@ -142,7 +142,8 @@ abstract class GroupleRepository(loaderContext: MangaLoaderContext) :
|
|||||||
url = href,
|
url = href,
|
||||||
uploadDate = dateFormat.tryParse(tr.selectFirst("td.d-none")?.text()),
|
uploadDate = dateFormat.tryParse(tr.selectFirst("td.d-none")?.text()),
|
||||||
scanlator = translators,
|
scanlator = translators,
|
||||||
source = source
|
source = source,
|
||||||
|
branch = null,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
@@ -167,8 +168,9 @@ abstract class GroupleRepository(loaderContext: MangaLoaderContext) :
|
|||||||
MangaPage(
|
MangaPage(
|
||||||
id = generateUid(url),
|
id = generateUid(url),
|
||||||
url = url,
|
url = url,
|
||||||
|
preview = null,
|
||||||
referer = chapter.url,
|
referer = chapter.url,
|
||||||
source = source
|
source = source,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -50,7 +50,9 @@ class HenChanRepository(loaderContext: MangaLoaderContext) : ChanRepository(load
|
|||||||
source = source,
|
source = source,
|
||||||
number = 1,
|
number = 1,
|
||||||
uploadDate = 0L,
|
uploadDate = 0L,
|
||||||
name = manga.title
|
name = manga.title,
|
||||||
|
scanlator = null,
|
||||||
|
branch = null,
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -118,7 +118,8 @@ open class MangaLibRepository(loaderContext: MangaLoaderContext) :
|
|||||||
item.getString("chapter_created_at").substringBefore(" ")
|
item.getString("chapter_created_at").substringBefore(" ")
|
||||||
),
|
),
|
||||||
scanlator = scanlator,
|
scanlator = scanlator,
|
||||||
name = if (nameChapter.isNullOrBlank()) fullNameChapter else "$fullNameChapter - $nameChapter"
|
branch = null,
|
||||||
|
name = if (nameChapter.isNullOrBlank()) fullNameChapter else "$fullNameChapter - $nameChapter",
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -178,8 +179,9 @@ open class MangaLibRepository(loaderContext: MangaLoaderContext) :
|
|||||||
MangaPage(
|
MangaPage(
|
||||||
id = generateUid(pageUrl),
|
id = generateUid(pageUrl),
|
||||||
url = pageUrl,
|
url = pageUrl,
|
||||||
|
preview = null,
|
||||||
referer = fullUrl,
|
referer = fullUrl,
|
||||||
source = source
|
source = source,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -101,8 +101,10 @@ class MangaOwlRepository(loaderContext: MangaLoaderContext) : RemoteMangaReposit
|
|||||||
name = a.select("label").text(),
|
name = a.select("label").text(),
|
||||||
number = i + 1,
|
number = i + 1,
|
||||||
url = href,
|
url = href,
|
||||||
|
scanlator = null,
|
||||||
|
branch = null,
|
||||||
uploadDate = dateFormat.tryParse(li.selectFirst("small:last-of-type")?.text()),
|
uploadDate = dateFormat.tryParse(li.selectFirst("small:last-of-type")?.text()),
|
||||||
source = MangaSource.MANGAOWL
|
source = MangaSource.MANGAOWL,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
@@ -117,8 +119,9 @@ class MangaOwlRepository(loaderContext: MangaLoaderContext) : RemoteMangaReposit
|
|||||||
MangaPage(
|
MangaPage(
|
||||||
id = generateUid(url),
|
id = generateUid(url),
|
||||||
url = url,
|
url = url,
|
||||||
|
preview = null,
|
||||||
referer = fullUrl,
|
referer = fullUrl,
|
||||||
source = MangaSource.MANGAOWL
|
source = MangaSource.MANGAOWL,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -124,7 +124,9 @@ class MangaTownRepository(loaderContext: MangaLoaderContext) :
|
|||||||
dateFormat,
|
dateFormat,
|
||||||
li.selectFirst("span.time")?.text()
|
li.selectFirst("span.time")?.text()
|
||||||
),
|
),
|
||||||
name = name.ifEmpty { "${manga.title} - ${i + 1}" }
|
name = name.ifEmpty { "${manga.title} - ${i + 1}" },
|
||||||
|
scanlator = null,
|
||||||
|
branch = null,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
@@ -143,8 +145,9 @@ class MangaTownRepository(loaderContext: MangaLoaderContext) :
|
|||||||
MangaPage(
|
MangaPage(
|
||||||
id = generateUid(href),
|
id = generateUid(href),
|
||||||
url = href,
|
url = href,
|
||||||
|
preview = null,
|
||||||
referer = fullUrl,
|
referer = fullUrl,
|
||||||
source = MangaSource.MANGATOWN
|
source = MangaSource.MANGATOWN,
|
||||||
)
|
)
|
||||||
} ?: parseFailed("Pages list not found")
|
} ?: parseFailed("Pages list not found")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -146,7 +146,9 @@ class MangareadRepository(
|
|||||||
dateFormat,
|
dateFormat,
|
||||||
doc2.selectFirst("span.chapter-release-date i")?.text()
|
doc2.selectFirst("span.chapter-release-date i")?.text()
|
||||||
),
|
),
|
||||||
source = MangaSource.MANGAREAD
|
source = MangaSource.MANGAREAD,
|
||||||
|
scanlator = null,
|
||||||
|
branch = null,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
@@ -164,8 +166,9 @@ class MangareadRepository(
|
|||||||
MangaPage(
|
MangaPage(
|
||||||
id = generateUid(url),
|
id = generateUid(url),
|
||||||
url = url,
|
url = url,
|
||||||
|
preview = null,
|
||||||
referer = fullUrl,
|
referer = fullUrl,
|
||||||
source = MangaSource.MANGAREAD
|
source = MangaSource.MANGAREAD,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -114,6 +114,8 @@ abstract class NineMangaRepository(
|
|||||||
url = href,
|
url = href,
|
||||||
uploadDate = parseChapterDateByLang(li.selectFirst("span")?.text().orEmpty()),
|
uploadDate = parseChapterDateByLang(li.selectFirst("span")?.text().orEmpty()),
|
||||||
source = source,
|
source = source,
|
||||||
|
scanlator = null,
|
||||||
|
branch = null,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -130,7 +130,8 @@ class RemangaRepository(loaderContext: MangaLoaderContext) : RemoteMangaReposito
|
|||||||
},
|
},
|
||||||
uploadDate = dateFormat.tryParse(jo.getString("upload_date")),
|
uploadDate = dateFormat.tryParse(jo.getString("upload_date")),
|
||||||
scanlator = publishers.optJSONObject(0)?.getStringOrNull("name"),
|
scanlator = publishers.optJSONObject(0)?.getStringOrNull("name"),
|
||||||
source = MangaSource.REMANGA
|
source = MangaSource.REMANGA,
|
||||||
|
branch = null,
|
||||||
)
|
)
|
||||||
}.asReversed()
|
}.asReversed()
|
||||||
)
|
)
|
||||||
@@ -175,8 +176,9 @@ class RemangaRepository(loaderContext: MangaLoaderContext) : RemoteMangaReposito
|
|||||||
private fun parsePage(jo: JSONObject, referer: String) = MangaPage(
|
private fun parsePage(jo: JSONObject, referer: String) = MangaPage(
|
||||||
id = generateUid(jo.getLong("id")),
|
id = generateUid(jo.getLong("id")),
|
||||||
url = jo.getString("link"),
|
url = jo.getString("link"),
|
||||||
|
preview = null,
|
||||||
referer = referer,
|
referer = referer,
|
||||||
source = source
|
source = source,
|
||||||
)
|
)
|
||||||
|
|
||||||
private companion object {
|
private companion object {
|
||||||
|
|||||||
@@ -30,7 +30,9 @@ class YaoiChanRepository(loaderContext: MangaLoaderContext) : ChanRepository(loa
|
|||||||
number = i + 1,
|
number = i + 1,
|
||||||
url = href,
|
url = href,
|
||||||
uploadDate = 0L,
|
uploadDate = 0L,
|
||||||
source = source
|
source = source,
|
||||||
|
scanlator = null,
|
||||||
|
branch = null,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -14,16 +14,35 @@ sealed class DateTimeAgo : ListModel {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
data class MinutesAgo(val minutes: Int) : DateTimeAgo() {
|
class MinutesAgo(val minutes: Int) : DateTimeAgo() {
|
||||||
|
|
||||||
override fun format(resources: Resources): String {
|
override fun format(resources: Resources): String {
|
||||||
return resources.getQuantityString(R.plurals.minutes_ago, minutes, minutes)
|
return resources.getQuantityString(R.plurals.minutes_ago, minutes, minutes)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun equals(other: Any?): Boolean {
|
||||||
|
if (this === other) return true
|
||||||
|
if (javaClass != other?.javaClass) return false
|
||||||
|
other as MinutesAgo
|
||||||
|
return minutes == other.minutes
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun hashCode(): Int = minutes
|
||||||
}
|
}
|
||||||
|
|
||||||
data class HoursAgo(val hours: Int) : DateTimeAgo() {
|
class HoursAgo(val hours: Int) : DateTimeAgo() {
|
||||||
override fun format(resources: Resources): String {
|
override fun format(resources: Resources): String {
|
||||||
return resources.getQuantityString(R.plurals.hours_ago, hours, hours)
|
return resources.getQuantityString(R.plurals.hours_ago, hours, hours)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun equals(other: Any?): Boolean {
|
||||||
|
if (this === other) return true
|
||||||
|
if (javaClass != other?.javaClass) return false
|
||||||
|
other as HoursAgo
|
||||||
|
return hours == other.hours
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun hashCode(): Int = hours
|
||||||
}
|
}
|
||||||
|
|
||||||
object Today : DateTimeAgo() {
|
object Today : DateTimeAgo() {
|
||||||
@@ -38,10 +57,19 @@ sealed class DateTimeAgo : ListModel {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
data class DaysAgo(val days: Int) : DateTimeAgo() {
|
class DaysAgo(val days: Int) : DateTimeAgo() {
|
||||||
override fun format(resources: Resources): String {
|
override fun format(resources: Resources): String {
|
||||||
return resources.getQuantityString(R.plurals.days_ago, days, days)
|
return resources.getQuantityString(R.plurals.days_ago, days, days)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun equals(other: Any?): Boolean {
|
||||||
|
if (this === other) return true
|
||||||
|
if (javaClass != other?.javaClass) return false
|
||||||
|
other as DaysAgo
|
||||||
|
return days == other.days
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun hashCode(): Int = days
|
||||||
}
|
}
|
||||||
|
|
||||||
object LongAgo : DateTimeAgo() {
|
object LongAgo : DateTimeAgo() {
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import org.koitharu.kotatsu.core.model.SortOrder
|
|||||||
import java.util.*
|
import java.util.*
|
||||||
|
|
||||||
@Entity(tableName = "favourite_categories")
|
@Entity(tableName = "favourite_categories")
|
||||||
data class FavouriteCategoryEntity(
|
class FavouriteCategoryEntity(
|
||||||
@PrimaryKey(autoGenerate = true)
|
@PrimaryKey(autoGenerate = true)
|
||||||
@ColumnInfo(name = "category_id") val categoryId: Int,
|
@ColumnInfo(name = "category_id") val categoryId: Int,
|
||||||
@ColumnInfo(name = "created_at") val createdAt: Long,
|
@ColumnInfo(name = "created_at") val createdAt: Long,
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ import org.koitharu.kotatsu.core.db.entity.MangaEntity
|
|||||||
)
|
)
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
data class FavouriteEntity(
|
class FavouriteEntity(
|
||||||
@ColumnInfo(name = "manga_id", index = true) val mangaId: Long,
|
@ColumnInfo(name = "manga_id", index = true) val mangaId: Long,
|
||||||
@ColumnInfo(name = "category_id", index = true) val categoryId: Long,
|
@ColumnInfo(name = "category_id", index = true) val categoryId: Long,
|
||||||
@ColumnInfo(name = "created_at") val createdAt: Long
|
@ColumnInfo(name = "created_at") val createdAt: Long
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import org.koitharu.kotatsu.core.db.entity.MangaEntity
|
|||||||
import org.koitharu.kotatsu.core.db.entity.MangaTagsEntity
|
import org.koitharu.kotatsu.core.db.entity.MangaTagsEntity
|
||||||
import org.koitharu.kotatsu.core.db.entity.TagEntity
|
import org.koitharu.kotatsu.core.db.entity.TagEntity
|
||||||
|
|
||||||
data class FavouriteManga(
|
class FavouriteManga(
|
||||||
@Embedded val favourite: FavouriteEntity,
|
@Embedded val favourite: FavouriteEntity,
|
||||||
@Relation(
|
@Relation(
|
||||||
parentColumn = "manga_id",
|
parentColumn = "manga_id",
|
||||||
|
|||||||
@@ -18,14 +18,14 @@ import java.util.*
|
|||||||
)
|
)
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
data class HistoryEntity(
|
class HistoryEntity(
|
||||||
@PrimaryKey(autoGenerate = false)
|
@PrimaryKey(autoGenerate = false)
|
||||||
@ColumnInfo(name = "manga_id") val mangaId: Long,
|
@ColumnInfo(name = "manga_id") val mangaId: Long,
|
||||||
@ColumnInfo(name = "created_at") val createdAt: Long = System.currentTimeMillis(),
|
@ColumnInfo(name = "created_at") val createdAt: Long = System.currentTimeMillis(),
|
||||||
@ColumnInfo(name = "updated_at") val updatedAt: Long,
|
@ColumnInfo(name = "updated_at") val updatedAt: Long,
|
||||||
@ColumnInfo(name = "chapter_id") val chapterId: Long,
|
@ColumnInfo(name = "chapter_id") val chapterId: Long,
|
||||||
@ColumnInfo(name = "page") val page: Int,
|
@ColumnInfo(name = "page") val page: Int,
|
||||||
@ColumnInfo(name = "scroll") val scroll: Float
|
@ColumnInfo(name = "scroll") val scroll: Float,
|
||||||
) {
|
) {
|
||||||
|
|
||||||
fun toMangaHistory() = MangaHistory(
|
fun toMangaHistory() = MangaHistory(
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import org.koitharu.kotatsu.core.db.entity.MangaEntity
|
|||||||
import org.koitharu.kotatsu.core.db.entity.MangaTagsEntity
|
import org.koitharu.kotatsu.core.db.entity.MangaTagsEntity
|
||||||
import org.koitharu.kotatsu.core.db.entity.TagEntity
|
import org.koitharu.kotatsu.core.db.entity.TagEntity
|
||||||
|
|
||||||
data class HistoryWithManga(
|
class HistoryWithManga(
|
||||||
@Embedded val history: HistoryEntity,
|
@Embedded val history: HistoryEntity,
|
||||||
@Relation(
|
@Relation(
|
||||||
parentColumn = "manga_id",
|
parentColumn = "manga_id",
|
||||||
|
|||||||
@@ -69,8 +69,9 @@ class LocalMangaRepository(private val context: Context) : MangaRepository {
|
|||||||
MangaPage(
|
MangaPage(
|
||||||
id = entryUri.longHashCode(),
|
id = entryUri.longHashCode(),
|
||||||
url = entryUri,
|
url = entryUri,
|
||||||
|
preview = null,
|
||||||
referer = chapter.url,
|
referer = chapter.url,
|
||||||
source = MangaSource.LOCAL
|
source = MangaSource.LOCAL,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user