mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-11-10 04:01:58 +01:00
Update linter
This commit is contained in:
parent
37100f0937
commit
f0eb42e72d
192 changed files with 318 additions and 437 deletions
5
.editorconfig
Normal file
5
.editorconfig
Normal file
|
@ -0,0 +1,5 @@
|
|||
[*.{kt,kts}]
|
||||
indent_size=4
|
||||
insert_final_newline=true
|
||||
ij_kotlin_allow_trailing_comma=true
|
||||
ij_kotlin_allow_trailing_comma_on_call_site=true
|
|
@ -112,7 +112,7 @@ abstract class AbstractBackupRestore<T : AbstractBackupManager>(protected val co
|
|||
internal fun showRestoreProgress(
|
||||
progress: Int,
|
||||
amount: Int,
|
||||
title: String
|
||||
title: String,
|
||||
) {
|
||||
notifier.showRestoreProgress(title, progress, amount)
|
||||
}
|
||||
|
|
|
@ -144,7 +144,7 @@ class BackupNotifier(private val context: Context) {
|
|||
addAction(
|
||||
R.drawable.ic_folder_24dp,
|
||||
context.getString(R.string.action_show_errors),
|
||||
errorLogIntent,
|
||||
errorLogIntent
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
@ -93,7 +93,7 @@ class FullBackupRestore(context: Context, notifier: BackupNotifier) : AbstractBa
|
|||
categories: List<Int>,
|
||||
history: List<BackupHistory>,
|
||||
tracks: List<Track>,
|
||||
backupCategories: List<BackupCategory>
|
||||
backupCategories: List<BackupCategory>,
|
||||
) {
|
||||
db.inTransaction {
|
||||
val dbManga = backupManager.getMangaFromDatabase(manga)
|
||||
|
@ -123,7 +123,7 @@ class FullBackupRestore(context: Context, notifier: BackupNotifier) : AbstractBa
|
|||
categories: List<Int>,
|
||||
history: List<BackupHistory>,
|
||||
tracks: List<Track>,
|
||||
backupCategories: List<BackupCategory>
|
||||
backupCategories: List<BackupCategory>,
|
||||
) {
|
||||
try {
|
||||
val fetchedManga = backupManager.restoreManga(manga)
|
||||
|
@ -143,7 +143,7 @@ class FullBackupRestore(context: Context, notifier: BackupNotifier) : AbstractBa
|
|||
categories: List<Int>,
|
||||
history: List<BackupHistory>,
|
||||
tracks: List<Track>,
|
||||
backupCategories: List<BackupCategory>
|
||||
backupCategories: List<BackupCategory>,
|
||||
) {
|
||||
backupManager.restoreChaptersForManga(backupManga, chapters)
|
||||
|
||||
|
|
|
@ -9,5 +9,5 @@ data class Backup(
|
|||
@ProtoNumber(2) var backupCategories: List<BackupCategory> = emptyList(),
|
||||
// Bump by 100 to specify this is a 0.x value
|
||||
@ProtoNumber(100) var backupBrokenSources: List<BrokenBackupSource> = emptyList(),
|
||||
@ProtoNumber(101) var backupSources: List<BackupSource> = emptyList()
|
||||
@ProtoNumber(101) var backupSources: List<BackupSource> = emptyList(),
|
||||
)
|
||||
|
|
|
@ -6,11 +6,11 @@ import kotlinx.serialization.protobuf.ProtoNumber
|
|||
@Serializable
|
||||
data class BrokenBackupHistory(
|
||||
@ProtoNumber(0) var url: String,
|
||||
@ProtoNumber(1) var lastRead: Long
|
||||
@ProtoNumber(1) var lastRead: Long,
|
||||
)
|
||||
|
||||
@Serializable
|
||||
data class BackupHistory(
|
||||
@ProtoNumber(1) var url: String,
|
||||
@ProtoNumber(2) var lastRead: Long
|
||||
@ProtoNumber(2) var lastRead: Long,
|
||||
)
|
||||
|
|
|
@ -35,7 +35,7 @@ data class BackupManga(
|
|||
@ProtoNumber(101) var chapterFlags: Int = 0,
|
||||
@ProtoNumber(102) var brokenHistory: List<BrokenBackupHistory> = emptyList(),
|
||||
@ProtoNumber(103) var viewer_flags: Int? = null,
|
||||
@ProtoNumber(104) var history: List<BackupHistory> = emptyList()
|
||||
@ProtoNumber(104) var history: List<BackupHistory> = emptyList(),
|
||||
) {
|
||||
fun getMangaImpl(): MangaImpl {
|
||||
return MangaImpl().apply {
|
||||
|
|
|
@ -7,13 +7,13 @@ import kotlinx.serialization.protobuf.ProtoNumber
|
|||
@Serializable
|
||||
data class BrokenBackupSource(
|
||||
@ProtoNumber(0) var name: String = "",
|
||||
@ProtoNumber(1) var sourceId: Long
|
||||
@ProtoNumber(1) var sourceId: Long,
|
||||
)
|
||||
|
||||
@Serializable
|
||||
data class BackupSource(
|
||||
@ProtoNumber(1) var name: String = "",
|
||||
@ProtoNumber(2) var sourceId: Long
|
||||
@ProtoNumber(2) var sourceId: Long,
|
||||
) {
|
||||
companion object {
|
||||
fun copyFrom(source: Source): BackupSource {
|
||||
|
|
|
@ -109,7 +109,7 @@ class LegacyBackupRestore(context: Context, notifier: BackupNotifier) : Abstract
|
|||
chapters: List<Chapter>,
|
||||
categories: List<String>,
|
||||
history: List<DHistory>,
|
||||
tracks: List<Track>
|
||||
tracks: List<Track>,
|
||||
) {
|
||||
val dbManga = backupManager.getMangaFromDatabase(manga)
|
||||
|
||||
|
@ -139,7 +139,7 @@ class LegacyBackupRestore(context: Context, notifier: BackupNotifier) : Abstract
|
|||
chapters: List<Chapter>,
|
||||
categories: List<String>,
|
||||
history: List<DHistory>,
|
||||
tracks: List<Track>
|
||||
tracks: List<Track>,
|
||||
) {
|
||||
try {
|
||||
val fetchedManga = backupManager.fetchManga(source, manga)
|
||||
|
@ -161,7 +161,7 @@ class LegacyBackupRestore(context: Context, notifier: BackupNotifier) : Abstract
|
|||
chapters: List<Chapter>,
|
||||
categories: List<String>,
|
||||
history: List<DHistory>,
|
||||
tracks: List<Track>
|
||||
tracks: List<Track>,
|
||||
) {
|
||||
if (!backupManager.restoreChaptersForManga(backupManga, chapters)) {
|
||||
updateChapters(source, backupManga, chapters)
|
||||
|
|
|
@ -15,7 +15,7 @@ data class Backup(
|
|||
val version: Int? = null,
|
||||
var mangas: MutableList<MangaObject> = mutableListOf(),
|
||||
var categories: List<@Contextual Category>? = null,
|
||||
var extensions: List<String>? = null
|
||||
var extensions: List<String>? = null,
|
||||
) {
|
||||
companion object {
|
||||
const val CURRENT_VERSION = 2
|
||||
|
@ -33,5 +33,5 @@ data class MangaObject(
|
|||
var chapters: List<@Contextual Chapter>? = null,
|
||||
var categories: List<String>? = null,
|
||||
var track: List<@Contextual Track>? = null,
|
||||
var history: List<@Contextual DHistory>? = null
|
||||
var history: List<@Contextual DHistory>? = null,
|
||||
)
|
||||
|
|
|
@ -47,7 +47,7 @@ class MangaCoverFetcher(
|
|||
private val options: Options,
|
||||
private val coverCache: CoverCache,
|
||||
private val callFactoryLazy: Lazy<Call.Factory>,
|
||||
private val diskCacheLazy: Lazy<DiskCache>
|
||||
private val diskCacheLazy: Lazy<DiskCache>,
|
||||
) : Fetcher {
|
||||
|
||||
// For non-custom cover
|
||||
|
@ -273,7 +273,7 @@ class MangaCoverFetcher(
|
|||
|
||||
class Factory(
|
||||
private val callFactoryLazy: Lazy<Call.Factory>,
|
||||
private val diskCacheLazy: Lazy<DiskCache>
|
||||
private val diskCacheLazy: Lazy<DiskCache>,
|
||||
) : Fetcher.Factory<Manga> {
|
||||
|
||||
private val coverCache: CoverCache by injectLazy()
|
||||
|
|
|
@ -42,7 +42,7 @@ interface MangaQueries : DbProvider {
|
|||
.where("${MangaTable.COL_FAVORITE} = 1 AND LOWER(${MangaTable.COL_TITLE}) = ? AND ${MangaTable.COL_SOURCE} != ?")
|
||||
.whereArgs(
|
||||
manga.title.lowercase(),
|
||||
manga.source,
|
||||
manga.source
|
||||
)
|
||||
.limit(1)
|
||||
.build()
|
||||
|
|
|
@ -73,7 +73,7 @@ object TrackTable {
|
|||
|INSERT INTO $TABLE($COL_ID,$COL_MANGA_ID,$COL_SYNC_ID,$COL_MEDIA_ID,$COL_LIBRARY_ID,$COL_TITLE,$COL_LAST_CHAPTER_READ,$COL_TOTAL_CHAPTERS,$COL_STATUS,$COL_SCORE,$COL_TRACKING_URL,$COL_START_DATE,$COL_FINISH_DATE)
|
||||
|SELECT $COL_ID,$COL_MANGA_ID,$COL_SYNC_ID,$COL_MEDIA_ID,$COL_LIBRARY_ID,$COL_TITLE,$COL_LAST_CHAPTER_READ,$COL_TOTAL_CHAPTERS,$COL_STATUS,$COL_SCORE,$COL_TRACKING_URL,$COL_START_DATE,$COL_FINISH_DATE
|
||||
|FROM ${TABLE}_tmp
|
||||
""".trimMargin()
|
||||
""".trimMargin()
|
||||
|
||||
val dropTempTable: String
|
||||
get() = "DROP TABLE ${TABLE}_tmp"
|
||||
|
|
|
@ -27,7 +27,7 @@ class DownloadCache(
|
|||
private val context: Context,
|
||||
private val provider: DownloadProvider,
|
||||
private val sourceManager: SourceManager,
|
||||
private val preferences: PreferencesHelper = Injekt.get()
|
||||
private val preferences: PreferencesHelper = Injekt.get(),
|
||||
) {
|
||||
|
||||
/**
|
||||
|
@ -236,7 +236,7 @@ class DownloadCache(
|
|||
*/
|
||||
private class RootDirectory(
|
||||
val dir: UniFile,
|
||||
var files: Map<Long, SourceDirectory> = hashMapOf()
|
||||
var files: Map<Long, SourceDirectory> = hashMapOf(),
|
||||
)
|
||||
|
||||
/**
|
||||
|
@ -244,7 +244,7 @@ class DownloadCache(
|
|||
*/
|
||||
private class SourceDirectory(
|
||||
val dir: UniFile,
|
||||
var files: Map<String, MangaDirectory> = hashMapOf()
|
||||
var files: Map<String, MangaDirectory> = hashMapOf(),
|
||||
)
|
||||
|
||||
/**
|
||||
|
@ -252,7 +252,7 @@ class DownloadCache(
|
|||
*/
|
||||
private class MangaDirectory(
|
||||
val dir: UniFile,
|
||||
var files: Set<String> = hashSetOf()
|
||||
var files: Set<String> = hashSetOf(),
|
||||
)
|
||||
|
||||
/**
|
||||
|
|
|
@ -30,7 +30,7 @@ import uy.kohesive.injekt.injectLazy
|
|||
*/
|
||||
class DownloadManager(
|
||||
private val context: Context,
|
||||
private val db: DatabaseHelper = Injekt.get()
|
||||
private val db: DatabaseHelper = Injekt.get(),
|
||||
) {
|
||||
|
||||
private val sourceManager: SourceManager by injectLazy()
|
||||
|
|
|
@ -126,7 +126,7 @@ class DownloadPendingDeleter(context: Context) {
|
|||
@Serializable
|
||||
private data class Entry(
|
||||
val chapters: List<ChapterEntry>,
|
||||
val manga: MangaEntry
|
||||
val manga: MangaEntry,
|
||||
)
|
||||
|
||||
/**
|
||||
|
@ -137,7 +137,7 @@ class DownloadPendingDeleter(context: Context) {
|
|||
val id: Long,
|
||||
val url: String,
|
||||
val name: String,
|
||||
val scanlator: String? = null
|
||||
val scanlator: String? = null,
|
||||
)
|
||||
|
||||
/**
|
||||
|
@ -148,7 +148,7 @@ class DownloadPendingDeleter(context: Context) {
|
|||
val id: Long,
|
||||
val url: String,
|
||||
val title: String,
|
||||
val source: Long
|
||||
val source: Long,
|
||||
)
|
||||
|
||||
/**
|
||||
|
|
|
@ -177,7 +177,9 @@ class DownloadService : Service() {
|
|||
*/
|
||||
private fun listenDownloaderState() {
|
||||
subscriptions += downloadManager.runningRelay
|
||||
.doOnError { /* Swallow wakelock error */ }
|
||||
.doOnError {
|
||||
/* Swallow wakelock error */
|
||||
}
|
||||
.subscribe { running ->
|
||||
if (running) {
|
||||
wakeLock.acquireIfNeeded()
|
||||
|
|
|
@ -20,7 +20,7 @@ import uy.kohesive.injekt.injectLazy
|
|||
*/
|
||||
class DownloadStore(
|
||||
context: Context,
|
||||
private val sourceManager: SourceManager
|
||||
private val sourceManager: SourceManager,
|
||||
) {
|
||||
|
||||
/**
|
||||
|
|
|
@ -60,7 +60,7 @@ class Downloader(
|
|||
private val context: Context,
|
||||
private val provider: DownloadProvider,
|
||||
private val cache: DownloadCache,
|
||||
private val sourceManager: SourceManager
|
||||
private val sourceManager: SourceManager,
|
||||
) {
|
||||
|
||||
private val chapterCache: ChapterCache by injectLazy()
|
||||
|
@ -478,7 +478,7 @@ class Downloader(
|
|||
download: Download,
|
||||
mangaDir: UniFile,
|
||||
tmpDir: UniFile,
|
||||
dirname: String
|
||||
dirname: String,
|
||||
) {
|
||||
// Ensure that the chapter folder has all the images.
|
||||
val downloadedImages = tmpDir.listFiles().orEmpty().filterNot { it.name!!.endsWith(".tmp") }
|
||||
|
|
|
@ -11,7 +11,7 @@ import java.util.concurrent.CopyOnWriteArrayList
|
|||
|
||||
class DownloadQueue(
|
||||
private val store: DownloadStore,
|
||||
private val queue: MutableList<Download> = CopyOnWriteArrayList()
|
||||
private val queue: MutableList<Download> = CopyOnWriteArrayList(),
|
||||
) : List<Download> by queue {
|
||||
|
||||
private val statusSubject = PublishSubject.create<Download>()
|
||||
|
|
|
@ -77,7 +77,7 @@ class LibraryUpdateService(
|
|||
val preferences: PreferencesHelper = Injekt.get(),
|
||||
val downloadManager: DownloadManager = Injekt.get(),
|
||||
val trackManager: TrackManager = Injekt.get(),
|
||||
val coverCache: CoverCache = Injekt.get()
|
||||
val coverCache: CoverCache = Injekt.get(),
|
||||
) : Service() {
|
||||
|
||||
private lateinit var wakeLock: PowerManager.WakeLock
|
||||
|
@ -310,7 +310,7 @@ class LibraryUpdateService(
|
|||
withUpdateNotification(
|
||||
currentlyUpdatingManga,
|
||||
progressCount,
|
||||
manga,
|
||||
manga
|
||||
) { manga ->
|
||||
try {
|
||||
when {
|
||||
|
@ -383,7 +383,7 @@ class LibraryUpdateService(
|
|||
val errorFile = writeErrorFile(failedUpdates)
|
||||
notifier.showUpdateErrorNotification(
|
||||
failedUpdates.size,
|
||||
errorFile.getUriCompat(this),
|
||||
errorFile.getUriCompat(this)
|
||||
)
|
||||
}
|
||||
if (skippedUpdates.isNotEmpty()) {
|
||||
|
@ -446,7 +446,7 @@ class LibraryUpdateService(
|
|||
withUpdateNotification(
|
||||
currentlyUpdatingManga,
|
||||
progressCount,
|
||||
manga,
|
||||
manga
|
||||
) { manga ->
|
||||
sourceManager.get(manga.source)?.let { source ->
|
||||
try {
|
||||
|
|
|
@ -461,7 +461,7 @@ class NotificationReceiver : BroadcastReceiver() {
|
|||
context: Context,
|
||||
manga: Manga,
|
||||
chapters: Array<Chapter>,
|
||||
groupId: Int
|
||||
groupId: Int,
|
||||
): PendingIntent {
|
||||
val newIntent = Intent(context, NotificationReceiver::class.java).apply {
|
||||
action = ACTION_MARK_AS_READ
|
||||
|
@ -483,7 +483,7 @@ class NotificationReceiver : BroadcastReceiver() {
|
|||
context: Context,
|
||||
manga: Manga,
|
||||
chapters: Array<Chapter>,
|
||||
groupId: Int
|
||||
groupId: Int,
|
||||
): PendingIntent {
|
||||
val newIntent = Intent(context, NotificationReceiver::class.java).apply {
|
||||
action = ACTION_DOWNLOAD_CHAPTER
|
||||
|
|
|
@ -87,7 +87,7 @@ object Notifications {
|
|||
"backup_restore_complete_channel",
|
||||
"library_channel",
|
||||
"library_progress_channel",
|
||||
"updates_ext_channel",
|
||||
"updates_ext_channel"
|
||||
)
|
||||
|
||||
/**
|
||||
|
@ -115,7 +115,7 @@ object Notifications {
|
|||
},
|
||||
buildNotificationChannelGroup(GROUP_APK_UPDATES) {
|
||||
setName(context.getString(R.string.label_recent_updates))
|
||||
},
|
||||
}
|
||||
)
|
||||
)
|
||||
|
||||
|
@ -181,7 +181,7 @@ object Notifications {
|
|||
buildNotificationChannel(CHANNEL_EXTENSIONS_UPDATE, IMPORTANCE_DEFAULT) {
|
||||
setGroup(GROUP_APK_UPDATES)
|
||||
setName(context.getString(R.string.channel_ext_updates))
|
||||
},
|
||||
}
|
||||
)
|
||||
)
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ import java.io.File
|
|||
import java.io.InputStream
|
||||
|
||||
class ImageSaver(
|
||||
val context: Context
|
||||
val context: Context,
|
||||
) {
|
||||
|
||||
@SuppressLint("InlinedApi")
|
||||
|
@ -83,18 +83,18 @@ class ImageSaver(
|
|||
|
||||
sealed class Image(
|
||||
open val name: String,
|
||||
open val location: Location
|
||||
open val location: Location,
|
||||
) {
|
||||
data class Cover(
|
||||
val bitmap: Bitmap,
|
||||
override val name: String,
|
||||
override val location: Location
|
||||
override val location: Location,
|
||||
) : Image(name, location)
|
||||
|
||||
data class Page(
|
||||
val inputStream: () -> InputStream,
|
||||
override val name: String,
|
||||
override val location: Location
|
||||
override val location: Location,
|
||||
) : Image(name, location)
|
||||
|
||||
val data: () -> InputStream
|
||||
|
|
|
@ -43,7 +43,8 @@ class AnilistApi(val client: OkHttpClient, interceptor: AnilistInterceptor) {
|
|||
| status
|
||||
|}
|
||||
|}
|
||||
|""".trimMargin()
|
||||
|
|
||||
""".trimMargin()
|
||||
val payload = buildJsonObject {
|
||||
put("query", query)
|
||||
putJsonObject("variables") {
|
||||
|
@ -84,7 +85,8 @@ class AnilistApi(val client: OkHttpClient, interceptor: AnilistInterceptor) {
|
|||
|progress
|
||||
|}
|
||||
|}
|
||||
|""".trimMargin()
|
||||
|
|
||||
""".trimMargin()
|
||||
val payload = buildJsonObject {
|
||||
put("query", query)
|
||||
putJsonObject("variables") {
|
||||
|
@ -127,7 +129,8 @@ class AnilistApi(val client: OkHttpClient, interceptor: AnilistInterceptor) {
|
|||
|}
|
||||
|}
|
||||
|}
|
||||
|""".trimMargin()
|
||||
|
|
||||
""".trimMargin()
|
||||
val payload = buildJsonObject {
|
||||
put("query", query)
|
||||
putJsonObject("variables") {
|
||||
|
@ -193,7 +196,8 @@ class AnilistApi(val client: OkHttpClient, interceptor: AnilistInterceptor) {
|
|||
|}
|
||||
|}
|
||||
|}
|
||||
|""".trimMargin()
|
||||
|
|
||||
""".trimMargin()
|
||||
val payload = buildJsonObject {
|
||||
put("query", query)
|
||||
putJsonObject("variables") {
|
||||
|
@ -238,7 +242,8 @@ class AnilistApi(val client: OkHttpClient, interceptor: AnilistInterceptor) {
|
|||
|}
|
||||
|}
|
||||
|}
|
||||
|""".trimMargin()
|
||||
|
|
||||
""".trimMargin()
|
||||
val payload = buildJsonObject {
|
||||
put("query", query)
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@ data class ALManga(
|
|||
val format: String,
|
||||
val publishing_status: String,
|
||||
val start_date_fuzzy: Long,
|
||||
val total_chapters: Int
|
||||
val total_chapters: Int,
|
||||
) {
|
||||
|
||||
fun toTrack() = TrackSearch.create(TrackManager.ANILIST).apply {
|
||||
|
@ -46,7 +46,7 @@ data class ALUserManga(
|
|||
val chapters_read: Int,
|
||||
val start_date_fuzzy: Long,
|
||||
val completed_date_fuzzy: Long,
|
||||
val manga: ALManga
|
||||
val manga: ALManga,
|
||||
) {
|
||||
|
||||
fun toTrack() = Track.create(TrackManager.ANILIST).apply {
|
||||
|
|
|
@ -7,7 +7,7 @@ data class OAuth(
|
|||
val access_token: String,
|
||||
val token_type: String,
|
||||
val expires: Long,
|
||||
val expires_in: Long
|
||||
val expires_in: Long,
|
||||
) {
|
||||
|
||||
fun isExpired() = System.currentTimeMillis() > expires
|
||||
|
|
|
@ -6,5 +6,5 @@ import kotlinx.serialization.Serializable
|
|||
data class Avatar(
|
||||
val large: String? = "",
|
||||
val medium: String? = "",
|
||||
val small: String? = ""
|
||||
val small: String? = "",
|
||||
)
|
||||
|
|
|
@ -12,5 +12,5 @@ data class Collection(
|
|||
val status: Status? = Status(),
|
||||
val tag: List<String?>? = listOf(),
|
||||
val user: User? = User(),
|
||||
val vol_status: Int? = 0
|
||||
val vol_status: Int? = 0,
|
||||
)
|
||||
|
|
|
@ -9,7 +9,7 @@ data class OAuth(
|
|||
val created_at: Long = System.currentTimeMillis() / 1000,
|
||||
val expires_in: Long,
|
||||
val refresh_token: String?,
|
||||
val user_id: Long?
|
||||
val user_id: Long?,
|
||||
) {
|
||||
|
||||
// Access token refresh before expired
|
||||
|
|
|
@ -6,5 +6,5 @@ import kotlinx.serialization.Serializable
|
|||
data class Status(
|
||||
val id: Int? = 0,
|
||||
val name: String? = "",
|
||||
val type: String? = ""
|
||||
val type: String? = "",
|
||||
)
|
||||
|
|
|
@ -10,5 +10,5 @@ data class User(
|
|||
val sign: String? = "",
|
||||
val url: String? = "",
|
||||
val usergroup: Int? = 0,
|
||||
val username: String? = ""
|
||||
val username: String? = "",
|
||||
)
|
||||
|
|
|
@ -39,7 +39,7 @@ class DelayedTrackingStore(context: Context) {
|
|||
DelayedTrackingItem(
|
||||
trackId = it.key.toLong(),
|
||||
mangaId = mangaId.toLong(),
|
||||
lastChapterRead = lastChapterRead.toFloat(),
|
||||
lastChapterRead = lastChapterRead.toFloat()
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -137,7 +137,7 @@ class KitsuApi(private val client: OkHttpClient, interceptor: KitsuInterceptor)
|
|||
"X-Algolia-Application-Id",
|
||||
algoliaAppId,
|
||||
"X-Algolia-API-Key",
|
||||
key,
|
||||
key
|
||||
),
|
||||
body = jsonObject.toString().toRequestBody(jsonMime)
|
||||
)
|
||||
|
|
|
@ -8,7 +8,7 @@ data class OAuth(
|
|||
val token_type: String,
|
||||
val created_at: Long,
|
||||
val expires_in: Long,
|
||||
val refresh_token: String?
|
||||
val refresh_token: String?,
|
||||
) {
|
||||
|
||||
fun isExpired() = (System.currentTimeMillis() / 1000) > (created_at + expires_in - 3600)
|
||||
|
|
|
@ -15,7 +15,7 @@ data class SeriesDto(
|
|||
val booksUnreadCount: Int,
|
||||
val booksInProgressCount: Int,
|
||||
val metadata: SeriesMetadataDto,
|
||||
val booksMetadata: BookMetadataAggregationDto
|
||||
val booksMetadata: BookMetadataAggregationDto,
|
||||
)
|
||||
|
||||
@Serializable
|
||||
|
@ -38,7 +38,7 @@ data class SeriesMetadataDto(
|
|||
val genres: Set<String>,
|
||||
val genresLock: Boolean,
|
||||
val tags: Set<String>,
|
||||
val tagsLock: Boolean
|
||||
val tagsLock: Boolean,
|
||||
)
|
||||
|
||||
@Serializable
|
||||
|
@ -49,13 +49,13 @@ data class BookMetadataAggregationDto(
|
|||
val summaryNumber: String,
|
||||
|
||||
val created: String,
|
||||
val lastModified: String
|
||||
val lastModified: String,
|
||||
)
|
||||
|
||||
@Serializable
|
||||
data class AuthorDto(
|
||||
val name: String,
|
||||
val role: String
|
||||
val role: String,
|
||||
)
|
||||
|
||||
@Serializable
|
||||
|
@ -75,7 +75,7 @@ data class ReadListDto(
|
|||
val bookIds: List<String>,
|
||||
val createdDate: String,
|
||||
val lastModifiedDate: String,
|
||||
val filtered: Boolean
|
||||
val filtered: Boolean,
|
||||
)
|
||||
|
||||
@Serializable
|
||||
|
@ -92,7 +92,7 @@ data class ReadProgressDto(
|
|||
booksUnreadCount,
|
||||
booksInProgressCount,
|
||||
lastReadContinuousIndex.toFloat(),
|
||||
booksCount.toFloat(),
|
||||
booksCount.toFloat()
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ data class OAuth(
|
|||
val access_token: String,
|
||||
val token_type: String,
|
||||
val created_at: Long = System.currentTimeMillis(),
|
||||
val expires_in: Long
|
||||
val expires_in: Long,
|
||||
) {
|
||||
|
||||
fun isExpired() = System.currentTimeMillis() > created_at + (expires_in * 1000)
|
||||
|
|
|
@ -8,7 +8,7 @@ data class OAuth(
|
|||
val token_type: String,
|
||||
val created_at: Long,
|
||||
val expires_in: Long,
|
||||
val refresh_token: String?
|
||||
val refresh_token: String?,
|
||||
) {
|
||||
|
||||
// Access token lives 1 day
|
||||
|
|
|
@ -47,12 +47,12 @@ internal class AppUpdateNotifier(private val context: Context) {
|
|||
addAction(
|
||||
android.R.drawable.stat_sys_download_done,
|
||||
context.getString(R.string.action_download),
|
||||
updateIntent,
|
||||
updateIntent
|
||||
)
|
||||
addAction(
|
||||
R.drawable.ic_info_24dp,
|
||||
context.getString(R.string.whats_new),
|
||||
releaseInfoIntent,
|
||||
releaseInfoIntent
|
||||
)
|
||||
}
|
||||
notificationBuilder.show()
|
||||
|
|
|
@ -12,7 +12,7 @@ data class GithubRelease(
|
|||
@SerialName("tag_name") val version: String,
|
||||
@SerialName("body") val info: String,
|
||||
@SerialName("html_url") val releaseLink: String,
|
||||
@SerialName("assets") private val assets: List<Assets>
|
||||
@SerialName("assets") private val assets: List<Assets>,
|
||||
) {
|
||||
|
||||
/**
|
||||
|
|
|
@ -36,7 +36,7 @@ import uy.kohesive.injekt.api.get
|
|||
*/
|
||||
class ExtensionManager(
|
||||
private val context: Context,
|
||||
private val preferences: PreferencesHelper = Injekt.get()
|
||||
private val preferences: PreferencesHelper = Injekt.get(),
|
||||
) {
|
||||
|
||||
/**
|
||||
|
|
|
@ -125,6 +125,6 @@ private data class ExtensionJsonObject(
|
|||
private data class ExtensionSourceJsonObject(
|
||||
val name: String,
|
||||
val id: Long,
|
||||
val baseUrl: String
|
||||
val baseUrl: String,
|
||||
|
||||
)
|
||||
|
|
|
@ -28,7 +28,7 @@ sealed class Extension {
|
|||
val icon: Drawable?,
|
||||
val hasUpdate: Boolean = false,
|
||||
val isObsolete: Boolean = false,
|
||||
val isUnofficial: Boolean = false
|
||||
val isUnofficial: Boolean = false,
|
||||
) : Extension()
|
||||
|
||||
data class Available(
|
||||
|
@ -42,7 +42,7 @@ sealed class Extension {
|
|||
override val hasChangelog: Boolean,
|
||||
val sources: List<AvailableExtensionSources>,
|
||||
val apkName: String,
|
||||
val iconUrl: String
|
||||
val iconUrl: String,
|
||||
) : Extension()
|
||||
|
||||
data class Untrusted(
|
||||
|
@ -61,5 +61,5 @@ sealed class Extension {
|
|||
data class AvailableExtensionSources(
|
||||
val name: String,
|
||||
val id: Long,
|
||||
val baseUrl: String
|
||||
val baseUrl: String,
|
||||
)
|
||||
|
|
|
@ -72,7 +72,7 @@ class ExtensionInstallService : Service() {
|
|||
context: Context,
|
||||
downloadId: Long,
|
||||
uri: Uri,
|
||||
installer: PreferenceValues.ExtensionInstaller
|
||||
installer: PreferenceValues.ExtensionInstaller,
|
||||
): Intent {
|
||||
return Intent(context, ExtensionInstallService::class.java)
|
||||
.setDataAndType(uri, ExtensionInstaller.APK_MIME)
|
||||
|
|
|
@ -26,7 +26,7 @@ fun OkHttpClient.Builder.dohCloudflare() = dns(
|
|||
InetAddress.getByName("2606:4700:4700::1111"),
|
||||
InetAddress.getByName("2606:4700:4700::1001"),
|
||||
InetAddress.getByName("2606:4700:4700::0064"),
|
||||
InetAddress.getByName("2606:4700:4700::6400"),
|
||||
InetAddress.getByName("2606:4700:4700::6400")
|
||||
)
|
||||
.build()
|
||||
)
|
||||
|
@ -38,7 +38,7 @@ fun OkHttpClient.Builder.dohGoogle() = dns(
|
|||
InetAddress.getByName("8.8.4.4"),
|
||||
InetAddress.getByName("8.8.8.8"),
|
||||
InetAddress.getByName("2001:4860:4860::8888"),
|
||||
InetAddress.getByName("2001:4860:4860::8844"),
|
||||
InetAddress.getByName("2001:4860:4860::8844")
|
||||
)
|
||||
.build()
|
||||
)
|
||||
|
@ -52,7 +52,7 @@ fun OkHttpClient.Builder.dohAdGuard() = dns(
|
|||
InetAddress.getByName("94.140.14.140"),
|
||||
InetAddress.getByName("94.140.14.141"),
|
||||
InetAddress.getByName("2a10:50c0::1:ff"),
|
||||
InetAddress.getByName("2a10:50c0::2:ff"),
|
||||
InetAddress.getByName("2a10:50c0::2:ff")
|
||||
)
|
||||
.build()
|
||||
)
|
||||
|
@ -64,7 +64,7 @@ fun OkHttpClient.Builder.dohQuad9() = dns(
|
|||
InetAddress.getByName("9.9.9.9"),
|
||||
InetAddress.getByName("149.112.112.112"),
|
||||
InetAddress.getByName("2620:fe::fe"),
|
||||
InetAddress.getByName("2620:fe::9"),
|
||||
InetAddress.getByName("2620:fe::9")
|
||||
)
|
||||
.build()
|
||||
)
|
||||
|
|
|
@ -14,7 +14,7 @@ private val DEFAULT_BODY: RequestBody = FormBody.Builder().build()
|
|||
fun GET(
|
||||
url: String,
|
||||
headers: Headers = DEFAULT_HEADERS,
|
||||
cache: CacheControl = DEFAULT_CACHE_CONTROL
|
||||
cache: CacheControl = DEFAULT_CACHE_CONTROL,
|
||||
): Request {
|
||||
return Request.Builder()
|
||||
.url(url)
|
||||
|
@ -27,7 +27,7 @@ fun POST(
|
|||
url: String,
|
||||
headers: Headers = DEFAULT_HEADERS,
|
||||
body: RequestBody = DEFAULT_BODY,
|
||||
cache: CacheControl = DEFAULT_CACHE_CONTROL
|
||||
cache: CacheControl = DEFAULT_CACHE_CONTROL,
|
||||
): Request {
|
||||
return Request.Builder()
|
||||
.url(url)
|
||||
|
|
|
@ -135,7 +135,7 @@ class CloudflareInterceptor(private val context: Context) : Interceptor {
|
|||
errorCode: Int,
|
||||
description: String?,
|
||||
failingUrl: String,
|
||||
isMainFrame: Boolean
|
||||
isMainFrame: Boolean,
|
||||
) {
|
||||
if (isMainFrame) {
|
||||
if (errorCode in ERROR_CODES) {
|
||||
|
|
|
@ -186,7 +186,7 @@ class LocalSource(private val context: Context) : CatalogueSource, UnmeteredSour
|
|||
artist = obj["artist"]?.jsonPrimitive?.contentOrNull ?: manga.artist,
|
||||
description = obj["description"]?.jsonPrimitive?.contentOrNull ?: manga.description,
|
||||
genres = obj["genre"]?.jsonArray?.map { it.jsonPrimitive.content } ?: manga.genres,
|
||||
status = obj["status"]?.jsonPrimitive?.intOrNull ?: manga.status,
|
||||
status = obj["status"]?.jsonPrimitive?.intOrNull ?: manga.status
|
||||
)
|
||||
} else {
|
||||
manga
|
||||
|
@ -353,5 +353,5 @@ private val WHITESPACE_CHARS = arrayOf(
|
|||
'\u2029',
|
||||
'\u202F',
|
||||
'\u205F',
|
||||
'\u3000',
|
||||
'\u3000'
|
||||
)
|
||||
|
|
|
@ -12,7 +12,7 @@ open class Page(
|
|||
val index: Int,
|
||||
val url: String = "",
|
||||
var imageUrl: String? = null,
|
||||
@Transient var uri: Uri? = null // Deprecated but can't be deleted due to extensions
|
||||
@Transient var uri: Uri? = null, // Deprecated but can't be deleted due to extensions
|
||||
) : ProgressListener {
|
||||
|
||||
val number: Int
|
||||
|
|
|
@ -25,7 +25,7 @@ class OneWayFadeChangeHandler : FadeChangeHandler {
|
|||
from: View?,
|
||||
to: View?,
|
||||
isPush: Boolean,
|
||||
toAddedToContainer: Boolean
|
||||
toAddedToContainer: Boolean,
|
||||
): Animator {
|
||||
val animator = AnimatorSet()
|
||||
if (to != null) {
|
||||
|
|
|
@ -21,8 +21,7 @@ import reactivecircus.flowbinding.appcompat.queryTextEvents
|
|||
/**
|
||||
* Implementation of the NucleusController that has a built-in ViewSearch
|
||||
*/
|
||||
abstract class SearchableNucleusController<VB : ViewBinding, P : BasePresenter<*>>
|
||||
(bundle: Bundle? = null) : NucleusController<VB, P>(bundle) {
|
||||
abstract class SearchableNucleusController<VB : ViewBinding, P : BasePresenter<*>>(bundle: Bundle? = null) : NucleusController<VB, P>(bundle) {
|
||||
|
||||
enum class SearchViewState { LOADING, LOADED, COLLAPSING, FOCUSED }
|
||||
|
||||
|
@ -45,7 +44,7 @@ abstract class SearchableNucleusController<VB : ViewBinding, P : BasePresenter<*
|
|||
menuId: Int,
|
||||
searchItemId: Int,
|
||||
@StringRes queryHint: Int? = null,
|
||||
restoreCurrentQuery: Boolean = true
|
||||
restoreCurrentQuery: Boolean = true,
|
||||
) {
|
||||
// Inflate menu
|
||||
inflater.inflate(menuId, menu)
|
||||
|
|
|
@ -16,7 +16,7 @@ import eu.kanade.tachiyomi.R
|
|||
data class ExtensionGroupItem(
|
||||
val name: String,
|
||||
val size: Int,
|
||||
val showSize: Boolean = false
|
||||
val showSize: Boolean = false,
|
||||
) : AbstractHeaderItem<ExtensionGroupHolder>() {
|
||||
|
||||
var actionLabel: String? = null
|
||||
|
@ -43,7 +43,7 @@ data class ExtensionGroupItem(
|
|||
adapter: FlexibleAdapter<IFlexible<RecyclerView.ViewHolder>>,
|
||||
holder: ExtensionGroupHolder,
|
||||
position: Int,
|
||||
payloads: List<Any?>?
|
||||
payloads: List<Any?>?,
|
||||
) {
|
||||
holder.bind(this)
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ import eu.kanade.tachiyomi.source.CatalogueSource
|
|||
data class ExtensionItem(
|
||||
val extension: Extension,
|
||||
val header: ExtensionGroupItem? = null,
|
||||
val installStep: InstallStep = InstallStep.Idle
|
||||
val installStep: InstallStep = InstallStep.Idle,
|
||||
) :
|
||||
AbstractSectionableItem<ExtensionHolder, ExtensionGroupItem>(header) {
|
||||
|
||||
|
@ -44,7 +44,7 @@ data class ExtensionItem(
|
|||
adapter: FlexibleAdapter<IFlexible<RecyclerView.ViewHolder>>,
|
||||
holder: ExtensionHolder,
|
||||
position: Int,
|
||||
payloads: List<Any?>?
|
||||
payloads: List<Any?>?,
|
||||
) {
|
||||
if (payloads == null || payloads.isEmpty()) {
|
||||
holder.bind(this)
|
||||
|
|
|
@ -26,7 +26,7 @@ private typealias ExtensionTuple =
|
|||
*/
|
||||
open class ExtensionPresenter(
|
||||
private val extensionManager: ExtensionManager = Injekt.get(),
|
||||
private val preferences: PreferencesHelper = Injekt.get()
|
||||
private val preferences: PreferencesHelper = Injekt.get(),
|
||||
) : BasePresenter<ExtensionController>() {
|
||||
|
||||
private var extensions = emptyList<ExtensionItem>()
|
||||
|
@ -64,7 +64,7 @@ open class ExtensionPresenter(
|
|||
val items = mutableListOf<ExtensionItem>()
|
||||
|
||||
val updatesSorted = installed.filter { it.hasUpdate && (showNsfwSources || !it.isNsfw) }
|
||||
.sortedWith(compareBy(String.CASE_INSENSITIVE_ORDER, { it.name }))
|
||||
.sortedWith(compareBy(String.CASE_INSENSITIVE_ORDER) { it.name })
|
||||
|
||||
val installedSorted = installed.filter { !it.hasUpdate && (showNsfwSources || !it.isNsfw) }
|
||||
.sortedWith(
|
||||
|
@ -72,7 +72,7 @@ open class ExtensionPresenter(
|
|||
.thenBy(String.CASE_INSENSITIVE_ORDER) { it.name }
|
||||
)
|
||||
|
||||
val untrustedSorted = untrusted.sortedWith(compareBy(String.CASE_INSENSITIVE_ORDER, { it.name }))
|
||||
val untrustedSorted = untrusted.sortedWith(compareBy(String.CASE_INSENSITIVE_ORDER) { it.name })
|
||||
|
||||
val availableSorted = available
|
||||
// Filter out already installed extensions and disabled languages
|
||||
|
@ -82,7 +82,7 @@ open class ExtensionPresenter(
|
|||
avail.lang in activeLangs &&
|
||||
(showNsfwSources || !avail.isNsfw)
|
||||
}
|
||||
.sortedWith(compareBy(String.CASE_INSENSITIVE_ORDER, { it.name }))
|
||||
.sortedWith(compareBy(String.CASE_INSENSITIVE_ORDER) { it.name })
|
||||
|
||||
if (updatesSorted.isNotEmpty()) {
|
||||
val header = ExtensionGroupItem(context.getString(R.string.ext_updates_pending), updatesSorted.size, true)
|
||||
|
|
|
@ -7,7 +7,7 @@ import uy.kohesive.injekt.api.get
|
|||
|
||||
class SourcePreferencesPresenter(
|
||||
val sourceId: Long,
|
||||
sourceManager: SourceManager = Injekt.get()
|
||||
sourceManager: SourceManager = Injekt.get(),
|
||||
) : BasePresenter<SourcePreferencesController>() {
|
||||
|
||||
val source = sourceManager.get(sourceId)
|
||||
|
|
|
@ -8,7 +8,7 @@ import eu.kanade.tachiyomi.databinding.SourceListItemBinding
|
|||
|
||||
class MigrationMangaHolder(
|
||||
view: View,
|
||||
private val adapter: MigrationMangaAdapter
|
||||
private val adapter: MigrationMangaAdapter,
|
||||
) : FlexibleViewHolder(view, adapter) {
|
||||
|
||||
private val binding = SourceListItemBinding.bind(view)
|
||||
|
|
|
@ -22,7 +22,7 @@ class MigrationMangaItem(val manga: Manga) : AbstractFlexibleItem<MigrationManga
|
|||
adapter: FlexibleAdapter<IFlexible<RecyclerView.ViewHolder>>,
|
||||
holder: MigrationMangaHolder,
|
||||
position: Int,
|
||||
payloads: List<Any?>?
|
||||
payloads: List<Any?>?,
|
||||
) {
|
||||
holder.bind(this)
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@ import uy.kohesive.injekt.api.get
|
|||
|
||||
class MigrationMangaPresenter(
|
||||
private val sourceId: Long,
|
||||
private val db: DatabaseHelper = Injekt.get()
|
||||
private val db: DatabaseHelper = Injekt.get(),
|
||||
) : BasePresenter<MigrationMangaController>() {
|
||||
|
||||
override fun onCreate(savedState: Bundle?) {
|
||||
|
|
|
@ -19,7 +19,7 @@ import eu.kanade.tachiyomi.ui.manga.MangaController
|
|||
import uy.kohesive.injekt.injectLazy
|
||||
|
||||
class SearchController(
|
||||
private var manga: Manga? = null
|
||||
private var manga: Manga? = null,
|
||||
) : GlobalSearchController(manga?.title) {
|
||||
|
||||
private var newManga: Manga? = null
|
||||
|
@ -121,7 +121,7 @@ class SearchController(
|
|||
}
|
||||
(targetController as? SearchController)?.migrateManga(manga, newManga)
|
||||
}
|
||||
.setNegativeButton(R.string.copy) { _, _, ->
|
||||
.setNegativeButton(R.string.copy) { _, _ ->
|
||||
if (callingController != null) {
|
||||
if (callingController.javaClass == SourceSearchController::class.java) {
|
||||
router.popController(callingController)
|
||||
|
|
|
@ -27,7 +27,7 @@ import java.util.Date
|
|||
|
||||
class SearchPresenter(
|
||||
initialQuery: String? = "",
|
||||
private val manga: Manga
|
||||
private val manga: Manga,
|
||||
) : GlobalSearchPresenter(initialQuery) {
|
||||
|
||||
private val replacingMangaRelay = BehaviorRelay.create<Pair<Boolean, Manga?>>()
|
||||
|
@ -88,7 +88,7 @@ class SearchPresenter(
|
|||
sourceChapters: List<SChapter>,
|
||||
prevManga: Manga,
|
||||
manga: Manga,
|
||||
replace: Boolean
|
||||
replace: Boolean,
|
||||
) {
|
||||
val flags = preferences.migrateFlags().get()
|
||||
val migrateChapters =
|
||||
|
|
|
@ -8,7 +8,7 @@ import eu.kanade.tachiyomi.ui.browse.source.browse.BrowseSourceController
|
|||
import eu.kanade.tachiyomi.ui.browse.source.browse.SourceItem
|
||||
|
||||
class SourceSearchController(
|
||||
bundle: Bundle
|
||||
bundle: Bundle,
|
||||
) : BrowseSourceController(bundle) {
|
||||
|
||||
constructor(manga: Manga? = null, source: CatalogueSource, searchQuery: String? = null) : this(
|
||||
|
|
|
@ -20,7 +20,7 @@ import java.util.Locale
|
|||
|
||||
class MigrationSourcesPresenter(
|
||||
private val sourceManager: SourceManager = Injekt.get(),
|
||||
private val db: DatabaseHelper = Injekt.get()
|
||||
private val db: DatabaseHelper = Injekt.get(),
|
||||
) : BasePresenter<MigrationSourcesController>() {
|
||||
|
||||
private val preferences: PreferencesHelper by injectLazy()
|
||||
|
|
|
@ -38,7 +38,7 @@ class SelectionHeader : AbstractHeaderItem<SelectionHeader.Holder>() {
|
|||
adapter: FlexibleAdapter<IFlexible<RecyclerView.ViewHolder>>,
|
||||
holder: Holder,
|
||||
position: Int,
|
||||
payloads: List<Any?>?
|
||||
payloads: List<Any?>?,
|
||||
) {
|
||||
// Intentionally empty
|
||||
}
|
||||
|
|
|
@ -41,7 +41,7 @@ data class SourceItem(val source: Source, val mangaCount: Int, val header: Selec
|
|||
adapter: FlexibleAdapter<IFlexible<RecyclerView.ViewHolder>>,
|
||||
holder: SourceHolder,
|
||||
position: Int,
|
||||
payloads: List<Any?>?
|
||||
payloads: List<Any?>?,
|
||||
) {
|
||||
holder.bind(this)
|
||||
}
|
||||
|
|
|
@ -35,7 +35,7 @@ data class LangItem(val code: String) : AbstractHeaderItem<LangHolder>() {
|
|||
adapter: FlexibleAdapter<IFlexible<RecyclerView.ViewHolder>>,
|
||||
holder: LangHolder,
|
||||
position: Int,
|
||||
payloads: MutableList<Any>
|
||||
payloads: MutableList<Any>,
|
||||
) {
|
||||
holder.bind(this)
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ import eu.kanade.tachiyomi.source.CatalogueSource
|
|||
data class SourceItem(
|
||||
val source: CatalogueSource,
|
||||
val header: LangItem? = null,
|
||||
val isPinned: Boolean = false
|
||||
val isPinned: Boolean = false,
|
||||
) :
|
||||
AbstractSectionableItem<SourceHolder, LangItem>(header) {
|
||||
|
||||
|
@ -33,7 +33,7 @@ data class SourceItem(
|
|||
adapter: FlexibleAdapter<IFlexible<RecyclerView.ViewHolder>>,
|
||||
holder: SourceHolder,
|
||||
position: Int,
|
||||
payloads: MutableList<Any>
|
||||
payloads: MutableList<Any>,
|
||||
) {
|
||||
holder.bind(this)
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ import java.util.TreeMap
|
|||
*/
|
||||
class SourcePresenter(
|
||||
val sourceManager: SourceManager = Injekt.get(),
|
||||
private val preferences: PreferencesHelper = Injekt.get()
|
||||
private val preferences: PreferencesHelper = Injekt.get(),
|
||||
) : BasePresenter<SourceController>() {
|
||||
|
||||
var sources = getEnabledSources()
|
||||
|
|
|
@ -62,7 +62,7 @@ open class BrowseSourcePresenter(
|
|||
private val sourceManager: SourceManager = Injekt.get(),
|
||||
private val db: DatabaseHelper = Injekt.get(),
|
||||
private val prefs: PreferencesHelper = Injekt.get(),
|
||||
private val coverCache: CoverCache = Injekt.get()
|
||||
private val coverCache: CoverCache = Injekt.get(),
|
||||
) : BasePresenter<BrowseSourceController>() {
|
||||
|
||||
/**
|
||||
|
|
|
@ -18,7 +18,7 @@ import eu.kanade.tachiyomi.util.view.loadAutoPause
|
|||
*/
|
||||
class SourceComfortableGridHolder(
|
||||
override val binding: SourceComfortableGridItemBinding,
|
||||
adapter: FlexibleAdapter<*>
|
||||
adapter: FlexibleAdapter<*>,
|
||||
) : SourceHolder<SourceComfortableGridItemBinding>(binding.root, adapter) {
|
||||
|
||||
/**
|
||||
|
|
|
@ -18,7 +18,7 @@ import eu.kanade.tachiyomi.util.view.loadAutoPause
|
|||
*/
|
||||
class SourceCompactGridHolder(
|
||||
override val binding: SourceCompactGridItemBinding,
|
||||
adapter: FlexibleAdapter<*>
|
||||
adapter: FlexibleAdapter<*>,
|
||||
) : SourceHolder<SourceCompactGridItemBinding>(binding.root, adapter) {
|
||||
|
||||
/**
|
||||
|
|
|
@ -15,7 +15,7 @@ import eu.kanade.tachiyomi.widget.sheet.BaseBottomSheetDialog
|
|||
class SourceFilterSheet(
|
||||
activity: Activity,
|
||||
private val onFilterClicked: () -> Unit,
|
||||
private val onResetClicked: () -> Unit
|
||||
private val onResetClicked: () -> Unit,
|
||||
) : BaseBottomSheetDialog(activity) {
|
||||
|
||||
private var filterNavView: FilterNavigationView = FilterNavigationView(activity)
|
||||
|
@ -36,7 +36,7 @@ class SourceFilterSheet(
|
|||
|
||||
class FilterNavigationView @JvmOverloads constructor(
|
||||
context: Context,
|
||||
attrs: AttributeSet? = null
|
||||
attrs: AttributeSet? = null,
|
||||
) :
|
||||
SimpleNavigationView(context, attrs) {
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ class SourceItem(val manga: Manga, private val displayMode: Preference<DisplayMo
|
|||
|
||||
override fun createViewHolder(
|
||||
view: View,
|
||||
adapter: FlexibleAdapter<IFlexible<RecyclerView.ViewHolder>>
|
||||
adapter: FlexibleAdapter<IFlexible<RecyclerView.ViewHolder>>,
|
||||
): SourceHolder<*> {
|
||||
return when (displayMode.get()) {
|
||||
DisplayModeSetting.COMPACT_GRID, DisplayModeSetting.COVER_ONLY_GRID -> {
|
||||
|
@ -44,7 +44,7 @@ class SourceItem(val manga: Manga, private val displayMode: Preference<DisplayMo
|
|||
adapter: FlexibleAdapter<IFlexible<RecyclerView.ViewHolder>>,
|
||||
holder: SourceHolder<*>,
|
||||
position: Int,
|
||||
payloads: List<Any?>?
|
||||
payloads: List<Any?>?,
|
||||
) {
|
||||
holder.onSetValues(manga)
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@ class GlobalSearchCardItem(val manga: Manga) : AbstractFlexibleItem<GlobalSearch
|
|||
adapter: FlexibleAdapter<IFlexible<RecyclerView.ViewHolder>>,
|
||||
holder: GlobalSearchCardHolder,
|
||||
position: Int,
|
||||
payloads: List<Any?>?
|
||||
payloads: List<Any?>?,
|
||||
) {
|
||||
holder.bind(manga)
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@ import uy.kohesive.injekt.injectLazy
|
|||
*/
|
||||
open class GlobalSearchController(
|
||||
protected val initialQuery: String? = null,
|
||||
protected val extensionFilter: String? = null
|
||||
protected val extensionFilter: String? = null,
|
||||
) : SearchableNucleusController<GlobalSearchControllerBinding, GlobalSearchPresenter>(),
|
||||
GlobalSearchCardAdapter.OnMangaClickListener,
|
||||
GlobalSearchAdapter.OnTitleClickListener {
|
||||
|
|
|
@ -43,7 +43,7 @@ class GlobalSearchItem(val source: CatalogueSource, val results: List<GlobalSear
|
|||
adapter: FlexibleAdapter<IFlexible<RecyclerView.ViewHolder>>,
|
||||
holder: GlobalSearchHolder,
|
||||
position: Int,
|
||||
payloads: List<Any?>?
|
||||
payloads: List<Any?>?,
|
||||
) {
|
||||
holder.bind(this)
|
||||
}
|
||||
|
|
|
@ -39,7 +39,7 @@ open class GlobalSearchPresenter(
|
|||
val initialExtensionFilter: String? = null,
|
||||
val sourceManager: SourceManager = Injekt.get(),
|
||||
val db: DatabaseHelper = Injekt.get(),
|
||||
val preferences: PreferencesHelper = Injekt.get()
|
||||
val preferences: PreferencesHelper = Injekt.get(),
|
||||
) : BasePresenter<GlobalSearchController>() {
|
||||
|
||||
/**
|
||||
|
|
|
@ -47,7 +47,7 @@ class CategoryItem(val category: Category) : AbstractFlexibleItem<CategoryHolder
|
|||
adapter: FlexibleAdapter<IFlexible<RecyclerView.ViewHolder>>,
|
||||
holder: CategoryHolder,
|
||||
position: Int,
|
||||
payloads: List<Any?>?
|
||||
payloads: List<Any?>?,
|
||||
) {
|
||||
holder.bind(category)
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@ import uy.kohesive.injekt.api.get
|
|||
* Presenter of [CategoryController]. Used to manage the categories of the library.
|
||||
*/
|
||||
class CategoryPresenter(
|
||||
private val db: DatabaseHelper = Injekt.get()
|
||||
private val db: DatabaseHelper = Injekt.get(),
|
||||
) : BasePresenter<CategoryController>() {
|
||||
|
||||
/**
|
||||
|
|
|
@ -197,7 +197,9 @@ class DownloadController :
|
|||
onUpdateDownloadedPages(download)
|
||||
}
|
||||
Download.State.ERROR -> unsubscribeProgress(download)
|
||||
else -> { /* unused */ }
|
||||
else -> {
|
||||
/* unused */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ import eu.kanade.tachiyomi.R
|
|||
data class DownloadHeaderItem(
|
||||
val id: Long,
|
||||
val name: String,
|
||||
val size: Int
|
||||
val size: Int,
|
||||
) : AbstractExpandableHeaderItem<DownloadHeaderHolder, DownloadItem>() {
|
||||
|
||||
override fun getLayoutRes(): Int {
|
||||
|
@ -19,7 +19,7 @@ data class DownloadHeaderItem(
|
|||
|
||||
override fun createViewHolder(
|
||||
view: View,
|
||||
adapter: FlexibleAdapter<IFlexible<RecyclerView.ViewHolder>>
|
||||
adapter: FlexibleAdapter<IFlexible<RecyclerView.ViewHolder>>,
|
||||
): DownloadHeaderHolder {
|
||||
return DownloadHeaderHolder(view, adapter)
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ data class DownloadHeaderItem(
|
|||
adapter: FlexibleAdapter<IFlexible<RecyclerView.ViewHolder>>,
|
||||
holder: DownloadHeaderHolder,
|
||||
position: Int,
|
||||
payloads: List<Any?>?
|
||||
payloads: List<Any?>?,
|
||||
) {
|
||||
holder.bind(this)
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@ import eu.kanade.tachiyomi.data.download.model.Download
|
|||
|
||||
class DownloadItem(
|
||||
val download: Download,
|
||||
header: DownloadHeaderItem
|
||||
header: DownloadHeaderItem,
|
||||
) : AbstractSectionableItem<DownloadHolder, DownloadHeaderItem>(header) {
|
||||
|
||||
override fun getLayoutRes(): Int {
|
||||
|
@ -25,7 +25,7 @@ class DownloadItem(
|
|||
*/
|
||||
override fun createViewHolder(
|
||||
view: View,
|
||||
adapter: FlexibleAdapter<IFlexible<RecyclerView.ViewHolder>>
|
||||
adapter: FlexibleAdapter<IFlexible<RecyclerView.ViewHolder>>,
|
||||
): DownloadHolder {
|
||||
return DownloadHolder(view, adapter as DownloadAdapter)
|
||||
}
|
||||
|
@ -42,7 +42,7 @@ class DownloadItem(
|
|||
adapter: FlexibleAdapter<IFlexible<RecyclerView.ViewHolder>>,
|
||||
holder: DownloadHolder,
|
||||
position: Int,
|
||||
payloads: MutableList<Any>
|
||||
payloads: MutableList<Any>,
|
||||
) {
|
||||
holder.bind(download)
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@ class ChangeMangaCategoriesDialog<T>(bundle: Bundle? = null) :
|
|||
target: T,
|
||||
mangas: List<Manga>,
|
||||
categories: List<Category>,
|
||||
preselected: Array<Int>
|
||||
preselected: Array<Int>,
|
||||
) : this() {
|
||||
this.mangas = mangas
|
||||
this.categories = categories
|
||||
|
|
|
@ -24,7 +24,7 @@ class DeleteLibraryMangasDialog<T>(bundle: Bundle? = null) :
|
|||
val items = when (canDeleteChapters) {
|
||||
true -> listOf(
|
||||
R.string.manga_from_library,
|
||||
R.string.downloaded_chapters,
|
||||
R.string.downloaded_chapters
|
||||
)
|
||||
false -> listOf(R.string.manga_from_library)
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ import uy.kohesive.injekt.api.get
|
|||
*/
|
||||
class LibraryAdapter(
|
||||
private val controller: LibraryController,
|
||||
private val preferences: PreferencesHelper = Injekt.get()
|
||||
private val preferences: PreferencesHelper = Injekt.get(),
|
||||
) : RecyclerViewPagerAdapter() {
|
||||
|
||||
/**
|
||||
|
|
|
@ -19,7 +19,7 @@ import eu.kanade.tachiyomi.util.view.loadAutoPause
|
|||
*/
|
||||
class LibraryComfortableGridHolder(
|
||||
override val binding: SourceComfortableGridItemBinding,
|
||||
adapter: FlexibleAdapter<IFlexible<RecyclerView.ViewHolder>>
|
||||
adapter: FlexibleAdapter<IFlexible<RecyclerView.ViewHolder>>,
|
||||
) : LibraryHolder<SourceComfortableGridItemBinding>(binding.root, adapter) {
|
||||
|
||||
/**
|
||||
|
|
|
@ -18,7 +18,7 @@ import eu.kanade.tachiyomi.util.view.loadAutoPause
|
|||
class LibraryCompactGridHolder(
|
||||
override val binding: SourceCompactGridItemBinding,
|
||||
adapter: FlexibleAdapter<*>,
|
||||
private val coverOnly: Boolean
|
||||
private val coverOnly: Boolean,
|
||||
) : LibraryHolder<SourceCompactGridItemBinding>(binding.root, adapter) {
|
||||
|
||||
/**
|
||||
|
|
|
@ -51,7 +51,7 @@ import java.util.concurrent.TimeUnit
|
|||
|
||||
class LibraryController(
|
||||
bundle: Bundle? = null,
|
||||
private val preferences: PreferencesHelper = Injekt.get()
|
||||
private val preferences: PreferencesHelper = Injekt.get(),
|
||||
) : SearchableNucleusController<LibraryControllerBinding, LibraryPresenter>(bundle),
|
||||
RootController,
|
||||
TabbedController,
|
||||
|
@ -282,7 +282,7 @@ class LibraryController(
|
|||
EmptyView.Action(R.string.getting_started_guide, R.drawable.ic_help_24dp) {
|
||||
activity?.openInBrowser("https://tachiyomi.org/help/guides/getting-started")
|
||||
}
|
||||
),
|
||||
)
|
||||
)
|
||||
(activity as? MainActivity)?.ready = true
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ import eu.davidea.viewholders.FlexibleViewHolder
|
|||
|
||||
abstract class LibraryHolder<VB : ViewBinding>(
|
||||
view: View,
|
||||
adapter: FlexibleAdapter<*>
|
||||
adapter: FlexibleAdapter<*>,
|
||||
) : FlexibleViewHolder(view, adapter) {
|
||||
|
||||
abstract val binding: VB
|
||||
|
|
|
@ -19,7 +19,7 @@ import uy.kohesive.injekt.api.get
|
|||
class LibraryItem(
|
||||
val manga: LibraryManga,
|
||||
private val shouldSetFromCategory: Preference<Boolean>,
|
||||
private val defaultLibraryDisplayMode: Preference<DisplayModeSetting>
|
||||
private val defaultLibraryDisplayMode: Preference<DisplayModeSetting>,
|
||||
) :
|
||||
AbstractFlexibleItem<LibraryHolder<*>>(), IFilterable<String> {
|
||||
|
||||
|
@ -68,7 +68,7 @@ class LibraryItem(
|
|||
adapter: FlexibleAdapter<IFlexible<RecyclerView.ViewHolder>>,
|
||||
holder: LibraryHolder<*>,
|
||||
position: Int,
|
||||
payloads: List<Any?>?
|
||||
payloads: List<Any?>?,
|
||||
) {
|
||||
holder.onSetValues(this)
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ import eu.kanade.tachiyomi.databinding.SourceListItemBinding
|
|||
*/
|
||||
class LibraryListHolder(
|
||||
private val view: View,
|
||||
private val adapter: FlexibleAdapter<*>
|
||||
private val adapter: FlexibleAdapter<*>,
|
||||
) : LibraryHolder<SourceListItemBinding>(view, adapter) {
|
||||
|
||||
override val binding = SourceListItemBinding.bind(view)
|
||||
|
|
|
@ -53,7 +53,7 @@ class LibraryPresenter(
|
|||
private val coverCache: CoverCache = Injekt.get(),
|
||||
private val sourceManager: SourceManager = Injekt.get(),
|
||||
private val downloadManager: DownloadManager = Injekt.get(),
|
||||
private val trackManager: TrackManager = Injekt.get()
|
||||
private val trackManager: TrackManager = Injekt.get(),
|
||||
) : BasePresenter<LibraryController>() {
|
||||
|
||||
private val context = preferences.context
|
||||
|
|
|
@ -23,7 +23,7 @@ import uy.kohesive.injekt.injectLazy
|
|||
class LibrarySettingsSheet(
|
||||
router: Router,
|
||||
private val trackManager: TrackManager = Injekt.get(),
|
||||
onGroupClickListener: (ExtendedNavigationView.Group) -> Unit
|
||||
onGroupClickListener: (ExtendedNavigationView.Group) -> Unit,
|
||||
) : TabbedBottomSheetDialog(router.activity!!) {
|
||||
|
||||
val filters: Filter
|
||||
|
|
|
@ -204,7 +204,7 @@ class MainActivity : BaseActivity() {
|
|||
from: Controller?,
|
||||
isPush: Boolean,
|
||||
container: ViewGroup,
|
||||
handler: ControllerChangeHandler
|
||||
handler: ControllerChangeHandler,
|
||||
) {
|
||||
syncActivityViewWithController(to, from, isPush)
|
||||
}
|
||||
|
@ -214,7 +214,7 @@ class MainActivity : BaseActivity() {
|
|||
from: Controller?,
|
||||
isPush: Boolean,
|
||||
container: ViewGroup,
|
||||
handler: ControllerChangeHandler
|
||||
handler: ControllerChangeHandler,
|
||||
) {
|
||||
}
|
||||
}
|
||||
|
|
|
@ -425,7 +425,7 @@ class MangaController :
|
|||
when (item.itemId) {
|
||||
R.id.action_share -> shareManga()
|
||||
R.id.download_next, R.id.download_next_5, R.id.download_next_10,
|
||||
R.id.download_custom, R.id.download_unread, R.id.download_all
|
||||
R.id.download_custom, R.id.download_unread, R.id.download_all,
|
||||
-> downloadChapters(item.itemId)
|
||||
|
||||
R.id.action_edit_categories -> onCategoriesClick()
|
||||
|
@ -532,7 +532,7 @@ class MangaController :
|
|||
if (duplicateManga != null) {
|
||||
showAddDuplicateDialog(
|
||||
manga,
|
||||
duplicateManga,
|
||||
duplicateManga
|
||||
)
|
||||
} else {
|
||||
addToLibrary(manga)
|
||||
|
@ -545,11 +545,11 @@ class MangaController :
|
|||
val source = sourceManager.getOrStub(libraryManga.source)
|
||||
MaterialAlertDialogBuilder(it).apply {
|
||||
setMessage(activity?.getString(R.string.confirm_manga_add_duplicate, source.name))
|
||||
setPositiveButton(activity?.getString(R.string.action_add)) { _, _, ->
|
||||
setPositiveButton(activity?.getString(R.string.action_add)) { _, _ ->
|
||||
addToLibrary(newManga)
|
||||
}
|
||||
setNegativeButton(activity?.getString(R.string.action_cancel)) { _, _, -> }
|
||||
setNeutralButton(activity?.getString(R.string.action_show_manga)) { _, _, ->
|
||||
setNegativeButton(activity?.getString(R.string.action_cancel)) { _, _ -> }
|
||||
setNeutralButton(activity?.getString(R.string.action_show_manga)) { _, _ ->
|
||||
router.pushController(MangaController(libraryManga).withFadeTransaction())
|
||||
}
|
||||
setCancelable(true)
|
||||
|
@ -703,7 +703,7 @@ class MangaController :
|
|||
previousController.search(query)
|
||||
}
|
||||
is UpdatesController,
|
||||
is HistoryController -> {
|
||||
is HistoryController, -> {
|
||||
// Manually navigate to LibraryController
|
||||
router.handleBack()
|
||||
(router.activity as MainActivity).setSelectedNavItem(R.id.nav_library)
|
||||
|
@ -960,7 +960,7 @@ class MangaController :
|
|||
intent.apply {
|
||||
putExtra(ReaderActivity.EXTRA_IS_TRANSITION, true)
|
||||
},
|
||||
activityOptions.toBundle(),
|
||||
activityOptions.toBundle()
|
||||
)
|
||||
} else {
|
||||
startActivity(intent)
|
||||
|
|
|
@ -66,7 +66,7 @@ class MangaPresenter(
|
|||
private val db: DatabaseHelper = Injekt.get(),
|
||||
private val trackManager: TrackManager = Injekt.get(),
|
||||
private val downloadManager: DownloadManager = Injekt.get(),
|
||||
private val coverCache: CoverCache = Injekt.get()
|
||||
private val coverCache: CoverCache = Injekt.get(),
|
||||
) : BasePresenter<MangaController>() {
|
||||
|
||||
/**
|
||||
|
|
|
@ -15,7 +15,7 @@ import java.util.Date
|
|||
|
||||
class ChapterHolder(
|
||||
view: View,
|
||||
private val adapter: ChaptersAdapter
|
||||
private val adapter: ChaptersAdapter,
|
||||
) : BaseChapterHolder(view, adapter) {
|
||||
|
||||
private val binding = ChaptersItemBinding.bind(view)
|
||||
|
|
|
@ -26,7 +26,7 @@ class ChapterItem(chapter: Chapter, val manga: Manga) :
|
|||
adapter: FlexibleAdapter<IFlexible<RecyclerView.ViewHolder>>,
|
||||
holder: ChapterHolder,
|
||||
position: Int,
|
||||
payloads: List<Any?>?
|
||||
payloads: List<Any?>?,
|
||||
) {
|
||||
holder.bind(this, manga)
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@ import java.text.DecimalFormatSymbols
|
|||
|
||||
class ChaptersAdapter(
|
||||
controller: MangaController,
|
||||
context: Context
|
||||
context: Context,
|
||||
) : BaseChaptersAdapter<ChapterItem>(controller) {
|
||||
|
||||
private val preferences: PreferencesHelper by injectLazy()
|
||||
|
|
|
@ -17,7 +17,7 @@ import eu.kanade.tachiyomi.widget.sheet.TabbedBottomSheetDialog
|
|||
class ChaptersSettingsSheet(
|
||||
private val router: Router,
|
||||
private val presenter: MangaPresenter,
|
||||
private val onGroupClickListener: (ExtendedNavigationView.Group) -> Unit
|
||||
private val onGroupClickListener: (ExtendedNavigationView.Group) -> Unit,
|
||||
) : TabbedBottomSheetDialog(router.activity!!) {
|
||||
|
||||
val filters = Filter(router.activity!!)
|
||||
|
|
|
@ -14,7 +14,7 @@ import kotlinx.coroutines.flow.onEach
|
|||
import reactivecircus.flowbinding.android.view.clicks
|
||||
|
||||
class MangaChaptersHeaderAdapter(
|
||||
private val controller: MangaController
|
||||
private val controller: MangaController,
|
||||
) :
|
||||
RecyclerView.Adapter<MangaChaptersHeaderAdapter.HeaderViewHolder>() {
|
||||
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue