From 967df6f7a3ee7cdd618027801acf7ccb4fbda6a1 Mon Sep 17 00:00:00 2001 From: arkon Date: Mon, 17 Aug 2020 15:24:11 -0400 Subject: [PATCH 01/14] Update to Kotlin 1.4 --- app/build.gradle | 2 -- buildSrc/src/main/kotlin/Dependencies.kt | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 4f5df7db6f..39fdcf873a 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -273,8 +273,6 @@ dependencies { testImplementation "org.robolectric:shadows-multidex:$robolectric_version" testImplementation "org.robolectric:shadows-play-services:$robolectric_version" - implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$BuildPluginsVersion.KOTLIN" - final coroutines_version = '1.3.8' implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines_version" implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutines_version" diff --git a/buildSrc/src/main/kotlin/Dependencies.kt b/buildSrc/src/main/kotlin/Dependencies.kt index 1602df39a6..6b9c1f9210 100644 --- a/buildSrc/src/main/kotlin/Dependencies.kt +++ b/buildSrc/src/main/kotlin/Dependencies.kt @@ -4,7 +4,7 @@ object Versions { object BuildPluginsVersion { const val AGP = "4.0.1" - const val KOTLIN = "1.3.72" + const val KOTLIN = "1.4.0" const val KTLINT = "9.2.1" const val VERSIONS_PLUGIN = "0.28.0" } From 3aafc671f83d0c8bdc44afc3d69e9bb0d91adb7c Mon Sep 17 00:00:00 2001 From: arkon Date: Mon, 17 Aug 2020 15:36:04 -0400 Subject: [PATCH 02/14] Dependency updates --- app/build.gradle | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 39fdcf873a..fe24e686f2 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -154,7 +154,7 @@ dependencies { // UI library implementation 'com.google.android.material:material:1.3.0-alpha02' - standardImplementation 'com.google.firebase:firebase-core:17.4.4' + standardImplementation 'com.google.firebase:firebase-core:17.5.0' // ReactiveX implementation 'io.reactivex:rxandroid:1.2.1' @@ -200,7 +200,7 @@ dependencies { implementation 'io.requery:sqlite-android:3.32.2' // Preferences - implementation 'com.github.tfcporciuncula:flow-preferences:1.3.0' + implementation 'com.github.tfcporciuncula:flow-preferences:1.3.1' // Model View Presenter final nucleus_version = '3.0.0' @@ -273,7 +273,7 @@ dependencies { testImplementation "org.robolectric:shadows-multidex:$robolectric_version" testImplementation "org.robolectric:shadows-play-services:$robolectric_version" - final coroutines_version = '1.3.8' + final coroutines_version = '1.3.9' implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines_version" implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutines_version" From 4ef25c75b763811439bbd9a5512a22a14c864194 Mon Sep 17 00:00:00 2001 From: arkon Date: Tue, 18 Aug 2020 17:40:17 -0400 Subject: [PATCH 03/14] Use core-ktx for bolding chapter transition text --- .../viewer/pager/PagerTransitionHolder.kt | 18 +++++------------- .../viewer/webtoon/WebtoonTransitionHolder.kt | 18 +++++------------- 2 files changed, 10 insertions(+), 26 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/pager/PagerTransitionHolder.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/pager/PagerTransitionHolder.kt index ed93fa3d17..f116b2600f 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/pager/PagerTransitionHolder.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/pager/PagerTransitionHolder.kt @@ -1,9 +1,6 @@ package eu.kanade.tachiyomi.ui.reader.viewer.pager import android.annotation.SuppressLint -import android.graphics.Typeface -import android.text.Spanned -import android.text.style.StyleSpan import android.view.Gravity import android.view.View import android.view.ViewGroup @@ -13,6 +10,7 @@ import android.widget.LinearLayout import android.widget.ProgressBar import android.widget.TextView import androidx.appcompat.widget.AppCompatTextView +import androidx.core.text.bold import androidx.core.text.buildSpannedString import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.ui.reader.model.ChapterTransition @@ -91,12 +89,9 @@ class PagerTransitionHolder( textView.text = if (nextChapter != null) { buildSpannedString { - append(context.getString(R.string.transition_finished)) - setSpan(StyleSpan(Typeface.BOLD), 0, length, Spanned.SPAN_INCLUSIVE_EXCLUSIVE) + bold { append(context.getString(R.string.transition_finished)) } append("\n${transition.from.chapter.name}\n\n") - val currSize = length - append(context.getString(R.string.transition_next)) - setSpan(StyleSpan(Typeface.BOLD), currSize, length, Spanned.SPAN_INCLUSIVE_EXCLUSIVE) + bold { append(context.getString(R.string.transition_next)) } append("\n${nextChapter.chapter.name}\n\n") } } else { @@ -116,12 +111,9 @@ class PagerTransitionHolder( textView.text = if (prevChapter != null) { buildSpannedString { - append(context.getString(R.string.transition_current)) - setSpan(StyleSpan(Typeface.BOLD), 0, length, Spanned.SPAN_INCLUSIVE_EXCLUSIVE) + bold { append(context.getString(R.string.transition_current)) } append("\n${transition.from.chapter.name}\n\n") - val currSize = length - append(context.getString(R.string.transition_previous)) - setSpan(StyleSpan(Typeface.BOLD), currSize, length, Spanned.SPAN_INCLUSIVE_EXCLUSIVE) + bold { append(context.getString(R.string.transition_previous)) } append("\n${prevChapter.chapter.name}\n\n") } } else { diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/webtoon/WebtoonTransitionHolder.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/webtoon/WebtoonTransitionHolder.kt index b45ed13de1..e220b06805 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/webtoon/WebtoonTransitionHolder.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/webtoon/WebtoonTransitionHolder.kt @@ -1,8 +1,5 @@ package eu.kanade.tachiyomi.ui.reader.viewer.webtoon -import android.graphics.Typeface -import android.text.Spanned -import android.text.style.StyleSpan import android.view.Gravity import android.view.ViewGroup.LayoutParams.MATCH_PARENT import android.view.ViewGroup.LayoutParams.WRAP_CONTENT @@ -11,6 +8,7 @@ import android.widget.ProgressBar import android.widget.TextView import androidx.appcompat.widget.AppCompatButton import androidx.appcompat.widget.AppCompatTextView +import androidx.core.text.bold import androidx.core.text.buildSpannedString import androidx.core.view.isNotEmpty import androidx.core.view.isVisible @@ -94,12 +92,9 @@ class WebtoonTransitionHolder( textView.text = if (nextChapter != null) { buildSpannedString { - append(context.getString(R.string.transition_finished)) - setSpan(StyleSpan(Typeface.BOLD), 0, length, Spanned.SPAN_INCLUSIVE_EXCLUSIVE) + bold { append(context.getString(R.string.transition_finished)) } append("\n${transition.from.chapter.name}\n\n") - val currSize = length - append(context.getString(R.string.transition_next)) - setSpan(StyleSpan(Typeface.BOLD), currSize, length, Spanned.SPAN_INCLUSIVE_EXCLUSIVE) + bold { append(context.getString(R.string.transition_next)) } append("\n${nextChapter.chapter.name}\n\n") } } else { @@ -119,12 +114,9 @@ class WebtoonTransitionHolder( textView.text = if (prevChapter != null) { buildSpannedString { - append(context.getString(R.string.transition_current)) - setSpan(StyleSpan(Typeface.BOLD), 0, length, Spanned.SPAN_INCLUSIVE_EXCLUSIVE) + bold { append(context.getString(R.string.transition_current)) } append("\n${transition.from.chapter.name}\n\n") - val currSize = length - append(context.getString(R.string.transition_previous)) - setSpan(StyleSpan(Typeface.BOLD), currSize, length, Spanned.SPAN_INCLUSIVE_EXCLUSIVE) + bold { append(context.getString(R.string.transition_previous)) } append("\n${prevChapter.chapter.name}\n\n") } } else { From ba6778143162b185cc5d5a0dc5e5c0e4968c6258 Mon Sep 17 00:00:00 2001 From: arkon Date: Tue, 18 Aug 2020 17:40:24 -0400 Subject: [PATCH 04/14] Minor wording edit --- app/src/main/res/values/strings.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 872a4c0b30..3f0e8822f8 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -337,7 +337,7 @@ Update chapter progress after reading Services - One-way sync to update the chapter progress in tracking services. Set up tracking for individual manga entries from their tracking chip. + One-way sync to update the chapter progress in tracking services. Set up tracking for individual manga entries from their tracking button. Check for extension updates From 4c8665c9f015cc87c0280fa9495f0748c5490fba Mon Sep 17 00:00:00 2001 From: arkon Date: Tue, 18 Aug 2020 17:47:07 -0400 Subject: [PATCH 05/14] Don't enqueue bookmarked chapters for deletion (fixes #3691) --- .../data/download/DownloadManager.kt | 22 ++++++++++++------- .../tachiyomi/ui/manga/MangaPresenter.kt | 15 +++++-------- 2 files changed, 19 insertions(+), 18 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadManager.kt b/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadManager.kt index d8a8368ac0..400fe56482 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadManager.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadManager.kt @@ -198,14 +198,10 @@ class DownloadManager(private val context: Context) { * @param manga the manga of the chapters. * @param source the source of the chapters. */ - fun deleteChapters(chapters: List, manga: Manga, source: Source) { - queue.remove(chapters) + fun deleteChapters(chapters: List, manga: Manga, source: Source): List { + val filteredChapters = getChaptersToDelete(chapters) - val filteredChapters = if (!preferences.removeBookmarkedChapters()) { - chapters.filterNot { it.bookmark } - } else { - chapters - } + queue.remove(filteredChapters) val chapterDirs = provider.findChapterDirs(filteredChapters, manga, source) chapterDirs.forEach { it.delete() } @@ -213,6 +209,8 @@ class DownloadManager(private val context: Context) { if (cache.getDownloadCount(manga) == 0) { // Delete manga directory if empty chapterDirs.firstOrNull()?.parentFile?.delete() } + + return filteredChapters } /** @@ -234,7 +232,7 @@ class DownloadManager(private val context: Context) { * @param manga the manga of the chapters. */ fun enqueueDeleteChapters(chapters: List, manga: Manga) { - pendingDeleter.addChapters(chapters, manga) + pendingDeleter.addChapters(getChaptersToDelete(chapters), manga) } /** @@ -273,4 +271,12 @@ class DownloadManager(private val context: Context) { Timber.e("Could not rename downloaded chapter: %s.", oldNames.joinToString()) } } + + private fun getChaptersToDelete(chapters: List): List { + return if (!preferences.removeBookmarkedChapters()) { + chapters.filterNot { it.bookmark } + } else { + chapters + } + } } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaPresenter.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaPresenter.kt index a3ea29a820..95ee65ce35 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaPresenter.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaPresenter.kt @@ -494,16 +494,11 @@ class MangaPresenter( * @param chapters the chapters to delete. */ private fun deleteChaptersInternal(chapters: List) { - val filteredChapters = if (!preferences.removeBookmarkedChapters()) { - chapters.filterNot { it.bookmark } - } else { - chapters - } - - downloadManager.deleteChapters(filteredChapters, manga, source) - filteredChapters.forEach { - it.status = Download.NOT_DOWNLOADED - it.download = null + downloadManager.deleteChapters(chapters, manga, source).forEach { + if (it is ChapterItem) { + it.status = Download.NOT_DOWNLOADED + it.download = null + } } } From 15f49b39b85d2c2bb25e0e95962f006e0a0f2653 Mon Sep 17 00:00:00 2001 From: tatsuya25 <67844862+tatsuya25@users.noreply.github.com> Date: Sat, 22 Aug 2020 17:42:42 +0300 Subject: [PATCH 06/14] Remove Glide Proguard rules (#3702) * update glide rules in progurad * remove glide rules since it is implemented by glide it self (through consumerproguardfiles) --- app/proguard-rules.pro | 9 --------- 1 file changed, 9 deletions(-) diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro index 5b3943f6e4..afe8b6fe4b 100644 --- a/app/proguard-rules.pro +++ b/app/proguard-rules.pro @@ -29,15 +29,6 @@ -dontwarn javax.annotation.** -dontwarn retrofit2.Platform$Java8 -# Glide specific rules # -# https://github.com/bumptech/glide --keep public class * implements com.bumptech.glide.module.GlideModule --keep public class * extends com.bumptech.glide.AppGlideModule --keep public enum com.bumptech.glide.load.resource.bitmap.ImageHeaderParser$** { - **[] $VALUES; - public *; -} - # RxJava 1.1.0 -dontwarn sun.misc.** From 4c31e3fc5ff558038342c6981aa38b3eb8789ec2 Mon Sep 17 00:00:00 2001 From: arkon Date: Thu, 20 Aug 2020 08:46:16 -0400 Subject: [PATCH 07/14] AndroidX dependency updates --- app/build.gradle | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index fe24e686f2..f34a726e7c 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -129,8 +129,8 @@ dependencies { // AndroidX libraries implementation 'androidx.annotation:annotation:1.1.0' - implementation 'androidx.appcompat:appcompat:1.3.0-alpha01' - implementation 'androidx.biometric:biometric:1.0.1' + implementation 'androidx.appcompat:appcompat:1.3.0-alpha02' + implementation 'androidx.biometric:biometric:1.1.0-alpha02' implementation 'androidx.browser:browser:1.2.0' implementation 'androidx.cardview:cardview:1.0.0' implementation 'androidx.constraintlayout:constraintlayout:2.0.0-rc1' @@ -141,13 +141,13 @@ dependencies { implementation 'androidx.recyclerview:recyclerview:1.2.0-alpha05' implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.2.0-alpha01' - final lifecycle_version = '2.3.0-alpha06' + final lifecycle_version = '2.3.0-alpha07' implementation "androidx.lifecycle:lifecycle-common-java8:$lifecycle_version" implementation "androidx.lifecycle:lifecycle-process:$lifecycle_version" implementation "androidx.lifecycle:lifecycle-runtime-ktx:$lifecycle_version" // Job scheduling - final work_version = '2.4.0' + final work_version = '2.5.0-alpha01' implementation "androidx.work:work-runtime:$work_version" implementation "androidx.work:work-runtime-ktx:$work_version" From 02e370c2d8b46de5668f628c62868c0bf7aed6ad Mon Sep 17 00:00:00 2001 From: arkon Date: Sat, 22 Aug 2020 10:44:52 -0400 Subject: [PATCH 08/14] Remove OkHttp Proguard rules https://square.github.io/okhttp/r8_proguard/ --- app/proguard-rules.pro | 6 ------ 1 file changed, 6 deletions(-) diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro index afe8b6fe4b..07ccd102e5 100644 --- a/app/proguard-rules.pro +++ b/app/proguard-rules.pro @@ -23,12 +23,6 @@ (); } -# OkHttp --dontwarn okhttp3.** --dontwarn okio.** --dontwarn javax.annotation.** --dontwarn retrofit2.Platform$Java8 - # RxJava 1.1.0 -dontwarn sun.misc.** From 4929e66eccbd53c35fc62a755015d03179163927 Mon Sep 17 00:00:00 2001 From: arkon Date: Sat, 22 Aug 2020 12:36:29 -0400 Subject: [PATCH 09/14] Update ActionMode styling --- app/build.gradle | 2 +- app/src/main/res/values/styles.xml | 8 ++++++++ app/src/main/res/values/themes.xml | 6 ++++++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/app/build.gradle b/app/build.gradle index f34a726e7c..378d389e25 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -133,7 +133,7 @@ dependencies { implementation 'androidx.biometric:biometric:1.1.0-alpha02' implementation 'androidx.browser:browser:1.2.0' implementation 'androidx.cardview:cardview:1.0.0' - implementation 'androidx.constraintlayout:constraintlayout:2.0.0-rc1' + implementation 'androidx.constraintlayout:constraintlayout:2.0.0' implementation 'androidx.coordinatorlayout:coordinatorlayout:1.1.0' implementation 'androidx.core:core-ktx:1.4.0-alpha01' implementation 'androidx.multidex:multidex:2.0.1' diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml index bb38bd7cac..9a3845cba0 100644 --- a/app/src/main/res/values/styles.xml +++ b/app/src/main/res/values/styles.xml @@ -14,6 +14,14 @@ ?attr/colorOnPrimary + + + + diff --git a/app/src/main/res/values/themes.xml b/app/src/main/res/values/themes.xml index caa83dff5f..738f9211c4 100644 --- a/app/src/main/res/values/themes.xml +++ b/app/src/main/res/values/themes.xml @@ -47,6 +47,9 @@ ?attr/colorPrimary true false + @style/Theme.ActionMode + @style/Theme.ActionMode.CloseButton + @drawable/ic_close_24dp @style/ThemeOverlay.MaterialComponents @style/Theme.Toolbar.Navigation @style/PreferenceThemeOverlay @@ -131,6 +134,9 @@ ?attr/colorPrimary true false + @style/Theme.ActionMode + @style/Theme.ActionMode.CloseButton + @drawable/ic_close_24dp @style/ThemeOverlay.MaterialComponents.Dark.ActionBar @style/ThemeOverlay.MaterialComponents @style/Theme.Toolbar.Navigation From 3f1355c4136843f3d7d85a626370ce1b6fd3f1e0 Mon Sep 17 00:00:00 2001 From: armangido <42208098+armangido@users.noreply.github.com> Date: Sun, 23 Aug 2020 00:37:21 +0800 Subject: [PATCH 10/14] Update WebViewActivity.kt (#3617) This code added is for some extension that blocks tachiyomi, by tricking it that it was sent by a android browser, nothing major changes, --- .../java/eu/kanade/tachiyomi/ui/webview/WebViewActivity.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/webview/WebViewActivity.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/webview/WebViewActivity.kt index 2eaed5bd6d..ea94582d1d 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/webview/WebViewActivity.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/webview/WebViewActivity.kt @@ -100,7 +100,9 @@ class WebViewActivity : BaseActivity() { binding.webview.webViewClient = object : WebViewClientCompat() { override fun shouldOverrideUrlCompat(view: WebView, url: String): Boolean { - view.loadUrl(url) + val android_browser: MutableMap = HashMap() + android_browser["X-Requested-With"] = "com.android.browser" + view.loadUrl(url,android_browser) return true } From 9920ff617b01359538ea0fe21098d247c6dc267d Mon Sep 17 00:00:00 2001 From: arkon Date: Sat, 22 Aug 2020 12:49:00 -0400 Subject: [PATCH 11/14] Clean up X-Requested-With change This only really affects the initial request, subsequent requests may still use the package name. --- .../eu/kanade/tachiyomi/network/CloudflareInterceptor.kt | 3 ++- .../eu/kanade/tachiyomi/ui/webview/WebViewActivity.kt | 9 ++++----- .../java/eu/kanade/tachiyomi/util/system/WebViewUtil.kt | 2 ++ 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/network/CloudflareInterceptor.kt b/app/src/main/java/eu/kanade/tachiyomi/network/CloudflareInterceptor.kt index d517a9e4c8..5b2cccde2c 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/network/CloudflareInterceptor.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/network/CloudflareInterceptor.kt @@ -89,7 +89,8 @@ class CloudflareInterceptor(private val context: Context) : Interceptor { var isWebViewOutdated = false val origRequestUrl = request.url.toString() - val headers = request.headers.toMultimap().mapValues { it.value.getOrNull(0) ?: "" } + val headers = request.headers.toMultimap().mapValues { it.value.getOrNull(0) ?: "" }.toMutableMap() + headers["X-Requested-With"] = WebViewUtil.REQUESTED_WITH handler.post { val webview = WebView(context) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/webview/WebViewActivity.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/webview/WebViewActivity.kt index ea94582d1d..89b7933f9b 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/webview/WebViewActivity.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/webview/WebViewActivity.kt @@ -70,13 +70,14 @@ class WebViewActivity : BaseActivity() { if (bundle == null) { val url = intent.extras!!.getString(URL_KEY) ?: return - var headers = emptyMap() + var headers = mutableMapOf() val source = sourceManager.get(intent.extras!!.getLong(SOURCE_KEY)) as? HttpSource if (source != null) { - headers = source.headers.toMultimap().mapValues { it.value.getOrNull(0) ?: "" } + headers = source.headers.toMultimap().mapValues { it.value.getOrNull(0) ?: "" }.toMutableMap() binding.webview.settings.userAgentString = source.headers["User-Agent"] } + headers["X-Requested-With"] = WebViewUtil.REQUESTED_WITH binding.webview.setDefaultSettings() @@ -100,9 +101,7 @@ class WebViewActivity : BaseActivity() { binding.webview.webViewClient = object : WebViewClientCompat() { override fun shouldOverrideUrlCompat(view: WebView, url: String): Boolean { - val android_browser: MutableMap = HashMap() - android_browser["X-Requested-With"] = "com.android.browser" - view.loadUrl(url,android_browser) + view.loadUrl(url, headers) return true } diff --git a/app/src/main/java/eu/kanade/tachiyomi/util/system/WebViewUtil.kt b/app/src/main/java/eu/kanade/tachiyomi/util/system/WebViewUtil.kt index b92866e463..8527c65394 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/util/system/WebViewUtil.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/util/system/WebViewUtil.kt @@ -11,6 +11,8 @@ object WebViewUtil { Regex(""".*Chrome/(\d+)\..*""") } + const val REQUESTED_WITH = "com.android.browser" + const val MINIMUM_WEBVIEW_VERSION = 80 fun supportsWebView(context: Context): Boolean { From 9ba11a585fcee1277f8c5e0449477a19a346718f Mon Sep 17 00:00:00 2001 From: arkon Date: Sat, 22 Aug 2020 13:03:39 -0400 Subject: [PATCH 12/14] Adopt tab/controller transitions from SY Original author: @jobobby04 --- .../tachiyomi/ui/base/controller/ConductorExtensions.kt | 6 +++--- .../main/java/eu/kanade/tachiyomi/ui/main/MainActivity.kt | 4 ++-- .../java/eu/kanade/tachiyomi/ui/main/ViewHeightAnimator.kt | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/base/controller/ConductorExtensions.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/base/controller/ConductorExtensions.kt index 7efc823b5c..ef42399129 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/base/controller/ConductorExtensions.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/base/controller/ConductorExtensions.kt @@ -28,8 +28,8 @@ fun Controller.requestPermissionsSafe(permissions: Array, requestCode: I } } -fun Controller.withFadeTransaction(duration: Long = 150L): RouterTransaction { +fun Controller.withFadeTransaction(): RouterTransaction { return RouterTransaction.with(this) - .pushChangeHandler(FadeChangeHandler(duration)) - .popChangeHandler(FadeChangeHandler(duration)) + .pushChangeHandler(FadeChangeHandler()) + .popChangeHandler(FadeChangeHandler()) } 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 1ce35ab00d..a5829b6a7c 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 @@ -86,7 +86,7 @@ class MainActivity : BaseActivity() { setSupportActionBar(binding.toolbar) - tabAnimator = ViewHeightAnimator(binding.tabs) + tabAnimator = ViewHeightAnimator(binding.tabs, 0L) bottomNavAnimator = ViewHeightAnimator(binding.bottomNav) // Set behavior of bottom nav @@ -312,7 +312,7 @@ class MainActivity : BaseActivity() { } private fun setRoot(controller: Controller, id: Int) { - router.setRoot(RouterTransaction.with(controller).tag(id.toString())) + router.setRoot(controller.withFadeTransaction().tag(id.toString())) } private fun syncActivityViewWithController(to: Controller?, from: Controller? = null) { diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/main/ViewHeightAnimator.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/main/ViewHeightAnimator.kt index e765878899..ce22a9219f 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/main/ViewHeightAnimator.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/main/ViewHeightAnimator.kt @@ -6,7 +6,7 @@ import android.view.ViewTreeObserver import android.view.animation.DecelerateInterpolator import androidx.annotation.Keep -class ViewHeightAnimator(val view: View) { +class ViewHeightAnimator(val view: View, val duration: Long = 250L) { /** * The default height of the view. It's unknown until the view is layout. @@ -23,7 +23,7 @@ class ViewHeightAnimator(val view: View) { */ private val animation by lazy { ObjectAnimator.ofInt(this, "height", height).apply { - duration = 250L + duration = this@ViewHeightAnimator.duration interpolator = DecelerateInterpolator() } } From fe7c7e72f54dc36b74a2683089a51cb4690aaf46 Mon Sep 17 00:00:00 2001 From: arkon Date: Sat, 22 Aug 2020 17:33:04 -0400 Subject: [PATCH 13/14] Filter out hidden directories for local source (closes #3706) --- app/src/main/java/eu/kanade/tachiyomi/source/LocalSource.kt | 1 + 1 file changed, 1 insertion(+) diff --git a/app/src/main/java/eu/kanade/tachiyomi/source/LocalSource.kt b/app/src/main/java/eu/kanade/tachiyomi/source/LocalSource.kt index 506ef910f1..23d0f00b49 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/source/LocalSource.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/source/LocalSource.kt @@ -80,6 +80,7 @@ class LocalSource(private val context: Context) : CatalogueSource { .mapNotNull { it.listFiles()?.toList() } .flatten() .filter { it.isDirectory } + .filterNot { it.name.startsWith('.') } .filter { if (time == 0L) it.name.contains(query, ignoreCase = true) else it.lastModified() >= time } .distinctBy { it.name } From e90b0aaf8bb14e4b3070e5353cdd3f892d7cca6f Mon Sep 17 00:00:00 2001 From: arkon Date: Sun, 23 Aug 2020 10:42:20 -0400 Subject: [PATCH 14/14] Adopt OneWayFadeChangeHandler from SY From https://github.com/jobobby04/TachiyomiSY/commit/d86f3ffad808f01d4f04f136c63c0e11f135748c --- .../ui/base/controller/ConductorExtensions.kt | 5 +-- .../ui/base/controller/DialogController.kt | 1 - .../controller/OneWayFadeChangeHandler.kt | 43 +++++++++++++++++++ 3 files changed, 45 insertions(+), 4 deletions(-) create mode 100644 app/src/main/java/eu/kanade/tachiyomi/ui/base/controller/OneWayFadeChangeHandler.kt diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/base/controller/ConductorExtensions.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/base/controller/ConductorExtensions.kt index ef42399129..f5c2277ace 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/base/controller/ConductorExtensions.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/base/controller/ConductorExtensions.kt @@ -6,7 +6,6 @@ import androidx.core.content.ContextCompat import com.bluelinelabs.conductor.Controller import com.bluelinelabs.conductor.Router import com.bluelinelabs.conductor.RouterTransaction -import com.bluelinelabs.conductor.changehandler.FadeChangeHandler fun Router.popControllerWithTag(tag: String): Boolean { val controller = getControllerWithTag(tag) @@ -30,6 +29,6 @@ fun Controller.requestPermissionsSafe(permissions: Array, requestCode: I fun Controller.withFadeTransaction(): RouterTransaction { return RouterTransaction.with(this) - .pushChangeHandler(FadeChangeHandler()) - .popChangeHandler(FadeChangeHandler()) + .pushChangeHandler(OneWayFadeChangeHandler()) + .popChangeHandler(OneWayFadeChangeHandler()) } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/base/controller/DialogController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/base/controller/DialogController.kt index 0e487cb03e..321d55c402 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/base/controller/DialogController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/base/controller/DialogController.kt @@ -14,7 +14,6 @@ import com.bluelinelabs.conductor.changehandler.SimpleSwapChangeHandler * A controller that displays a dialog window, floating on top of its activity's window. * This is a wrapper over [Dialog] object like [android.app.DialogFragment]. * - * * Implementations should override this class and implement [.onCreateDialog] to create a custom dialog, such as an [android.app.AlertDialog] */ abstract class DialogController : RestoreViewOnCreateController { diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/base/controller/OneWayFadeChangeHandler.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/base/controller/OneWayFadeChangeHandler.kt new file mode 100644 index 0000000000..b1209e0b4e --- /dev/null +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/base/controller/OneWayFadeChangeHandler.kt @@ -0,0 +1,43 @@ +package eu.kanade.tachiyomi.ui.base.controller + +import android.animation.Animator +import android.animation.AnimatorSet +import android.view.View +import android.view.ViewGroup +import com.bluelinelabs.conductor.ControllerChangeHandler +import com.bluelinelabs.conductor.changehandler.FadeChangeHandler + +/** + * A variation of [FadeChangeHandler] that only fades in. + */ +class OneWayFadeChangeHandler : FadeChangeHandler { + constructor() + constructor(removesFromViewOnPush: Boolean) : super(removesFromViewOnPush) + constructor(duration: Long) : super(duration) + constructor(duration: Long, removesFromViewOnPush: Boolean) : super( + duration, + removesFromViewOnPush + ) + + override fun getAnimator( + container: ViewGroup, + from: View?, + to: View?, + isPush: Boolean, + toAddedToContainer: Boolean + ): Animator { + if (to != null) { + return super.getAnimator(container, from, to, isPush, toAddedToContainer) + } + + if (from != null && (!isPush || removesFromViewOnPush())) { + container.removeView(from) + } + + return AnimatorSet() + } + + override fun copy(): ControllerChangeHandler { + return OneWayFadeChangeHandler(animationDuration, removesFromViewOnPush()) + } +}