From 281470252b85ccb3390679495ea6a1e0f463ef93 Mon Sep 17 00:00:00 2001 From: Jay Date: Sun, 9 Aug 2020 15:21:08 -0400 Subject: [PATCH] compile fixes --- .../eu/kanade/tachiyomi/data/backup/BackupCreatorJob.kt | 1 - .../kanade/tachiyomi/data/download/DownloadProvider.kt | 9 +++------ .../eu/kanade/tachiyomi/data/track/anilist/AnilistApi.kt | 1 - .../eu/kanade/tachiyomi/data/track/bangumi/BangumiApi.kt | 1 - .../tachiyomi/data/track/myanimelist/MyAnimeListApi.kt | 1 - .../tachiyomi/data/track/shikimori/ShikimoriApi.kt | 3 +-- .../java/eu/kanade/tachiyomi/ui/main/MainActivity.kt | 1 - .../tachiyomi/ui/manga/track/TrackingBottomSheet.kt | 1 - .../tachiyomi/ui/reader/viewer/pager/PagerPageHolder.kt | 3 +-- .../ui/reader/viewer/webtoon/WebtoonPageHolder.kt | 3 +-- .../eu/kanade/tachiyomi/ui/setting/AboutController.kt | 1 - .../tachiyomi/ui/setting/SettingsAdvancedController.kt | 3 +-- 12 files changed, 7 insertions(+), 21 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/backup/BackupCreatorJob.kt b/app/src/main/java/eu/kanade/tachiyomi/data/backup/BackupCreatorJob.kt index b4c9f1f312..64f66d42e5 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/backup/BackupCreatorJob.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/backup/BackupCreatorJob.kt @@ -1,7 +1,6 @@ package eu.kanade.tachiyomi.data.backup import android.content.Context -import android.net.Uri import androidx.core.net.toUri import androidx.work.ExistingPeriodicWorkPolicy import androidx.work.PeriodicWorkRequestBuilder diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadProvider.kt b/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadProvider.kt index 440fdce817..8821235c37 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadProvider.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadProvider.kt @@ -1,7 +1,6 @@ package eu.kanade.tachiyomi.data.download import android.content.Context -import android.net.Uri import androidx.core.net.toUri import com.hippo.unifile.UniFile import eu.kanade.tachiyomi.R @@ -108,7 +107,6 @@ class DownloadProvider(private val context: Context) { } val afterScanlatorCheck = fileName.substringAfter("_") return@filter chapterNameHashSet.contains(fileName) || chapterNameHashSet.contains(afterScanlatorCheck) - } return@filter false } @@ -164,21 +162,20 @@ class DownloadProvider(private val context: Context) { val chapterNameHashSet = chapters.map { it.name }.toHashSet() val scanalatorNameHashSet = chapters.map { getChapterDirName(it) }.toHashSet() - return mangaDir.listFiles()!!.asList().filter { file -> file.name?.let { fileName -> if (fileName.endsWith(Downloader.TMP_DIR_SUFFIX)) { return@filter true } - //check this first because this is the normal name format + // check this first because this is the normal name format if (scanalatorNameHashSet.contains(fileName)) { return@filter false } val afterScanlatorCheck = fileName.substringAfter("_") - //check both these dont exist because who knows how a chapter name is and it might not trim scanlator correctly + // check both these dont exist because who knows how a chapter name is and it might not trim scanlator correctly return@filter !chapterNameHashSet.contains(fileName) && !chapterNameHashSet.contains(afterScanlatorCheck) } - //everything else is considered true + // everything else is considered true return@filter true } } diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/track/anilist/AnilistApi.kt b/app/src/main/java/eu/kanade/tachiyomi/data/track/anilist/AnilistApi.kt index b167cb85bf..dbdd603764 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/track/anilist/AnilistApi.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/track/anilist/AnilistApi.kt @@ -1,6 +1,5 @@ package eu.kanade.tachiyomi.data.track.anilist -import android.net.Uri import androidx.core.net.toUri import com.github.salomonbrys.kotson.array import com.github.salomonbrys.kotson.get diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/track/bangumi/BangumiApi.kt b/app/src/main/java/eu/kanade/tachiyomi/data/track/bangumi/BangumiApi.kt index 42d6b8a881..9b2ab8e066 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/track/bangumi/BangumiApi.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/track/bangumi/BangumiApi.kt @@ -1,6 +1,5 @@ package eu.kanade.tachiyomi.data.track.bangumi -import android.net.Uri import androidx.core.net.toUri import com.github.salomonbrys.kotson.array import com.github.salomonbrys.kotson.obj diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/track/myanimelist/MyAnimeListApi.kt b/app/src/main/java/eu/kanade/tachiyomi/data/track/myanimelist/MyAnimeListApi.kt index 8626531d86..f6621af6c7 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/track/myanimelist/MyAnimeListApi.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/track/myanimelist/MyAnimeListApi.kt @@ -1,6 +1,5 @@ package eu.kanade.tachiyomi.data.track.myanimelist -import android.net.Uri import androidx.core.net.toUri import eu.kanade.tachiyomi.data.database.models.Track import eu.kanade.tachiyomi.data.track.TrackManager diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/track/shikimori/ShikimoriApi.kt b/app/src/main/java/eu/kanade/tachiyomi/data/track/shikimori/ShikimoriApi.kt index f9addd78b4..7968a1059a 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/track/shikimori/ShikimoriApi.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/track/shikimori/ShikimoriApi.kt @@ -1,6 +1,5 @@ package eu.kanade.tachiyomi.data.track.shikimori -import android.net.Uri import androidx.core.net.toUri import com.github.salomonbrys.kotson.array import com.github.salomonbrys.kotson.jsonObject @@ -103,7 +102,7 @@ class ShikimoriApi(private val client: OkHttpClient, interceptor: ShikimoriInter .appendQueryParameter("target_type", "Manga").build() val request = Request.Builder().url(url.toString()).get().build() - val urlMangas ="$apiUrl/mangas".toUri().buildUpon().appendPath(track.media_id.toString()) + val urlMangas = "$apiUrl/mangas".toUri().buildUpon().appendPath(track.media_id.toString()) .build() val requestMangas = Request.Builder().url(urlMangas.toString()).get().build() diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/main/MainActivity.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/main/MainActivity.kt index e352d42e9d..eebdf09794 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/main/MainActivity.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/main/MainActivity.kt @@ -23,7 +23,6 @@ import androidx.core.content.ContextCompat import androidx.core.graphics.ColorUtils import androidx.core.view.GestureDetectorCompat import androidx.lifecycle.lifecycleScope -import com.afollestad.materialdialogs.MaterialDialog import com.bluelinelabs.conductor.Conductor import com.bluelinelabs.conductor.Controller import com.bluelinelabs.conductor.ControllerChangeHandler diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/track/TrackingBottomSheet.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/track/TrackingBottomSheet.kt index ba4f98ad8c..3628229ee7 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/track/TrackingBottomSheet.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/track/TrackingBottomSheet.kt @@ -1,7 +1,6 @@ package eu.kanade.tachiyomi.ui.manga.track import android.content.Intent -import android.net.Uri import android.os.Bundle import android.view.View import android.view.ViewGroup diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/pager/PagerPageHolder.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/pager/PagerPageHolder.kt index 86e6bbb850..2a8b2a0d33 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/pager/PagerPageHolder.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/pager/PagerPageHolder.kt @@ -7,7 +7,6 @@ import android.graphics.BitmapFactory import android.graphics.Color import android.graphics.PointF import android.graphics.drawable.Drawable -import android.net.Uri import android.view.GestureDetector import android.view.Gravity import android.view.MotionEvent @@ -459,7 +458,7 @@ class PagerPageHolder( } val imageUrl = page.imageUrl - if (imageUrl.orEmpty().startsWith("http", true)) { + if (imageUrl != null && imageUrl.startsWith("http", true)) { PagerButton(context, viewer).apply { layoutParams = LayoutParams(WRAP_CONTENT, WRAP_CONTENT).apply { setMargins(margins, margins, margins, margins) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/webtoon/WebtoonPageHolder.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/webtoon/WebtoonPageHolder.kt index a91b90b20e..25610c6d1e 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/webtoon/WebtoonPageHolder.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/webtoon/WebtoonPageHolder.kt @@ -4,7 +4,6 @@ import android.annotation.SuppressLint import android.content.Intent import android.content.res.Resources import android.graphics.Color -import android.net.Uri import android.view.Gravity import android.view.ViewGroup import android.view.ViewGroup.LayoutParams.MATCH_PARENT @@ -452,7 +451,7 @@ class WebtoonPageHolder( } val imageUrl = page?.imageUrl - if (imageUrl.orEmpty().startsWith("http")) { + if (imageUrl != null && imageUrl.startsWith("http")) { AppCompatButton(context).apply { layoutParams = FrameLayout.LayoutParams(WRAP_CONTENT, WRAP_CONTENT).apply { setMargins(0, margins, 0, margins) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/AboutController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/AboutController.kt index 9575a7c521..bb93f7e12b 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/AboutController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/AboutController.kt @@ -2,7 +2,6 @@ package eu.kanade.tachiyomi.ui.setting import android.app.Dialog import android.content.Intent -import android.net.Uri import android.os.Bundle import androidx.core.net.toUri import androidx.preference.PreferenceScreen diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsAdvancedController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsAdvancedController.kt index 0b5f9b2eb8..289c532338 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsAdvancedController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsAdvancedController.kt @@ -4,7 +4,6 @@ import android.annotation.SuppressLint import android.app.Dialog import android.content.Context import android.content.Intent -import android.net.Uri import android.os.Build import android.os.Bundle import android.os.PowerManager @@ -175,7 +174,7 @@ class SettingsAdvancedController : SettingsController() { for (mangaFolder in mangaFolders) { val manga = sourceManga.find { downloadProvider.getMangaDirName(it) == mangaFolder.name } if (manga == null) { - //download is orphaned and not even in the db delete it if remove non favorited is enabled + // download is orphaned and not even in the db delete it if remove non favorited is enabled if (removeNonFavorite) { foldersCleared += 1 + (mangaFolder.listFiles()?.size ?: 0) mangaFolder.delete()