Formatting

This commit is contained in:
arkon 2022-04-08 16:44:23 -04:00
parent 2dfafa387b
commit 5afff31f72
197 changed files with 481 additions and 483 deletions

View file

@ -93,7 +93,7 @@ open class App : Application(), DefaultLifecycleObserver, ImageLoaderFactory {
this@App,
0,
Intent(ACTION_DISABLE_INCOGNITO_MODE),
PendingIntent.FLAG_ONE_SHOT
PendingIntent.FLAG_ONE_SHOT,
)
setContentIntent(pendingIntent)
}
@ -112,7 +112,7 @@ open class App : Application(), DefaultLifecycleObserver, ImageLoaderFactory {
PreferenceValues.ThemeMode.light -> AppCompatDelegate.MODE_NIGHT_NO
PreferenceValues.ThemeMode.dark -> AppCompatDelegate.MODE_NIGHT_YES
PreferenceValues.ThemeMode.system -> AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM
}
},
)
}.launchIn(ProcessLifecycleOwner.get().lifecycleScope)

View file

@ -63,7 +63,7 @@ class BackupCreatorJob(private val context: Context, workerParams: WorkerParamet
interval.toLong(),
TimeUnit.HOURS,
10,
TimeUnit.MINUTES
TimeUnit.MINUTES,
)
.addTag(TAG_AUTO)
.setInputData(workDataOf(IS_AUTO_BACKUP_KEY to true))
@ -79,7 +79,7 @@ class BackupCreatorJob(private val context: Context, workerParams: WorkerParamet
val inputData = workDataOf(
IS_AUTO_BACKUP_KEY to false,
LOCATION_URI_KEY to uri.toString(),
BACKUP_FLAGS_KEY to flags
BACKUP_FLAGS_KEY to flags,
)
val request = OneTimeWorkRequestBuilder<BackupCreatorJob>()
.addTag(TAG_MANUAL)

View file

@ -73,7 +73,7 @@ class BackupNotifier(private val context: Context) {
addAction(
R.drawable.ic_share_24dp,
context.getString(R.string.action_share),
NotificationReceiver.shareBackupPendingBroadcast(context, unifile.uri, Notifications.ID_BACKUP_COMPLETE)
NotificationReceiver.shareBackupPendingBroadcast(context, unifile.uri, Notifications.ID_BACKUP_COMPLETE),
)
show(Notifications.ID_BACKUP_COMPLETE)
@ -97,7 +97,7 @@ class BackupNotifier(private val context: Context) {
addAction(
R.drawable.ic_close_24dp,
context.getString(R.string.action_stop),
NotificationReceiver.cancelRestorePendingBroadcast(context, Notifications.ID_RESTORE_PROGRESS)
NotificationReceiver.cancelRestorePendingBroadcast(context, Notifications.ID_RESTORE_PROGRESS),
)
}
@ -124,8 +124,8 @@ class BackupNotifier(private val context: Context) {
R.string.restore_duration,
TimeUnit.MILLISECONDS.toMinutes(time),
TimeUnit.MILLISECONDS.toSeconds(time) - TimeUnit.MINUTES.toSeconds(
TimeUnit.MILLISECONDS.toMinutes(time)
)
TimeUnit.MILLISECONDS.toMinutes(time),
),
)
with(completeNotificationBuilder) {
@ -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,
)
}

View file

@ -56,7 +56,7 @@ class FullBackupManager(context: Context) : AbstractBackupManager(context) {
backupManga(databaseManga, flags),
backupCategories(),
emptyList(),
backupExtensionInfo(databaseManga)
backupExtensionInfo(databaseManga),
)
}

View file

@ -26,7 +26,7 @@ class BackupCategory(
return BackupCategory(
name = category.name,
order = category.order,
flags = category.flags
flags = category.flags,
)
}
}

View file

@ -49,7 +49,7 @@ data class BackupChapter(
lastPageRead = chapter.last_page_read,
dateFetch = chapter.date_fetch,
dateUpload = chapter.date_upload,
sourceOrder = chapter.source_order
sourceOrder = chapter.source_order,
)
}
}

View file

@ -83,7 +83,7 @@ data class BackupManga(
dateAdded = manga.date_added,
viewer = manga.readingModeType,
viewer_flags = manga.viewer_flags,
chapterFlags = manga.chapter_flags
chapterFlags = manga.chapter_flags,
)
}
}

View file

@ -19,7 +19,7 @@ data class BackupSource(
fun copyFrom(source: Source): BackupSource {
return BackupSource(
name = source.name,
sourceId = source.id
sourceId = source.id,
)
}
}

View file

@ -56,7 +56,7 @@ data class BackupTracking(
status = track.status,
startedReadingDate = track.started_reading_date,
finishedReadingDate = track.finished_reading_date,
trackingUrl = track.tracking_url
trackingUrl = track.tracking_url,
)
}
}

View file

@ -28,7 +28,7 @@ class LegacyBackupRestore(context: Context, notifier: BackupNotifier) : Abstract
// Read the json and create a Json Object,
// cannot use the backupManager json deserializer one because its not initialized yet
val backupObject = Json.decodeFromStream<JsonObject>(
context.contentResolver.openInputStream(uri)!!
context.contentResolver.openInputStream(uri)!!,
)
// Get parser version

View file

@ -21,7 +21,7 @@ class LegacyBackupRestoreValidator : AbstractBackupRestoreValidator() {
val backup = try {
backupManager.parser.decodeFromStream<Backup>(
context.contentResolver.openInputStream(uri)!!
context.contentResolver.openInputStream(uri)!!,
)
} catch (e: Exception) {
throw ValidatorParseException(e)

View file

@ -27,7 +27,7 @@ open class CategoryBaseSerializer<T : Category> : KSerializer<T> {
buildJsonArray {
add(value.name)
add(value.order)
}
},
)
}

View file

@ -35,7 +35,7 @@ open class ChapterBaseSerializer<T : Chapter> : KSerializer<T> {
if (value.last_page_read != 0) {
put(LAST_READ, value.last_page_read)
}
}
},
)
}

View file

@ -26,7 +26,7 @@ object HistoryTypeSerializer : KSerializer<DHistory> {
buildJsonArray {
add(value.url)
add(value.lastRead)
}
},
)
}
@ -35,7 +35,7 @@ object HistoryTypeSerializer : KSerializer<DHistory> {
val array = decoder.decodeJsonElement().jsonArray
return DHistory(
url = array[0].jsonPrimitive.content,
lastRead = array[1].jsonPrimitive.long
lastRead = array[1].jsonPrimitive.long,
)
}
}

View file

@ -31,7 +31,7 @@ open class MangaBaseSerializer<T : Manga> : KSerializer<T> {
add(value.source)
add(value.viewer_flags)
add(value.chapter_flags)
}
},
)
}

View file

@ -33,7 +33,7 @@ open class TrackBaseSerializer<T : Track> : KSerializer<T> {
put(LIBRARY, value.library_id)
put(LAST_READ, value.last_chapter_read)
put(TRACKING_URL, value.tracking_url)
}
},
)
}

View file

@ -49,7 +49,7 @@ class ChapterCache(private val context: Context) {
File(context.cacheDir, PARAMETER_CACHE_DIRECTORY),
PARAMETER_APP_VERSION,
PARAMETER_VALUE_COUNT,
PARAMETER_CACHE_SIZE
PARAMETER_CACHE_SIZE,
)
/**

View file

@ -75,7 +75,7 @@ class MangaCoverFetcher(
return SourceResult(
source = ImageSource(file = file.toOkioPath(), diskCacheKey = diskCacheKey),
mimeType = "image/*",
dataSource = DataSource.DISK
dataSource = DataSource.DISK,
)
}
@ -104,7 +104,7 @@ class MangaCoverFetcher(
return SourceResult(
source = snapshot.toImageSource(),
mimeType = "image/*",
dataSource = DataSource.DISK
dataSource = DataSource.DISK,
)
}
@ -124,7 +124,7 @@ class MangaCoverFetcher(
return SourceResult(
source = snapshot.toImageSource(),
mimeType = "image/*",
dataSource = DataSource.NETWORK
dataSource = DataSource.NETWORK,
)
}
@ -132,7 +132,7 @@ class MangaCoverFetcher(
return SourceResult(
source = ImageSource(source = responseBody.source(), context = options.context),
mimeType = "image/*",
dataSource = if (response.cacheResponse != null) DataSource.DISK else DataSource.NETWORK
dataSource = if (response.cacheResponse != null) DataSource.DISK else DataSource.NETWORK,
)
} catch (e: Exception) {
responseBody.closeQuietly()

View file

@ -32,7 +32,7 @@ class TachiyomiImageDecoder(private val resources: ImageSource, private val opti
return DecodeResult(
drawable = bitmap.toDrawable(options.context.resources),
isSampled = false
isSampled = false,
)
}

View file

@ -46,7 +46,7 @@ class DbOpenCallback : SupportSQLiteOpenHelper.Callback(DATABASE_VERSION) {
// Fix kissmanga covers after supporting cloudflare
db.execSQL(
"""UPDATE mangas SET thumbnail_url =
REPLACE(thumbnail_url, '93.174.95.110', 'kissmanga.com') WHERE source = 4"""
REPLACE(thumbnail_url, '93.174.95.110', 'kissmanga.com') WHERE source = 4""",
)
}
if (oldVersion < 3) {

View file

@ -20,7 +20,7 @@ import eu.kanade.tachiyomi.data.database.tables.CategoryTable.TABLE
class CategoryTypeMapping : SQLiteTypeMapping<Category>(
CategoryPutResolver(),
CategoryGetResolver(),
CategoryDeleteResolver()
CategoryDeleteResolver(),
)
class CategoryPutResolver : DefaultPutResolver<Category>() {
@ -40,7 +40,7 @@ class CategoryPutResolver : DefaultPutResolver<Category>() {
COL_ID to obj.id,
COL_NAME to obj.name,
COL_ORDER to obj.order,
COL_FLAGS to obj.flags
COL_FLAGS to obj.flags,
)
}

View file

@ -28,7 +28,7 @@ import eu.kanade.tachiyomi.data.database.tables.ChapterTable.TABLE
class ChapterTypeMapping : SQLiteTypeMapping<Chapter>(
ChapterPutResolver(),
ChapterGetResolver(),
ChapterDeleteResolver()
ChapterDeleteResolver(),
)
class ChapterPutResolver : DefaultPutResolver<Chapter>() {
@ -56,7 +56,7 @@ class ChapterPutResolver : DefaultPutResolver<Chapter>() {
COL_DATE_UPLOAD to obj.date_upload,
COL_LAST_PAGE_READ to obj.last_page_read,
COL_CHAPTER_NUMBER to obj.chapter_number,
COL_SOURCE_ORDER to obj.source_order
COL_SOURCE_ORDER to obj.source_order,
)
}

View file

@ -20,7 +20,7 @@ import eu.kanade.tachiyomi.data.database.tables.HistoryTable.TABLE
class HistoryTypeMapping : SQLiteTypeMapping<History>(
HistoryPutResolver(),
HistoryGetResolver(),
HistoryDeleteResolver()
HistoryDeleteResolver(),
)
open class HistoryPutResolver : DefaultPutResolver<History>() {
@ -40,7 +40,7 @@ open class HistoryPutResolver : DefaultPutResolver<History>() {
COL_ID to obj.id,
COL_CHAPTER_ID to obj.chapter_id,
COL_LAST_READ to obj.last_read,
COL_TIME_READ to obj.time_read
COL_TIME_READ to obj.time_read,
)
}

View file

@ -18,7 +18,7 @@ import eu.kanade.tachiyomi.data.database.tables.MangaCategoryTable.TABLE
class MangaCategoryTypeMapping : SQLiteTypeMapping<MangaCategory>(
MangaCategoryPutResolver(),
MangaCategoryGetResolver(),
MangaCategoryDeleteResolver()
MangaCategoryDeleteResolver(),
)
class MangaCategoryPutResolver : DefaultPutResolver<MangaCategory>() {
@ -37,7 +37,7 @@ class MangaCategoryPutResolver : DefaultPutResolver<MangaCategory>() {
contentValuesOf(
COL_ID to obj.id,
COL_MANGA_ID to obj.manga_id,
COL_CATEGORY_ID to obj.category_id
COL_CATEGORY_ID to obj.category_id,
)
}

View file

@ -33,7 +33,7 @@ import eu.kanade.tachiyomi.data.database.tables.MangaTable.TABLE
class MangaTypeMapping : SQLiteTypeMapping<Manga>(
MangaPutResolver(),
MangaGetResolver(),
MangaDeleteResolver()
MangaDeleteResolver(),
)
class MangaPutResolver : DefaultPutResolver<Manga>() {
@ -66,7 +66,7 @@ class MangaPutResolver : DefaultPutResolver<Manga>() {
COL_VIEWER to obj.viewer_flags,
COL_CHAPTER_FLAGS to obj.chapter_flags,
COL_COVER_LAST_MODIFIED to obj.cover_last_modified,
COL_DATE_ADDED to obj.date_added
COL_DATE_ADDED to obj.date_added,
)
}

View file

@ -29,7 +29,7 @@ import eu.kanade.tachiyomi.data.database.tables.TrackTable.TABLE
class TrackTypeMapping : SQLiteTypeMapping<Track>(
TrackPutResolver(),
TrackGetResolver(),
TrackDeleteResolver()
TrackDeleteResolver(),
)
class TrackPutResolver : DefaultPutResolver<Track>() {
@ -58,7 +58,7 @@ class TrackPutResolver : DefaultPutResolver<Track>() {
COL_TRACKING_URL to obj.tracking_url,
COL_SCORE to obj.score,
COL_START_DATE to obj.started_reading_date,
COL_FINISH_DATE to obj.finished_reading_date
COL_FINISH_DATE to obj.finished_reading_date,
)
}

View file

@ -125,6 +125,6 @@ fun Manga.toMangaInfo(): MangaInfo {
genres = this.getGenres() ?: emptyList(),
key = this.url,
status = this.status,
title = this.title
title = this.title,
)
}

View file

@ -15,7 +15,7 @@ interface CategoryQueries : DbProvider {
Query.builder()
.table(CategoryTable.TABLE)
.orderBy(CategoryTable.COL_ORDER)
.build()
.build(),
)
.prepare()
@ -25,7 +25,7 @@ interface CategoryQueries : DbProvider {
RawQuery.builder()
.query(getCategoriesForMangaQuery())
.args(manga.id)
.build()
.build(),
)
.prepare()

View file

@ -23,7 +23,7 @@ interface ChapterQueries : DbProvider {
.table(ChapterTable.TABLE)
.where("${ChapterTable.COL_MANGA_ID} = ?")
.whereArgs(manga.id)
.build()
.build(),
)
.prepare()
@ -34,7 +34,7 @@ interface ChapterQueries : DbProvider {
.query(getRecentsQuery())
.args(date.time)
.observesTables(ChapterTable.TABLE)
.build()
.build(),
)
.withGetResolver(MangaChapterGetResolver.INSTANCE)
.prepare()
@ -46,7 +46,7 @@ interface ChapterQueries : DbProvider {
.table(ChapterTable.TABLE)
.where("${ChapterTable.COL_ID} = ?")
.whereArgs(id)
.build()
.build(),
)
.prepare()
@ -57,7 +57,7 @@ interface ChapterQueries : DbProvider {
.table(ChapterTable.TABLE)
.where("${ChapterTable.COL_URL} = ?")
.whereArgs(url)
.build()
.build(),
)
.prepare()
@ -68,7 +68,7 @@ interface ChapterQueries : DbProvider {
.table(ChapterTable.TABLE)
.where("${ChapterTable.COL_URL} = ? AND ${ChapterTable.COL_MANGA_ID} = ?")
.whereArgs(url, mangaId)
.build()
.build(),
)
.prepare()

View file

@ -32,7 +32,7 @@ interface HistoryQueries : DbProvider {
.query(getRecentMangasQuery(search))
.args(date.time, limit, offset)
.observesTables(HistoryTable.TABLE)
.build()
.build(),
)
.withGetResolver(MangaChapterHistoryGetResolver.INSTANCE)
.prepare()
@ -44,7 +44,7 @@ interface HistoryQueries : DbProvider {
.query(getHistoryByMangaId())
.args(mangaId)
.observesTables(HistoryTable.TABLE)
.build()
.build(),
)
.prepare()
@ -55,7 +55,7 @@ interface HistoryQueries : DbProvider {
.query(getHistoryByChapterUrl())
.args(chapterUrl)
.observesTables(HistoryTable.TABLE)
.build()
.build(),
)
.prepare()
@ -83,7 +83,7 @@ interface HistoryQueries : DbProvider {
.byQuery(
DeleteQuery.builder()
.table(HistoryTable.TABLE)
.build()
.build(),
)
.prepare()
@ -93,7 +93,7 @@ interface HistoryQueries : DbProvider {
.table(HistoryTable.TABLE)
.where("${HistoryTable.COL_LAST_READ} = ?")
.whereArgs(0)
.build()
.build(),
)
.prepare()
}

View file

@ -20,7 +20,7 @@ interface MangaCategoryQueries : DbProvider {
.table(MangaCategoryTable.TABLE)
.where("${MangaCategoryTable.COL_MANGA_ID} IN (${Queries.placeholders(mangas.size)})")
.whereArgs(*mangas.map { it.id }.toTypedArray())
.build()
.build(),
)
.prepare()

View file

@ -29,7 +29,7 @@ interface MangaQueries : DbProvider {
RawQuery.builder()
.query(libraryQuery)
.observesTables(MangaTable.TABLE, ChapterTable.TABLE, MangaCategoryTable.TABLE, CategoryTable.TABLE)
.build()
.build(),
)
.withGetResolver(LibraryMangaGetResolver.INSTANCE)
.prepare()
@ -42,10 +42,10 @@ 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()
.build(),
)
.prepare()
@ -72,7 +72,7 @@ interface MangaQueries : DbProvider {
.table(MangaTable.TABLE)
.where("${MangaTable.COL_URL} = ? AND ${MangaTable.COL_SOURCE} = ?")
.whereArgs(url, sourceId)
.build()
.build(),
)
.prepare()
@ -83,7 +83,7 @@ interface MangaQueries : DbProvider {
.table(MangaTable.TABLE)
.where("${MangaTable.COL_ID} = ?")
.whereArgs(id)
.build()
.build(),
)
.prepare()
@ -93,7 +93,7 @@ interface MangaQueries : DbProvider {
RawQuery.builder()
.query(getSourceIdsWithNonLibraryMangaQuery())
.observesTables(MangaTable.TABLE)
.build()
.build(),
)
.withGetResolver(SourceIdMangaCountGetResolver.INSTANCE)
.prepare()
@ -152,7 +152,7 @@ interface MangaQueries : DbProvider {
.table(MangaTable.TABLE)
.where("${MangaTable.COL_FAVORITE} = ? AND ${MangaTable.COL_SOURCE} IN (${Queries.placeholders(sourceIds.size)})")
.whereArgs(0, *sourceIds.toTypedArray())
.build()
.build(),
)
.prepare()
@ -160,7 +160,7 @@ interface MangaQueries : DbProvider {
.byQuery(
DeleteQuery.builder()
.table(MangaTable.TABLE)
.build()
.build(),
)
.prepare()
@ -170,7 +170,7 @@ interface MangaQueries : DbProvider {
RawQuery.builder()
.query(getLastReadMangaQuery())
.observesTables(MangaTable.TABLE)
.build()
.build(),
)
.prepare()
@ -180,7 +180,7 @@ interface MangaQueries : DbProvider {
RawQuery.builder()
.query(getTotalChapterMangaQuery())
.observesTables(MangaTable.TABLE)
.build()
.build(),
)
.prepare()
@ -190,7 +190,7 @@ interface MangaQueries : DbProvider {
RawQuery.builder()
.query(getLatestChapterMangaQuery())
.observesTables(MangaTable.TABLE)
.build()
.build(),
)
.prepare()
@ -200,7 +200,7 @@ interface MangaQueries : DbProvider {
RawQuery.builder()
.query(getChapterFetchDateMangaQuery())
.observesTables(MangaTable.TABLE)
.build()
.build(),
)
.prepare()
}

View file

@ -15,7 +15,7 @@ interface TrackQueries : DbProvider {
.withQuery(
Query.builder()
.table(TrackTable.TABLE)
.build()
.build(),
)
.prepare()
@ -26,7 +26,7 @@ interface TrackQueries : DbProvider {
.table(TrackTable.TABLE)
.where("${TrackTable.COL_MANGA_ID} = ?")
.whereArgs(manga.id)
.build()
.build(),
)
.prepare()
@ -40,7 +40,7 @@ interface TrackQueries : DbProvider {
.table(TrackTable.TABLE)
.where("${TrackTable.COL_MANGA_ID} = ? AND ${TrackTable.COL_SYNC_ID} = ?")
.whereArgs(manga.id, sync.id)
.build()
.build(),
)
.prepare()
}

View file

@ -29,6 +29,6 @@ class ChapterBackupPutResolver : PutResolver<Chapter>() {
contentValuesOf(
ChapterTable.COL_READ to chapter.read,
ChapterTable.COL_BOOKMARK to chapter.bookmark,
ChapterTable.COL_LAST_PAGE_READ to chapter.last_page_read
ChapterTable.COL_LAST_PAGE_READ to chapter.last_page_read,
)
}

View file

@ -29,6 +29,6 @@ class ChapterKnownBackupPutResolver : PutResolver<Chapter>() {
contentValuesOf(
ChapterTable.COL_READ to chapter.read,
ChapterTable.COL_BOOKMARK to chapter.bookmark,
ChapterTable.COL_LAST_PAGE_READ to chapter.last_page_read
ChapterTable.COL_LAST_PAGE_READ to chapter.last_page_read,
)
}

View file

@ -29,6 +29,6 @@ class ChapterProgressPutResolver : PutResolver<Chapter>() {
contentValuesOf(
ChapterTable.COL_READ to chapter.read,
ChapterTable.COL_BOOKMARK to chapter.bookmark,
ChapterTable.COL_LAST_PAGE_READ to chapter.last_page_read
ChapterTable.COL_LAST_PAGE_READ to chapter.last_page_read,
)
}

View file

@ -27,6 +27,6 @@ class ChapterSourceOrderPutResolver : PutResolver<Chapter>() {
fun mapToContentValues(chapter: Chapter) =
contentValuesOf(
ChapterTable.COL_SOURCE_ORDER to chapter.source_order
ChapterTable.COL_SOURCE_ORDER to chapter.source_order,
)
}

View file

@ -24,7 +24,7 @@ class HistoryLastReadPutResolver : HistoryPutResolver() {
.table(updateQuery.table())
.where(updateQuery.where())
.whereArgs(updateQuery.whereArgs())
.build()
.build(),
)
cursor.use { putCursor ->
@ -47,6 +47,6 @@ class HistoryLastReadPutResolver : HistoryPutResolver() {
private fun mapToUpdateContentValues(history: History) =
contentValuesOf(
HistoryTable.COL_LAST_READ to history.last_read
HistoryTable.COL_LAST_READ to history.last_read,
)
}

View file

@ -27,6 +27,6 @@ class MangaCoverLastModifiedPutResolver : PutResolver<Manga>() {
fun mapToContentValues(manga: Manga) =
contentValuesOf(
MangaTable.COL_COVER_LAST_MODIFIED to manga.cover_last_modified
MangaTable.COL_COVER_LAST_MODIFIED to manga.cover_last_modified,
)
}

View file

@ -27,6 +27,6 @@ class MangaFavoritePutResolver : PutResolver<Manga>() {
fun mapToContentValues(manga: Manga) =
contentValuesOf(
MangaTable.COL_FAVORITE to manga.favorite
MangaTable.COL_FAVORITE to manga.favorite,
)
}

View file

@ -28,6 +28,6 @@ class MangaFlagsPutResolver(private val colName: String, private val fieldGetter
fun mapToContentValues(manga: Manga) =
contentValuesOf(
colName to fieldGetter.get(manga)
colName to fieldGetter.get(manga),
)
}

View file

@ -27,6 +27,6 @@ class MangaLastUpdatedPutResolver : PutResolver<Manga>() {
fun mapToContentValues(manga: Manga) =
contentValuesOf(
MangaTable.COL_LAST_UPDATE to manga.last_update
MangaTable.COL_LAST_UPDATE to manga.last_update,
)
}

View file

@ -27,6 +27,6 @@ class MangaTitlePutResolver : PutResolver<Manga>() {
fun mapToContentValues(manga: Manga) =
contentValuesOf(
MangaTable.COL_TITLE to manga.title
MangaTable.COL_TITLE to manga.title,
)
}

View file

@ -93,14 +93,14 @@ internal class DownloadNotifier(private val context: Context) {
addAction(
R.drawable.ic_pause_24dp,
context.getString(R.string.action_pause),
NotificationReceiver.pauseDownloadsPendingBroadcast(context)
NotificationReceiver.pauseDownloadsPendingBroadcast(context),
)
}
val downloadingProgressText = context.getString(
R.string.chapter_downloading_progress,
download.downloadedImages,
download.pages!!.size
download.pages!!.size,
)
if (preferences.hideNotificationContent()) {
@ -138,13 +138,13 @@ internal class DownloadNotifier(private val context: Context) {
addAction(
R.drawable.ic_play_arrow_24dp,
context.getString(R.string.action_resume),
NotificationReceiver.resumeDownloadsPendingBroadcast(context)
NotificationReceiver.resumeDownloadsPendingBroadcast(context),
)
// Clear action
addAction(
R.drawable.ic_close_24dp,
context.getString(R.string.action_cancel_all),
NotificationReceiver.clearDownloadsPendingBroadcast(context)
NotificationReceiver.clearDownloadsPendingBroadcast(context),
)
show(Notifications.ID_DOWNLOAD_CHAPTER_PROGRESS)
@ -213,7 +213,7 @@ internal class DownloadNotifier(private val context: Context) {
// Create notification
with(errorNotificationBuilder) {
setContentTitle(
mangaTitle?.plus(": $chapter") ?: context.getString(R.string.download_notifier_downloader_title)
mangaTitle?.plus(": $chapter") ?: context.getString(R.string.download_notifier_downloader_title),
)
setContentText(error ?: context.getString(R.string.download_notifier_unknown_error))
setSmallIcon(R.drawable.ic_warning_white_24dp)

View file

@ -138,7 +138,7 @@ class DownloadProvider(private val context: Context) {
when {
chapter.scanlator != null -> "${chapter.scanlator}_${chapter.name}"
else -> chapter.name
}
},
)
}
@ -157,7 +157,7 @@ class DownloadProvider(private val context: Context) {
"$chapterName.cbz",
// Legacy chapter directory name used in v0.9.2 and before
DiskUtil.buildValidFilename(chapter.name)
DiskUtil.buildValidFilename(chapter.name),
)
}
}

View file

@ -211,7 +211,7 @@ class Downloader(
downloadChapter(download).subscribeOn(Schedulers.io())
}
},
5
5,
)
.onBackpressureLatest()
.observeOn(AndroidSchedulers.mainThread())
@ -223,7 +223,7 @@ class Downloader(
DownloadService.stop(context)
logcat(LogPriority.ERROR, error)
notifier.onError(error.message)
}
},
)
}

View file

@ -49,7 +49,7 @@ class LibraryUpdateJob(private val context: Context, workerParams: WorkerParamet
interval.toLong(),
TimeUnit.HOURS,
10,
TimeUnit.MINUTES
TimeUnit.MINUTES,
)
.addTag(TAG)
.setConstraints(constraints)

View file

@ -86,7 +86,7 @@ class LibraryUpdateNotifier(private val context: Context) {
Notifications.ID_LIBRARY_PROGRESS,
progressNotificationBuilder
.setProgress(total, current, false)
.build()
.build(),
)
}
@ -110,7 +110,7 @@ class LibraryUpdateNotifier(private val context: Context) {
setContentIntent(NotificationReceiver.openErrorLogPendingActivity(context, uri))
}
.build()
.build(),
)
}
@ -131,7 +131,7 @@ class LibraryUpdateNotifier(private val context: Context) {
setSmallIcon(R.drawable.ic_tachi)
addAction(R.drawable.ic_help_24dp, context.getString(R.string.learn_more), NotificationHandler.openUrl(context, HELP_SKIPPED_URL))
}
.build()
.build(),
)
}
@ -161,8 +161,8 @@ class LibraryUpdateNotifier(private val context: Context) {
NotificationCompat.BigTextStyle().bigText(
updates.joinToString("\n") {
it.first.title.chop(NOTIF_TITLE_MAX_LEN)
}
)
},
),
)
}
}
@ -177,7 +177,7 @@ class LibraryUpdateNotifier(private val context: Context) {
setContentIntent(getNotificationIntent())
setAutoCancel(true)
}
},
)
// Per-manga notification
@ -222,8 +222,8 @@ class LibraryUpdateNotifier(private val context: Context) {
context,
manga,
chapters,
Notifications.ID_NEW_CHAPTERS
)
Notifications.ID_NEW_CHAPTERS,
),
)
// View chapters action
addAction(
@ -232,8 +232,8 @@ class LibraryUpdateNotifier(private val context: Context) {
NotificationReceiver.openChapterPendingActivity(
context,
manga,
Notifications.ID_NEW_CHAPTERS
)
Notifications.ID_NEW_CHAPTERS,
),
)
// Download chapters action
// Only add the action when chapters is within threshold
@ -245,8 +245,8 @@ class LibraryUpdateNotifier(private val context: Context) {
context,
manga,
chapters,
Notifications.ID_NEW_CHAPTERS
)
Notifications.ID_NEW_CHAPTERS,
),
)
}
}
@ -273,7 +273,7 @@ class LibraryUpdateNotifier(private val context: Context) {
val formatter = DecimalFormat(
"#.###",
DecimalFormatSymbols()
.apply { decimalSeparator = '.' }
.apply { decimalSeparator = '.' },
)
val displayableChapterNumbers = chapters

View file

@ -310,7 +310,7 @@ class LibraryUpdateService(
withUpdateNotification(
currentlyUpdatingManga,
progressCount,
manga
manga,
) { manga ->
try {
when {
@ -336,7 +336,7 @@ class LibraryUpdateService(
// Convert to the manga that contains new chapters
newUpdates.add(
manga to newChapters.sortedByDescending { ch -> ch.source_order }
.toTypedArray()
.toTypedArray(),
)
}
}
@ -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 {
@ -536,7 +536,7 @@ class LibraryUpdateService(
notifier.showProgressNotification(
updatingManga,
completed.get(),
mangaToUpdate.size
mangaToUpdate.size,
)
block(manga)
@ -550,7 +550,7 @@ class LibraryUpdateService(
notifier.showProgressNotification(
updatingManga,
completed.get(),
mangaToUpdate.size
mangaToUpdate.size,
)
}

View file

@ -59,14 +59,14 @@ class NotificationReceiver : BroadcastReceiver() {
shareImage(
context,
intent.getStringExtra(EXTRA_FILE_LOCATION)!!,
intent.getIntExtra(EXTRA_NOTIFICATION_ID, -1)
intent.getIntExtra(EXTRA_NOTIFICATION_ID, -1),
)
// Delete image from path and dismiss notification
ACTION_DELETE_IMAGE ->
deleteImage(
context,
intent.getStringExtra(EXTRA_FILE_LOCATION)!!,
intent.getIntExtra(EXTRA_NOTIFICATION_ID, -1)
intent.getIntExtra(EXTRA_NOTIFICATION_ID, -1),
)
// Share backup file
ACTION_SHARE_BACKUP ->
@ -74,11 +74,11 @@ class NotificationReceiver : BroadcastReceiver() {
context,
intent.getParcelableExtra(EXTRA_URI)!!,
"application/x-protobuf+gzip",
intent.getIntExtra(EXTRA_NOTIFICATION_ID, -1)
intent.getIntExtra(EXTRA_NOTIFICATION_ID, -1),
)
ACTION_CANCEL_RESTORE -> cancelRestore(
context,
intent.getIntExtra(EXTRA_NOTIFICATION_ID, -1)
intent.getIntExtra(EXTRA_NOTIFICATION_ID, -1),
)
// Cancel library update and dismiss notification
ACTION_CANCEL_LIBRARY_UPDATE -> cancelLibraryUpdate(context, Notifications.ID_LIBRARY_PROGRESS)
@ -87,7 +87,7 @@ class NotificationReceiver : BroadcastReceiver() {
openChapter(
context,
intent.getLongExtra(EXTRA_MANGA_ID, -1),
intent.getLongExtra(EXTRA_CHAPTER_ID, -1)
intent.getLongExtra(EXTRA_CHAPTER_ID, -1),
)
}
// Mark updated manga chapters as read
@ -120,7 +120,7 @@ class NotificationReceiver : BroadcastReceiver() {
context,
intent.getParcelableExtra(EXTRA_URI)!!,
"text/plain",
intent.getIntExtra(EXTRA_NOTIFICATION_ID, -1)
intent.getIntExtra(EXTRA_NOTIFICATION_ID, -1),
)
}
}

View file

@ -87,7 +87,7 @@ object Notifications {
"backup_restore_complete_channel",
"library_channel",
"library_progress_channel",
"updates_ext_channel"
"updates_ext_channel",
)
/**
@ -115,8 +115,8 @@ object Notifications {
},
buildNotificationChannelGroup(GROUP_APK_UPDATES) {
setName(context.getString(R.string.label_recent_updates))
}
)
},
),
)
notificationService.createNotificationChannelsCompat(
@ -181,8 +181,8 @@ object Notifications {
buildNotificationChannel(CHANNEL_EXTENSIONS_UPDATE, IMPORTANCE_DEFAULT) {
setGroup(GROUP_APK_UPDATES)
setName(context.getString(R.string.channel_ext_updates))
}
)
},
),
)
}
}

View file

@ -34,13 +34,13 @@ class PreferencesHelper(val context: Context) {
private val defaultDownloadsDir = File(
Environment.getExternalStorageDirectory().absolutePath + File.separator +
context.getString(R.string.app_name),
"downloads"
"downloads",
).toUri()
private val defaultBackupDir = File(
Environment.getExternalStorageDirectory().absolutePath + File.separator +
context.getString(R.string.app_name),
"backup"
"backup",
).toUri()
fun startScreen() = prefs.getInt(Keys.startScreen, 1)
@ -67,12 +67,12 @@ class PreferencesHelper(val context: Context) {
fun themeMode() = flowPrefs.getEnum(
"pref_theme_mode_key",
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { Values.ThemeMode.system } else { Values.ThemeMode.light }
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { Values.ThemeMode.system } else { Values.ThemeMode.light },
)
fun appTheme() = flowPrefs.getEnum(
"pref_app_theme",
if (DeviceUtil.isDynamicColorAvailable) { Values.AppTheme.MONET } else { Values.AppTheme.DEFAULT }
if (DeviceUtil.isDynamicColorAvailable) { Values.AppTheme.MONET } else { Values.AppTheme.DEFAULT },
)
fun themeDarkAmoled() = flowPrefs.getBoolean("pref_theme_dark_amoled_key", false)
@ -137,8 +137,6 @@ class PreferencesHelper(val context: Context) {
fun webtoonSidePadding() = flowPrefs.getInt("webtoon_side_padding", 0)
fun readWithTapping() = flowPrefs.getBoolean("reader_tap", true)
fun pagerNavInverted() = flowPrefs.getEnum("reader_tapping_inverted", Values.TappingInvertMode.NONE)
fun webtoonNavInverted() = flowPrefs.getEnum("reader_tapping_inverted_webtoon", Values.TappingInvertMode.NONE)
@ -318,7 +316,7 @@ class PreferencesHelper(val context: Context) {
fun extensionInstaller() = flowPrefs.getEnum(
"extension_installer",
if (DeviceUtil.isMiui) Values.ExtensionInstaller.LEGACY else Values.ExtensionInstaller.PACKAGEINSTALLER
if (DeviceUtil.isMiui) Values.ExtensionInstaller.LEGACY else Values.ExtensionInstaller.PACKAGEINSTALLER,
)
fun verboseLogging() = prefs.getBoolean(Keys.verboseLogging, false)

View file

@ -47,13 +47,13 @@ class ImageSaver(
put(
MediaStore.Images.Media.RELATIVE_PATH,
"${Environment.DIRECTORY_PICTURES}/${context.getString(R.string.app_name)}/" +
(image.location as Location.Pictures).relativePath
(image.location as Location.Pictures).relativePath,
)
}
val picture = context.contentResolver.insert(
pictureDir,
contentValues
contentValues,
) ?: throw IOException("Couldn't create file")
data().use { input ->
@ -133,12 +133,12 @@ sealed class Location {
is Pictures -> {
val file = File(
Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES),
context.getString(R.string.app_name)
context.getString(R.string.app_name),
)
if (relativePath.isNotEmpty()) {
return File(
file,
relativePath
relativePath,
)
}
file

View file

@ -56,8 +56,8 @@ class AnilistApi(val client: OkHttpClient, interceptor: AnilistInterceptor) {
authClient.newCall(
POST(
apiUrl,
body = payload.toString().toRequestBody(jsonMime)
)
body = payload.toString().toRequestBody(jsonMime),
),
)
.await()
.parseAs<JsonObject>()
@ -140,8 +140,8 @@ class AnilistApi(val client: OkHttpClient, interceptor: AnilistInterceptor) {
authClient.newCall(
POST(
apiUrl,
body = payload.toString().toRequestBody(jsonMime)
)
body = payload.toString().toRequestBody(jsonMime),
),
)
.await()
.parseAs<JsonObject>()
@ -208,8 +208,8 @@ class AnilistApi(val client: OkHttpClient, interceptor: AnilistInterceptor) {
authClient.newCall(
POST(
apiUrl,
body = payload.toString().toRequestBody(jsonMime)
)
body = payload.toString().toRequestBody(jsonMime),
),
)
.await()
.parseAs<JsonObject>()
@ -250,8 +250,8 @@ class AnilistApi(val client: OkHttpClient, interceptor: AnilistInterceptor) {
authClient.newCall(
POST(
apiUrl,
body = payload.toString().toRequestBody(jsonMime)
)
body = payload.toString().toRequestBody(jsonMime),
),
)
.await()
.parseAs<JsonObject>()
@ -260,7 +260,7 @@ class AnilistApi(val client: OkHttpClient, interceptor: AnilistInterceptor) {
val viewer = data["Viewer"]!!.jsonObject
Pair(
viewer["id"]!!.jsonPrimitive.int,
viewer["mediaListOptions"]!!.jsonObject["scoreFormat"]!!.jsonPrimitive.content
viewer["mediaListOptions"]!!.jsonObject["scoreFormat"]!!.jsonPrimitive.content,
)
}
}
@ -275,7 +275,7 @@ class AnilistApi(val client: OkHttpClient, interceptor: AnilistInterceptor) {
struct["format"]!!.jsonPrimitive.content.replace("_", "-"),
struct["status"]!!.jsonPrimitive.contentOrNull ?: "",
parseDate(struct, "startDate"),
struct["chapters"]!!.jsonPrimitive.intOrNull ?: 0
struct["chapters"]!!.jsonPrimitive.intOrNull ?: 0,
)
}
@ -287,7 +287,7 @@ class AnilistApi(val client: OkHttpClient, interceptor: AnilistInterceptor) {
struct["progress"]!!.jsonPrimitive.int,
parseDate(struct, "startedAt"),
parseDate(struct, "completedAt"),
jsonToALManga(struct["media"]!!.jsonObject)
jsonToALManga(struct["media"]!!.jsonObject),
)
}
@ -297,7 +297,7 @@ class AnilistApi(val client: OkHttpClient, interceptor: AnilistInterceptor) {
date.set(
struct[dateKey]!!.jsonObject["year"]!!.jsonPrimitive.int,
struct[dateKey]!!.jsonObject["month"]!!.jsonPrimitive.int - 1,
struct[dateKey]!!.jsonObject["day"]!!.jsonPrimitive.int
struct[dateKey]!!.jsonObject["day"]!!.jsonPrimitive.int,
)
date.timeInMillis
} catch (_: Exception) {

View file

@ -61,8 +61,8 @@ class BangumiApi(private val client: OkHttpClient, interceptor: BangumiIntercept
authClient.newCall(
POST(
"$apiUrl/subject/${track.media_id}/update/watched_eps",
body = body
)
body = body,
),
).await()
track
@ -168,7 +168,7 @@ class BangumiApi(private val client: OkHttpClient, interceptor: BangumiIntercept
.add("client_secret", clientSecret)
.add("code", code)
.add("redirect_uri", redirectUrl)
.build()
.build(),
)
companion object {
@ -201,7 +201,7 @@ class BangumiApi(private val client: OkHttpClient, interceptor: BangumiIntercept
.add("client_secret", clientSecret)
.add("refresh_token", token)
.add("redirect_uri", redirectUrl)
.build()
.build(),
)
}
}

View file

@ -34,7 +34,7 @@ class BangumiInterceptor(val bangumi: Bangumi) : Interceptor {
.header("User-Agent", "Tachiyomi")
.url(
originalRequest.url.newBuilder()
.addQueryParameter("access_token", currAuth.access_token).build()
.addQueryParameter("access_token", currAuth.access_token).build(),
)
.build() else originalRequest.newBuilder()
.post(addToken(currAuth.access_token, originalRequest.body as FormBody))
@ -51,7 +51,7 @@ class BangumiInterceptor(val bangumi: Bangumi) : Interceptor {
System.currentTimeMillis() / 1000,
oauth.expires_in,
oauth.refresh_token,
this.oauth?.user_id
this.oauth?.user_id,
)
bangumi.saveToken(oauth)

View file

@ -39,7 +39,7 @@ class DelayedTrackingStore(context: Context) {
DelayedTrackingItem(
trackId = it.key.toLong(),
mangaId = mangaId.toLong(),
lastChapterRead = lastChapterRead.toFloat()
lastChapterRead = lastChapterRead.toFloat(),
)
}
}

View file

@ -62,10 +62,10 @@ class KitsuApi(private val client: OkHttpClient, interceptor: KitsuInterceptor)
"${baseUrl}library-entries",
headers = headersOf(
"Content-Type",
"application/vnd.api+json"
"application/vnd.api+json",
),
body = data.toString().toRequestBody("application/vnd.api+json".toMediaType())
)
body = data.toString().toRequestBody("application/vnd.api+json".toMediaType()),
),
)
.await()
.parseAs<JsonObject>()
@ -98,11 +98,11 @@ class KitsuApi(private val client: OkHttpClient, interceptor: KitsuInterceptor)
.headers(
headersOf(
"Content-Type",
"application/vnd.api+json"
)
"application/vnd.api+json",
),
)
.patch(data.toString().toRequestBody("application/vnd.api+json".toMediaType()))
.build()
.build(),
)
.await()
.parseAs<JsonObject>()
@ -137,10 +137,10 @@ class KitsuApi(private val client: OkHttpClient, interceptor: KitsuInterceptor)
"X-Algolia-Application-Id",
algoliaAppId,
"X-Algolia-API-Key",
key
key,
),
body = jsonObject.toString().toRequestBody(jsonMime)
)
body = jsonObject.toString().toRequestBody(jsonMime),
),
)
.await()
.parseAs<JsonObject>()
@ -252,7 +252,7 @@ class KitsuApi(private val client: OkHttpClient, interceptor: KitsuInterceptor)
.add("refresh_token", token)
.add("client_id", clientId)
.add("client_secret", clientSecret)
.build()
.build(),
)
}
}

View file

@ -72,7 +72,7 @@ class KomgaApi(private val client: OkHttpClient) {
Request.Builder()
.url("${track.tracking_url.replace("/api/v1/series/", "/api/v2/series/")}/read-progress/tachiyomi")
.put(payload.toRequestBody("application/json".toMediaType()))
.build()
.build(),
)
.await()
return getTrackSearch(track.tracking_url)

View file

@ -92,7 +92,7 @@ data class ReadProgressDto(
booksUnreadCount,
booksInProgressCount,
lastReadContinuousIndex.toFloat(),
booksCount.toFloat()
booksCount.toFloat(),
)
}

View file

@ -165,7 +165,7 @@ class MyAnimeListApi(private val client: OkHttpClient, interceptor: MyAnimeListI
.filter {
it.jsonObject["node"]!!.jsonObject["title"]!!.jsonPrimitive.content.contains(
query,
ignoreCase = true
ignoreCase = true,
)
}
.map {

View file

@ -44,8 +44,8 @@ class ShikimoriApi(private val client: OkHttpClient, interceptor: ShikimoriInter
authClient.newCall(
POST(
"$apiUrl/v2/user_rates",
body = payload.toString().toRequestBody(jsonMime)
)
body = payload.toString().toRequestBody(jsonMime),
),
).await()
track
}
@ -153,7 +153,7 @@ class ShikimoriApi(private val client: OkHttpClient, interceptor: ShikimoriInter
.add("client_secret", clientSecret)
.add("code", code)
.add("redirect_uri", redirectUrl)
.build()
.build(),
)
companion object {
@ -186,7 +186,7 @@ class ShikimoriApi(private val client: OkHttpClient, interceptor: ShikimoriInter
.add("client_id", clientId)
.add("client_secret", clientSecret)
.add("refresh_token", token)
.build()
.build(),
)
}
}

View file

@ -45,7 +45,7 @@ class AppUpdateJob(private val context: Context, workerParams: WorkerParameters)
7,
TimeUnit.DAYS,
3,
TimeUnit.HOURS
TimeUnit.HOURS,
)
.addTag(TAG)
.setConstraints(constraints)

View file

@ -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()
@ -105,12 +105,12 @@ internal class AppUpdateNotifier(private val context: Context) {
addAction(
R.drawable.ic_system_update_alt_white_24dp,
context.getString(R.string.action_install),
installIntent
installIntent,
)
addAction(
R.drawable.ic_close_24dp,
context.getString(R.string.action_cancel),
NotificationReceiver.dismissNotificationPendingBroadcast(context, Notifications.ID_APP_UPDATER)
NotificationReceiver.dismissNotificationPendingBroadcast(context, Notifications.ID_APP_UPDATER),
)
}
notificationBuilder.show()
@ -132,12 +132,12 @@ internal class AppUpdateNotifier(private val context: Context) {
addAction(
R.drawable.ic_refresh_24dp,
context.getString(R.string.action_retry),
AppUpdateService.downloadApkPendingService(context, url)
AppUpdateService.downloadApkPendingService(context, url),
)
addAction(
R.drawable.ic_close_24dp,
context.getString(R.string.action_cancel),
NotificationReceiver.dismissNotificationPendingBroadcast(context, Notifications.ID_APP_UPDATER)
NotificationReceiver.dismissNotificationPendingBroadcast(context, Notifications.ID_APP_UPDATER),
)
}
notificationBuilder.show(Notifications.ID_APP_UPDATER)

View file

@ -50,8 +50,8 @@ class ExtensionUpdateJob(private val context: Context, workerParams: WorkerParam
context.resources.getQuantityString(
R.plurals.update_check_notification_ext_updates,
names.size,
names.size
)
names.size,
),
)
val extNames = names.joinToString(", ")
setContentText(extNames)
@ -59,7 +59,7 @@ class ExtensionUpdateJob(private val context: Context, workerParams: WorkerParam
setSmallIcon(R.drawable.ic_extension_24dp)
setContentIntent(NotificationReceiver.openExtensionsPendingActivity(context))
setAutoCancel(true)
}
},
)
}
}
@ -79,7 +79,7 @@ class ExtensionUpdateJob(private val context: Context, workerParams: WorkerParam
2,
TimeUnit.DAYS,
3,
TimeUnit.HOURS
TimeUnit.HOURS,
)
.addTag(TAG)
.setConstraints(constraints)

View file

@ -85,7 +85,7 @@ internal class ExtensionGithubApi {
hasChangelog = it.hasChangelog == 1,
sources = it.sources?.toExtensionSources() ?: emptyList(),
apkName = it.apk,
iconUrl = "${REPO_URL_PREFIX}icon/${it.apk.replace(".apk", ".png")}"
iconUrl = "${REPO_URL_PREFIX}icon/${it.apk.replace(".apk", ".png")}",
)
}
}
@ -95,7 +95,7 @@ internal class ExtensionGithubApi {
AvailableExtensionSources(
name = it.name,
id = it.id,
baseUrl = it.baseUrl
baseUrl = it.baseUrl,
)
}
}

View file

@ -70,7 +70,7 @@ class PackageInstallerInstaller(private val service: Service) : Installer(servic
service,
activeSession!!.second,
Intent(INSTALL_ACTION),
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) PendingIntent.FLAG_MUTABLE else 0
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) PendingIntent.FLAG_MUTABLE else 0,
).intentSender
session.commit(intentSender)
}

View file

@ -249,7 +249,7 @@ internal class ExtensionInstaller(private val context: Context) {
downloadManager.query(query).use { cursor ->
if (cursor.moveToFirst()) {
val localUri = cursor.getString(
cursor.getColumnIndexOrThrow(DownloadManager.COLUMN_LOCAL_URI)
cursor.getColumnIndexOrThrow(DownloadManager.COLUMN_LOCAL_URI),
).removePrefix(FILE_SCHEME)
installApk(id, File(localUri).getUriCompat(context))

View file

@ -120,7 +120,7 @@ internal object ExtensionLoader {
if (libVersion < LIB_VERSION_MIN || libVersion > LIB_VERSION_MAX) {
val exception = Exception(
"Lib version is $libVersion, while only versions " +
"$LIB_VERSION_MIN to $LIB_VERSION_MAX are allowed"
"$LIB_VERSION_MIN to $LIB_VERSION_MAX are allowed",
)
logcat(LogPriority.WARN, exception)
return LoadResult.Error(exception)
@ -190,7 +190,7 @@ internal object ExtensionLoader {
sources = sources,
pkgFactory = appInfo.metaData.getString(METADATA_SOURCE_FACTORY),
isUnofficial = signatureHash != officialSignature,
icon = context.getApplicationIcon(pkgName)
icon = context.getApplicationIcon(pkgName),
)
return LoadResult.Success(extension)
}

View file

@ -26,9 +26,9 @@ 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()
.build(),
)
fun OkHttpClient.Builder.dohGoogle() = dns(
@ -38,9 +38,9 @@ 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()
.build(),
)
// AdGuard "Default" DNS works too but for the sake of making sure no site is blacklisted,
@ -52,9 +52,9 @@ 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()
.build(),
)
fun OkHttpClient.Builder.dohQuad9() = dns(
@ -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()
.build(),
)

View file

@ -79,7 +79,7 @@ suspend fun Call.await(): Response {
if (continuation.isCancelled) return
continuation.resumeWithException(e)
}
}
},
)
continuation.invokeOnCancellation {

View file

@ -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
@ -314,7 +314,7 @@ class LocalSource(private val context: Context) : CatalogueSource, UnmeteredSour
private class OrderBy(context: Context) : Filter.Sort(
context.getString(R.string.local_filter_order_by),
arrayOf(context.getString(R.string.title), context.getString(R.string.date)),
Selection(0, true)
Selection(0, true),
)
sealed class Format {
@ -353,5 +353,5 @@ private val WHITESPACE_CHARS = arrayOf(
'\u2029',
'\u202F',
'\u205F',
'\u3000'
'\u3000',
)

View file

@ -42,7 +42,7 @@ interface Source : tachiyomi.source.Source {
*/
@Deprecated(
"Use the 1.x API instead",
ReplaceWith("getMangaDetails")
ReplaceWith("getMangaDetails"),
)
fun fetchMangaDetails(manga: SManga): Observable<SManga> = throw IllegalStateException("Not used")
@ -53,7 +53,7 @@ interface Source : tachiyomi.source.Source {
*/
@Deprecated(
"Use the 1.x API instead",
ReplaceWith("getChapterList")
ReplaceWith("getChapterList"),
)
fun fetchChapterList(manga: SManga): Observable<List<SChapter>> = throw IllegalStateException("Not used")
@ -65,7 +65,7 @@ interface Source : tachiyomi.source.Source {
*/
@Deprecated(
"Use the 1.x API instead",
ReplaceWith("getPageList")
ReplaceWith("getPageList"),
)
fun fetchPageList(chapter: SChapter): Observable<List<Page>> = Observable.empty()

View file

@ -45,7 +45,7 @@ open class SourceManager(private val context: Context) {
}
private fun createInternalSources(): List<Source> = listOf(
LocalSource(context)
LocalSource(context),
)
inner class StubSource(override val id: Long) : Source {

View file

@ -68,13 +68,13 @@ open class Page(
fun Page.toPageUrl(): PageUrl {
return PageUrl(
url = this.imageUrl ?: this.url
url = this.imageUrl ?: this.url,
)
}
fun PageUrl.toPage(index: Int): Page {
return Page(
index = index,
imageUrl = this.url
imageUrl = this.url,
)
}

View file

@ -36,7 +36,7 @@ fun SChapter.toChapterInfo(): ChapterInfo {
key = this.url,
name = this.name,
number = this.chapter_number,
scanlator = this.scanlator ?: ""
scanlator = this.scanlator ?: "",
)
}

View file

@ -75,7 +75,7 @@ fun SManga.toMangaInfo(): MangaInfo {
description = this.description ?: "",
genres = this.genre?.split(", ") ?: emptyList(),
status = this.status,
cover = this.thumbnail_url ?: ""
cover = this.thumbnail_url ?: "",
)
}

View file

@ -46,7 +46,7 @@ abstract class BaseController<VB : ViewBinding>(bundle: Bundle? = null) : Contro
viewScope.cancel()
logcat { "Destroy view for ${controller.instance()}" }
}
}
},
)
}
@ -107,7 +107,7 @@ abstract class BaseController<VB : ViewBinding>(bundle: Bundle? = null) : Contro
return onCollapse?.invoke(item) ?: true
}
}
},
)
if (expandActionViewFromInteraction) {

View file

@ -90,7 +90,7 @@ abstract class DialogController : Controller {
RouterTransaction.with(this)
.pushChangeHandler(SimpleSwapChangeHandler(false))
.popChangeHandler(SimpleSwapChangeHandler(false))
.tag(tag)
.tag(tag),
)
}

View file

@ -17,7 +17,7 @@ class OneWayFadeChangeHandler : FadeChangeHandler {
constructor(duration: Long) : super(duration)
constructor(duration: Long, removesFromViewOnPush: Boolean) : super(
duration,
removesFromViewOnPush
removesFromViewOnPush,
)
override fun getAnimator(

View file

@ -57,7 +57,7 @@ abstract class SearchableNucleusController<VB : ViewBinding, P : BasePresenter<*
// Remove formatting from pasted text
val searchAutoComplete: SearchView.SearchAutoComplete = searchView.findViewById(
R.id.search_src_text
R.id.search_src_text,
)
searchAutoComplete.addTextChangedListener(object : TextWatcher {
override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) {}
@ -68,7 +68,7 @@ abstract class SearchableNucleusController<VB : ViewBinding, P : BasePresenter<*
editable.getSpans(0, editable.length, CharacterStyle::class.java)
.forEach { editable.removeSpan(it) }
}
})
},)
searchView.queryTextEvents()
.onEach {
@ -149,7 +149,7 @@ abstract class SearchableNucleusController<VB : ViewBinding, P : BasePresenter<*
onSearchMenuItemActionCollapse(item)
return true
}
}
},
)
}

View file

@ -31,7 +31,7 @@ class BrowseController :
TabbedController {
constructor(toExtensions: Boolean = false) : super(
bundleOf(TO_EXTENSIONS_EXTRA to toExtensions)
bundleOf(TO_EXTENSIONS_EXTRA to toExtensions),
)
@Suppress("unused")
@ -114,7 +114,7 @@ class BrowseController :
private val tabTitles = listOf(
R.string.label_sources,
R.string.label_extensions,
R.string.label_migration
R.string.label_migration,
)
.map { resources!!.getString(it) }

View file

@ -93,7 +93,7 @@ open class ExtensionController :
R.id.action_search -> expandActionViewFromInteraction = true
R.id.action_settings -> {
parentController!!.router.pushController(
ExtensionFilterController().withFadeTransaction()
ExtensionFilterController().withFadeTransaction(),
)
}
}
@ -215,7 +215,7 @@ open class ExtensionController :
is Extension.Untrusted -> it.extension.name.contains(query, ignoreCase = true)
}
}
}
},
)
} else {
adapter?.updateDataSet(extensions)

View file

@ -73,7 +73,7 @@ class ExtensionHolder(view: View, val adapter: ExtensionAdapter) :
is Extension.Available -> R.string.ext_install
}
}
}
},
)
val isIdle = installStep == InstallStep.Idle || installStep == InstallStep.Error

View file

@ -69,7 +69,7 @@ open class ExtensionPresenter(
val installedSorted = installed.filter { !it.hasUpdate && (showNsfwSources || !it.isNsfw) }
.sortedWith(
compareBy<Extension.Installed> { !it.isObsolete }
.thenBy(String.CASE_INSENSITIVE_ORDER) { it.name }
.thenBy(String.CASE_INSENSITIVE_ORDER) { it.name },
)
val untrustedSorted = untrusted.sortedWith(compareBy(String.CASE_INSENSITIVE_ORDER) { it.name })
@ -163,7 +163,7 @@ open class ExtensionPresenter(
if (item != null) {
view.downloadUpdate(item)
}
})
},)
}
fun uninstallExtension(pkgName: String) {

View file

@ -14,8 +14,8 @@ class ExtensionTrustDialog<T>(bundle: Bundle? = null) : DialogController(bundle)
constructor(target: T, signatureHash: String, pkgName: String) : this(
bundleOf(
SIGNATURE_KEY to signatureHash,
PKGNAME_KEY to pkgName
)
PKGNAME_KEY to pkgName,
),
) {
targetController = target
}

View file

@ -55,7 +55,7 @@ class ExtensionDetailsController(bundle: Bundle? = null) :
private var preferenceScreen: PreferenceScreen? = null
constructor(pkgName: String) : this(
bundleOf(PKGNAME_KEY to pkgName)
bundleOf(PKGNAME_KEY to pkgName),
)
init {
@ -91,7 +91,7 @@ class ExtensionDetailsController(bundle: Bundle? = null) :
binding.extensionPrefsRecycler.layoutManager = LinearLayoutManager(context)
binding.extensionPrefsRecycler.adapter = ConcatAdapter(
ExtensionDetailsHeaderAdapter(presenter),
initPreferencesAdapter(context, extension)
initPreferencesAdapter(context, extension),
)
}
@ -166,7 +166,7 @@ class ExtensionDetailsController(bundle: Bundle? = null) :
block()
onSettingsClick = View.OnClickListener {
router.pushController(
SourcePreferencesController(source.id).withFadeTransaction()
SourcePreferencesController(source.id).withFadeTransaction(),
)
}
}

View file

@ -33,7 +33,7 @@ class ExtensionDetailsPresenter(
.observeOn(AndroidSchedulers.mainThread())
.subscribeFirst({ view, _ ->
view.onExtensionUninstalled()
})
},)
}
fun uninstallExtension() {

View file

@ -43,7 +43,7 @@ class SourcePreferencesController(bundle: Bundle? = null) :
private var preferenceScreen: PreferenceScreen? = null
constructor(sourceId: Long) : this(
bundleOf(SOURCE_ID to sourceId)
bundleOf(SOURCE_ID to sourceId),
)
override fun createBinding(inflater: LayoutInflater): SourcePreferencesControllerBinding {
@ -69,7 +69,7 @@ class SourcePreferencesController(bundle: Bundle? = null) :
val themedContext by lazy { getPreferenceThemeContext() }
val manager = PreferenceManager(themedContext)
val dataStore = SharedPreferencesDataStore(
context.getSharedPreferences(source.getPreferenceKey(), Context.MODE_PRIVATE)
context.getSharedPreferences(source.getPreferenceKey(), Context.MODE_PRIVATE),
)
manager.preferenceDataStore = dataStore
manager.onDisplayPreferenceDialogListener = this
@ -158,7 +158,7 @@ class SourcePreferencesController(bundle: Bundle? = null) :
.newInstance(preference.getKey())
else -> throw IllegalArgumentException(
"Tried to display dialog for unknown " +
"preference type. Did you forget to override onDisplayPreferenceDialog()?"
"preference type. Did you forget to override onDisplayPreferenceDialog()?",
)
}
f.targetController = this

View file

@ -23,14 +23,14 @@ class MigrationMangaController :
constructor(sourceId: Long, sourceName: String?) : super(
bundleOf(
SOURCE_ID_EXTRA to sourceId,
SOURCE_NAME_EXTRA to sourceName
)
SOURCE_NAME_EXTRA to sourceName,
),
)
@Suppress("unused")
constructor(bundle: Bundle) : this(
bundle.getLong(SOURCE_ID_EXTRA),
bundle.getString(SOURCE_NAME_EXTRA)
bundle.getString(SOURCE_NAME_EXTRA),
)
private val sourceId: Long = args.getLong(SOURCE_ID_EXTRA)

View file

@ -27,7 +27,7 @@ class SearchController(
override fun createPresenter(): GlobalSearchPresenter {
return SearchPresenter(
initialQuery,
manga!!
manga!!,
)
}

View file

@ -40,7 +40,7 @@ class SearchPresenter(
replacingMangaRelay.subscribeLatestCache(
{ controller, (isReplacingManga, newManga) ->
(controller as? SearchController)?.renderIsReplacingManga(isReplacingManga, newManga)
}
},
)
}
@ -93,15 +93,15 @@ class SearchPresenter(
val flags = preferences.migrateFlags().get()
val migrateChapters =
MigrationFlags.hasChapters(
flags
flags,
)
val migrateCategories =
MigrationFlags.hasCategories(
flags
flags,
)
val migrateTracks =
MigrationFlags.hasTracks(
flags
flags,
)
db.inTransaction {

View file

@ -18,7 +18,7 @@ class SourceSearchController(
if (searchQuery != null) {
putString(SEARCH_QUERY_KEY, searchQuery)
}
}
},
)
private var oldManga: Manga? = args.getSerializable(MANGA_KEY) as Manga?
private var newManga: Manga? = null

View file

@ -27,7 +27,7 @@ class SelectionHeader : AbstractHeaderItem<SelectionHeader.Holder>() {
override fun createViewHolder(view: View, adapter: FlexibleAdapter<IFlexible<RecyclerView.ViewHolder>>): Holder {
return Holder(
view,
adapter
adapter,
)
}

View file

@ -30,7 +30,7 @@ data class SourceItem(val source: Source, val mangaCount: Int, val header: Selec
override fun createViewHolder(view: View, adapter: FlexibleAdapter<IFlexible<RecyclerView.ViewHolder>>): SourceHolder {
return SourceHolder(
view,
adapter as SourceAdapter
adapter as SourceAdapter,
)
}

View file

@ -124,7 +124,7 @@ class SourceController :
val isPinned = item.header?.code?.equals(SourcePresenter.PINNED_KEY) ?: false
val items = mutableListOf(
activity.getString(if (isPinned) R.string.action_unpin else R.string.action_pin) to { toggleSourcePin(item.source) }
activity.getString(if (isPinned) R.string.action_unpin else R.string.action_pin) to { toggleSourcePin(item.source) },
)
if (item.source !is LocalSource) {
items.add(activity.getString(R.string.action_disable) to { disableSource(item.source) })
@ -195,7 +195,7 @@ class SourceController :
R.id.action_settings -> {
parentController!!.router.pushController(
SourceFilterController()
.withFadeTransaction()
.withFadeTransaction(),
)
}
}
@ -248,13 +248,13 @@ class SourceController :
R.menu.browse_sources,
R.id.action_search,
R.string.action_global_search_hint,
false // GlobalSearch handles the searching here
false, // GlobalSearch handles the searching here
)
}
override fun onSearchViewQueryTextSubmit(query: String?) {
parentController!!.router.pushController(
GlobalSearchController(query).withFadeTransaction()
GlobalSearchController(query).withFadeTransaction(),
)
}
}

View file

@ -37,8 +37,8 @@ class SourceFilterController : SettingsController() {
val orderedLangs = sourcesByLang.keys.sortedWith(
compareBy(
{ it !in activeLangsCodes },
{ LocaleHelper.getSourceDisplayName(it, context) }
)
{ LocaleHelper.getSourceDisplayName(it, context) },
),
)
orderedLangs.forEach { lang ->

View file

@ -76,7 +76,7 @@ open class BrowseSourceController(bundle: Bundle) :
if (searchQuery != null) {
putString(SEARCH_QUERY_KEY, searchQuery)
}
}
},
)
private val preferences: PreferencesHelper by injectLazy()
@ -155,7 +155,7 @@ open class BrowseSourceController(bundle: Bundle) :
val newFilters = presenter.source.getFilterList()
presenter.sourceFilters = newFilters
filterSheet?.setFilters(presenter.filterItems)
}
},
)
filterSheet?.setFilters(presenter.filterItems)
@ -269,7 +269,7 @@ open class BrowseSourceController(bundle: Bundle) :
}
true
}
},
)
val displayItem = when (preferences.sourceDisplayMode().get()) {
@ -426,13 +426,13 @@ open class BrowseSourceController(bundle: Bundle) :
if (adapter.isEmpty) {
val actions = if (presenter.source is LocalSource) {
listOf(
EmptyView.Action(R.string.local_source_help_guide, R.drawable.ic_help_24dp) { openLocalSourceHelpGuide() }
EmptyView.Action(R.string.local_source_help_guide, R.drawable.ic_help_24dp) { openLocalSourceHelpGuide() },
)
} else {
listOf(
EmptyView.Action(R.string.action_retry, R.drawable.ic_refresh_24dp, retryAction),
EmptyView.Action(R.string.action_open_in_web_view, R.drawable.ic_public_24dp) { openInWebView() },
EmptyView.Action(R.string.label_help, R.drawable.ic_help_24dp) { activity?.openInBrowser(MoreController.URL_HELP) }
EmptyView.Action(R.string.label_help, R.drawable.ic_help_24dp) { activity?.openInBrowser(MoreController.URL_HELP) },
)
}

View file

@ -157,7 +157,7 @@ open class BrowseSourcePresenter(
},
{ _, error ->
logcat(LogPriority.ERROR, error)
}
},
)
// Request first page.

View file

@ -49,7 +49,7 @@ class SourceFilterSheet(
private val binding = SourceFilterSheetBinding.inflate(
LayoutInflater.from(context),
null,
false
false,
)
init {

Some files were not shown because too many files have changed in this diff Show more