Skip to content

Commit

Permalink
Running ktlint (trailing commas added everywhere)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jays2Kings committed May 2, 2022
1 parent fd1f5a4 commit d77d18a
Show file tree
Hide file tree
Showing 331 changed files with 1,526 additions and 1,492 deletions.
5 changes: 5 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion app/src/main/java/eu/kanade/tachiyomi/App.kt
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ open class App : Application(), DefaultLifecycleObserver {
this@App,
0,
Intent(ACTION_DISABLE_INCOGNITO_MODE),
PendingIntent.FLAG_ONE_SHOT or PendingIntent.FLAG_IMMUTABLE
PendingIntent.FLAG_ONE_SHOT or PendingIntent.FLAG_IMMUTABLE,
)
setContentIntent(pendingIntent)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,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)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ class BackupNotifier(private val context: Context) {
addAction(
R.drawable.ic_share_24dp,
context.getString(R.string.share),
NotificationReceiver.shareBackupPendingBroadcast(context, unifile.uri, Notifications.ID_BACKUP_COMPLETE)
NotificationReceiver.shareBackupPendingBroadcast(context, unifile.uri, Notifications.ID_BACKUP_COMPLETE),
)

show(Notifications.ID_BACKUP_COMPLETE)
Expand All @@ -97,7 +97,7 @@ class BackupNotifier(private val context: Context) {
addAction(
R.drawable.ic_close_24dp,
context.getString(R.string.stop),
NotificationReceiver.cancelRestorePendingBroadcast(context, Notifications.ID_RESTORE_PROGRESS)
NotificationReceiver.cancelRestorePendingBroadcast(context, Notifications.ID_RESTORE_PROGRESS),
)
}

Expand All @@ -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) {
Expand All @@ -142,7 +142,7 @@ class BackupNotifier(private val context: Context) {
addAction(
R.drawable.ic_eye_24dp,
context.getString(R.string.open_log),
NotificationReceiver.openErrorOrSkippedLogPendingActivity(context, uri)
NotificationReceiver.openErrorOrSkippedLogPendingActivity(context, uri),
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ class FullBackupRestore(context: Context, notifier: BackupNotifier) : AbstractBa
history: List<BackupHistory>,
tracks: List<Track>,
backupCategories: List<BackupCategory>,
customManga: CustomMangaManager.MangaJson?
customManga: CustomMangaManager.MangaJson?,
) {
db.inTransaction {
val dbManga = backupManager.getMangaFromDatabase(manga)
Expand Down Expand Up @@ -129,7 +129,7 @@ class FullBackupRestore(context: Context, notifier: BackupNotifier) : AbstractBa
history: List<BackupHistory>,
tracks: List<Track>,
backupCategories: List<BackupCategory>,
customManga: CustomMangaManager.MangaJson?
customManga: CustomMangaManager.MangaJson?,
) {
try {
val fetchedManga = backupManager.restoreManga(manga)
Expand All @@ -149,7 +149,7 @@ class FullBackupRestore(context: Context, notifier: BackupNotifier) : AbstractBa
history: List<BackupHistory>,
tracks: List<Track>,
backupCategories: List<BackupCategory>,
customManga: CustomMangaManager.MangaJson?
customManga: CustomMangaManager.MangaJson?,
) {
backupManager.restoreChaptersForManga(backupManga, chapters)

Expand All @@ -162,7 +162,7 @@ class FullBackupRestore(context: Context, notifier: BackupNotifier) : AbstractBa
history: List<BackupHistory>,
tracks: List<Track>,
backupCategories: List<BackupCategory>,
customManga: CustomMangaManager.MangaJson?
customManga: CustomMangaManager.MangaJson?,
) {
// Restore categories
backupManager.restoreCategoriesForManga(manga, categories, backupCategories)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
)
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class BackupCategory(
name = category.name,
order = category.order,
flags = category.flags,
mangaSort = category.mangaSort
mangaSort = category.mangaSort,
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ data class BackupChapter(
dateFetch = chapter.date_fetch,
dateUpload = chapter.date_upload,
sourceOrder = chapter.source_order,
pagesLeft = chapter.pages_left
pagesLeft = chapter.pages_left,
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ data class BackupManga(
@ProtoNumber(802) var customAuthor: String? = null,
// skipping 803 due to using duplicate value in previous builds
@ProtoNumber(804) var customDescription: String? = null,
@ProtoNumber(805) var customGenre: List<String>? = null
@ProtoNumber(805) var customGenre: List<String>? = null,
) {
fun getMangaImpl(): MangaImpl {
return MangaImpl().apply {
Expand Down Expand Up @@ -92,7 +92,7 @@ data class BackupManga(
artist = customArtist,
description = customDescription,
genre = customGenre?.toTypedArray(),
status = customStatus.takeUnless { it == 0 }
status = customStatus.takeUnless { it == 0 },
)
}
return null
Expand Down Expand Up @@ -120,7 +120,7 @@ data class BackupManga(
dateAdded = manga.date_added,
viewer = manga.readingModeType,
viewer_flags = manga.viewer_flags.takeIf { it != -1 } ?: 0,
chapterFlags = manga.chapter_flags
chapterFlags = manga.chapter_flags,
).also { backupManga ->
customMangaManager?.getManga(manga)?.let {
backupManga.customTitle = it.title
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,19 @@ 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 {
return BackupSource(
name = source.name,
sourceId = source.id
sourceId = source.id,
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,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,
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ class ChapterCache(private val context: Context) {
PARAMETER_APP_VERSION,
PARAMETER_VALUE_COUNT,
// 4 pages = 115MB, 6 = ~150MB, 10 = ~200MB, 20 = ~300MB
(PARAMETER_CACHE_SIZE * cacheSize.toFloat().pow(0.6f)).roundToLong()
(PARAMETER_CACHE_SIZE * cacheSize.toFloat().pow(0.6f)).roundToLong(),
)
}

Expand Down
10 changes: 5 additions & 5 deletions app/src/main/java/eu/kanade/tachiyomi/data/cache/CoverCache.kt
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ class CoverCache(val context: Context) {
context.toast(
context.getString(
R.string.deleted_,
Formatter.formatFileSize(context, deletedSize)
)
Formatter.formatFileSize(context, deletedSize),
),
)
}
}
Expand All @@ -108,8 +108,8 @@ class CoverCache(val context: Context) {
context.toast(
context.getString(
R.string.deleted_,
Formatter.formatFileSize(context, deletedSize)
)
Formatter.formatFileSize(context, deletedSize),
),
)
}
context.imageLoader.memoryCache.clear()
Expand Down Expand Up @@ -217,7 +217,7 @@ class CoverCache(val context: Context) {
*/
fun deleteFromCache(
manga: Manga,
deleteCustom: Boolean = true
deleteCustom: Boolean = true,
) {
// Check if url is empty.
if (manga.thumbnail_url.isNullOrEmpty()) return
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import eu.kanade.tachiyomi.data.database.tables.CategoryTable.TABLE
class CategoryTypeMapping : SQLiteTypeMapping<Category>(
CategoryPutResolver(),
CategoryGetResolver(),
CategoryDeleteResolver()
CategoryDeleteResolver(),
)

class CategoryPutResolver : DefaultPutResolver<Category>() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import eu.kanade.tachiyomi.data.database.tables.ChapterTable.TABLE
class ChapterTypeMapping : SQLiteTypeMapping<Chapter>(
ChapterPutResolver(),
ChapterGetResolver(),
ChapterDeleteResolver()
ChapterDeleteResolver(),
)

class ChapterPutResolver : DefaultPutResolver<Chapter>() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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>() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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>() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import eu.kanade.tachiyomi.data.database.tables.MangaTable.TABLE
class MangaTypeMapping : SQLiteTypeMapping<Manga>(
MangaPutResolver(),
MangaGetResolver(),
MangaDeleteResolver()
MangaDeleteResolver(),
)

class MangaPutResolver : DefaultPutResolver<Manga>() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import eu.kanade.tachiyomi.data.database.tables.SearchMetadataTable.TABLE
class SearchMetadataTypeMapping : SQLiteTypeMapping<SearchMetadata>(
SearchMetadataPutResolver(),
SearchMetadataGetResolver(),
SearchMetadataDeleteResolver()
SearchMetadataDeleteResolver(),
)

class SearchMetadataPutResolver : DefaultPutResolver<SearchMetadata>() {
Expand Down Expand Up @@ -51,7 +51,7 @@ class SearchMetadataGetResolver : DefaultGetResolver<SearchMetadata>() {
uploader = cursor.getString(cursor.getColumnIndex(COL_UPLOADER)),
extra = cursor.getString(cursor.getColumnIndex(COL_EXTRA)),
indexedExtra = cursor.getString(cursor.getColumnIndex(COL_INDEXED_EXTRA)),
extraVersion = cursor.getInt(cursor.getColumnIndex(COL_EXTRA_VERSION))
extraVersion = cursor.getInt(cursor.getColumnIndex(COL_EXTRA_VERSION)),
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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>() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ interface Manga : SManga {
TYPE_MANHUA -> R.string.manhua
TYPE_COMIC -> R.string.comic
else -> R.string.manga
}
},
).lowercase(Locale.getDefault())
}

Expand Down Expand Up @@ -133,7 +133,7 @@ interface Manga : SManga {
TYPE_WEBTOON
} else if (currentTags.any { tag -> isManhuaTag(tag) } || sourceName.contains(
"manhua",
true
true,
)
) {
TYPE_MANHUA
Expand Down Expand Up @@ -348,6 +348,6 @@ fun Manga.toMangaInfo(): MangaInfo {
genres = this.getGenres() ?: emptyList(),
key = this.url,
status = this.status,
title = this.title
title = this.title,
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ data class SearchMetadata(
val indexedExtra: String?,

// The version of this metadata's extra. Used to track changes to the 'extra' field's schema
val extraVersion: Int
val extraVersion: Int,
) {
// Transient information attached to this piece of metadata, useful for caching
var transientCache: Map<String, Any>? = null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ interface CategoryQueries : DbProvider {
Query.builder()
.table(CategoryTable.TABLE)
.orderBy(CategoryTable.COL_ORDER)
.build()
.build(),
)
.prepare()

Expand All @@ -25,7 +25,7 @@ interface CategoryQueries : DbProvider {
RawQuery.builder()
.query(getCategoriesForMangaQuery())
.args(manga.id)
.build()
.build(),
)
.prepare()

Expand Down
Loading

0 comments on commit d77d18a

Please sign in to comment.