Skip to content

Commit

Permalink
update gradle and format files
Browse files Browse the repository at this point in the history
  • Loading branch information
nonproto committed Sep 16, 2022
1 parent 1a40dcf commit 88a50d5
Show file tree
Hide file tree
Showing 210 changed files with 1,267 additions and 1,116 deletions.
18 changes: 16 additions & 2 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
[*.{kt,kts}]
indent_size = 4
[*]
indent_style = space
indent_size = 2

end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.{java,kt,kts,scala,rs,xml,kt.spec,kts.spec}]
indent_size = 4

[*.{kt,kts}]
ij_kotlin_imports_layout = *
ij_kotlin_allow_trailing_comma = true
ij_kotlin_allow_trailing_comma_on_call_site = true

[*.md]
trim_trailing_whitespace = false
6 changes: 2 additions & 4 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ android {
kotlinOptions {
jvmTarget = JavaVersion.VERSION_1_8.toString()
}
namespace = "eu.kanade.tachiyomi"
}

dependencies {
Expand Down Expand Up @@ -206,7 +207,6 @@ dependencies {

implementation(libs.bundles.flexibleadapter)

implementation("com.nightlynexus.viewstatepageradapter:viewstatepageradapter:1.1.0")
implementation("com.github.chrisbanes:PhotoView:2.3.0")
implementation("com.github.CarlosEsco:ViewTooltip:f79a8955ef")
implementation("com.getkeepsafe.taptargetview:taptargetview:1.13.3")
Expand Down Expand Up @@ -235,8 +235,6 @@ dependencies {

testImplementation(libs.bundles.tests)

//implementation("com.github.PhilJay:MPAndroidChart:v3.1.0")

}

tasks {
Expand Down Expand Up @@ -272,7 +270,7 @@ tasks {
}

preBuild {
// dependsOn(formatKotlin)
dependsOn(formatKotlin)
}
}

3 changes: 1 addition & 2 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="eu.kanade.tachiyomi">
xmlns:tools="http://schemas.android.com/tools">

<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.BROADCAST_CLOSE_SYSTEM_DIALOGS" />
Expand Down
1 change: 0 additions & 1 deletion app/src/main/java/eu/kanade/tachiyomi/Migrations.kt
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,6 @@ object Migrations {
LibraryUpdateJob.setupTask(context)
}


return true
}
return false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import com.hippo.unifile.UniFile
import eu.kanade.tachiyomi.data.notification.Notifications
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
import eu.kanade.tachiyomi.util.system.notificationManager

import uy.kohesive.injekt.Injekt
import uy.kohesive.injekt.api.get
import java.util.concurrent.TimeUnit
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ class BackupFileValidator(
.map { context.getString(it.nameRes()) }
.sorted()


return Results(missingTrackers, !hasDexEntries)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,6 @@ class BackupManager(val context: Context) {
databaseHelper.getChapter(history.chapter_id).executeAsBlocking()?.url?.let {
BackupHistory(it, history.last_read, history.time_read)
}

}
if (history.isNotEmpty()) {
mangaObject.history = history
Expand All @@ -203,7 +202,7 @@ class BackupManager(val context: Context) {
manga.favorite = dbManga.favorite || manga.favorite
databaseHelper.insertManga(manga).executeAsBlocking()
}

/**
* Restore the categories from Json
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ class BackupRestorer(val context: Context, val job: Job?) {
restoreCategories(backup.backupCategories)
}


dexManga.groupBy { MdUtil.getMangaUUID(it.url) }.forEach { (_, mangaList) ->
restoreManga(mangaList.first().title, mangaList, backup.backupCategories)
}
Expand Down Expand Up @@ -138,7 +137,7 @@ class BackupRestorer(val context: Context, val job: Job?) {
tracking = tempTracks,
)
}
//always make it EN source
// always make it EN source
backupManga.source = SourceManager.getId(MdLang.ENGLISH.lang)

val manga = backupManga.getMangaImpl()
Expand All @@ -150,7 +149,6 @@ class BackupRestorer(val context: Context, val job: Job?) {
val dbManga = backupManager.getMangaFromDatabase(manga)
val dbMangaExists = dbManga != null


if (dbMangaExists) {
backupManager.restoreMangaNoFetch(manga, dbManga!!)
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ data class BackupManga(
@ProtoNumber(902) var mergedMangaImageUrl: String? = null,
@ProtoNumber(903) var alternativeArtwork: String? = null,

) {
) {
fun getMangaImpl(): MangaImpl {
return MangaImpl().apply {
url = this@BackupManga.url.replace(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ data class BackupTracking(
@ProtoNumber(1) var syncId: Int,
// LibraryId is not null in 1.x
@ProtoNumber(2) var libraryId: Long,
@Deprecated("Use mediaId instead", level = DeprecationLevel.WARNING) @ProtoNumber(3) var mediaIdInt: Int = 0,
@Deprecated("Use mediaId instead", level = DeprecationLevel.WARNING)
@ProtoNumber(3)
var mediaIdInt: Int = 0,
// trackingUrl is called mediaUrl in 1.x
@ProtoNumber(4) var trackingUrl: String = "",
@ProtoNumber(5) var title: String = "",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class ArtWorkGetResolver : DefaultGetResolver<ArtworkImpl>() {
locale = cursor.getString(cursor.getColumnIndex(ArtworkTable.COL_LOCALE)),
description = cursor.getString(cursor.getColumnIndex(ArtworkTable.COL_DESCRIPTION)),

)
)
}

class ArtWorkDeleteResolver : DefaultDeleteResolver<ArtworkImpl>() {
Expand All @@ -61,4 +61,3 @@ class ArtWorkDeleteResolver : DefaultDeleteResolver<ArtworkImpl>() {
.whereArgs(obj.id)
.build()
}

Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,6 @@ interface BaseMangaGetResolver {
user_cover = cursor.getString(cursor.getColumnIndex(COL_USER_COVER))
user_title = cursor.getString(cursor.getColumnIndex(COL_USER_TITLE))
filtered_language = cursor.getString(cursor.getColumnIndex(COL_LANGUAGE_FILTER_FLAG))

}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,4 +70,3 @@ fun Chapter.fullUrl(): String {
fun Chapter.uuid(): String {
return MdUtil.getChapterUUID(this.url)
}

Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ open class MangaImpl : Manga {
override var filtered_scanlators: String? = null

override var filtered_language: String? = null

override var missing_chapters: String? = null

override var rating: String? = null
Expand Down Expand Up @@ -110,7 +110,10 @@ open class MangaImpl : Manga {
}

override fun hashCode(): Int {
return if (::url.isInitialized) url.hashCode()
else (id ?: 0L).hashCode()
return if (::url.isInitialized) {
url.hashCode()
} else {
(id ?: 0L).hashCode()
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ class DownloadCache(
sourceValue.key,
)
val id = manga?.id ?: return@mapNotNull null

val mangadexIds = mangaDir.value.files.map { it.takeLast(36) }
.filter {
it.isUUID()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -237,8 +237,11 @@ class DownloadProvider(private val context: Context) {

fun getJ2kChapterName(chapter: Chapter): String {
return DiskUtil.buildValidFilename(
if (chapter.scanlator != null) "${chapter.scanlator}_${chapter.name}"
else chapter.name,
if (chapter.scanlator != null) {
"${chapter.scanlator}_${chapter.name}"
} else {
chapter.name
},
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,8 @@ class Downloader(
chapterCache.getImageFile(
page.imageUrl!!,
),
tmpDir, filename,
tmpDir,
filename,
)
else -> downloadImage(page, download.source, tmpDir, filename)
}
Expand Down Expand Up @@ -509,7 +510,7 @@ class Downloader(
private fun getImageExtension(response: Response, file: UniFile): String {
// Read content type if available.
val mime = response.body?.contentType()?.let { ct -> "${ct.type}/${ct.subtype}" }
// Else guess from the uri.
// Else guess from the uri.
?: context.contentResolver.getType(file.uri)
// Else read magic numbers.
?: ImageUtil.findImageType { file.openInputStream() }?.mime
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ class Download(val source: HttpSource, val manga: Manga, val chapter: Chapter) {
QUEUE,
DOWNLOADING,
DOWNLOADED,
ERROR
ERROR,

;

companion object {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ class AlternativeMangaCoverFetcher(
else -> null
}
}

private enum class Type {
File, URL;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,3 @@ inline fun ImageView.loadManga(
.build()
return imageLoader.enqueue(request)
}

Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,3 @@ class ArtworkKeyer : Keyer<Artwork> {
}
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,9 @@ class LibraryUpdateNotifier(private val context: Context) {
(chapterNames.size - (MAX_CHAPTERS - 1)),
(chapterNames.size - (MAX_CHAPTERS - 1)),
)
} else chapterNames.joinToString(", ")
} else {
chapterNames.joinToString(", ")
}
setContentText(chaptersNames)
setStyle(NotificationCompat.BigTextStyle().bigText(chaptersNames))
priority = NotificationCompat.PRIORITY_HIGH
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ object LibraryUpdateRanker {
val time = System.currentTimeMillis()
return Comparator {
mangaFirst: Manga,
mangaSecond: Manga,
->
mangaSecond: Manga, ->
compareValues(abs(mangaSecond.next_update - time), abs(mangaFirst.next_update - time))
}.reversed()
}
Expand All @@ -42,8 +41,7 @@ object LibraryUpdateRanker {
fun latestFirstRanking(): Comparator<Manga> {
return Comparator {
mangaFirst: Manga,
mangaSecond: Manga,
->
mangaSecond: Manga, ->
compareValues(mangaSecond.last_update, mangaFirst.last_update)
}
}
Expand All @@ -57,8 +55,7 @@ object LibraryUpdateRanker {
fun lexicographicRanking(): Comparator<Manga> {
return Comparator {
mangaFirst: Manga,
mangaSecond: Manga,
->
mangaSecond: Manga, ->
compareValues(mangaFirst.title, mangaSecond.title)
}
}
Expand Down
Loading

0 comments on commit 88a50d5

Please sign in to comment.