diff --git a/app/build.gradle b/app/build.gradle index 5982ea7dd..7ed0f1d2d 100755 --- a/app/build.gradle +++ b/app/build.gradle @@ -65,14 +65,16 @@ android { } releaseTest { applicationIdSuffix ".rt" - //minifyEnabled true +// minifyEnabled true +// shrinkResources true zipAlignEnabled true -// proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' + proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } release { - //minifyEnabled true +// minifyEnabled true +// shrinkResources true zipAlignEnabled true -// proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' + proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } @@ -145,14 +147,14 @@ dependencies { implementation 'io.reactivex:rxjava:1.3.8' implementation 'com.jakewharton.rxrelay:rxrelay:1.2.0' implementation 'com.f2prateek.rx.preferences:rx-preferences:1.0.2' - implementation 'com.github.pwittchen:reactivenetwork:0.7.0' + implementation 'com.github.pwittchen:reactivenetwork:0.12.4' // Network client - implementation "com.squareup.okhttp3:okhttp:3.12.2" // DO NOT UPGRADE TO 3.13.X+, it requires minSdk 21 - implementation 'com.squareup.okio:okio:1.17.2' + implementation "com.squareup.okhttp3:okhttp:3.12.3" // DO NOT UPGRADE TO 3.13.X+, it requires minSdk 21 + implementation 'com.squareup.okio:okio:1.17.4' // TODO I think we can do 2.x, okhttp is ok with it but is there any other deps that need 1.x? // REST - final retrofit_version = '2.3.0' + final retrofit_version = '2.6.1' implementation "com.squareup.retrofit2:retrofit:$retrofit_version" implementation "com.squareup.retrofit2:converter-gson:$retrofit_version" implementation "com.squareup.retrofit2:adapter-rxjava:$retrofit_version" @@ -162,7 +164,7 @@ dependencies { implementation 'com.github.salomonbrys.kotson:kotson:2.5.0' // JavaScript engine - implementation 'com.squareup.duktape:duktape-android:1.3.0' + implementation 'com.squareup.duktape:duktape-android:1.2.0' // Stuck on 1.2.0 to fix MangaPlus extension // Disk implementation 'com.jakewharton:disklrucache:2.0.2' @@ -189,7 +191,7 @@ dependencies { implementation 'io.requery:sqlite-android:3.25.2' // Model View Presenter - final nucleus_version = '3.0.0' + final nucleus_version = '3.0.1' implementation "info.android15.nucleus:nucleus:$nucleus_version" implementation "info.android15.nucleus:nucleus-support-v7:$nucleus_version" @@ -208,9 +210,6 @@ dependencies { // Logging implementation 'com.jakewharton.timber:timber:4.7.1' - // Crash reports - implementation 'ch.acra:acra:4.9.2' - // Sort implementation 'com.github.gpanther:java-nat-sort:natural-comparator-1.1' @@ -256,7 +255,7 @@ dependencies { implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version" - final coroutines_version = '1.3.0-RC' + final coroutines_version = '1.3.0-RC2' implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines_version" implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutines_version" implementation "org.jetbrains.kotlinx:kotlinx-coroutines-reactive:$coroutines_version" @@ -277,7 +276,6 @@ dependencies { // RxJava 2 interop for Realm (EH) implementation 'com.lvla.android:rxjava2-interop-kt:0.2.1' - implementation 'com.github.akarnokd:rxjava2-interop:0.13.7' // Debug network interceptor (EH) implementation "com.squareup.okhttp3:logging-interceptor:3.12.1" diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro old mode 100755 new mode 100644 index 0d547fffd..1d7106f03 --- a/app/proguard-rules.pro +++ b/app/proguard-rules.pro @@ -1,35 +1,31 @@ --dontobfuscate +#-repackageclasses '' +# == Make debugging easier +-renamesourcefileattribute SourceFile +-keepattributes SourceFile,LineNumberTable + +# === Keep app classes -dontwarn eu.kanade.tachiyomi.** -keep class eu.kanade.tachiyomi.** { *; } --keep class com.hippo.image.** { *; } --keep interface com.hippo.image.** { *; } --dontwarn nucleus.view.NucleusActionBarActivity - -# Extensions may require methods unused in the core app +# === Keep extension classes -keep class org.jsoup.** { *; } -keep class kotlin.** { *; } -keep class okhttp3.** { *; } -keep class com.google.gson.** { *; } -keep class com.github.salomonbrys.kotson.** { *; } +-keep class com.squareup.duktape.** { *; } +-keep class android.support.v7.preference.** { *; } +-keep class uy.kohesive.injekt.** { *; } -# OkHttp --dontwarn okhttp3.** --dontwarn okio.** --dontwarn javax.annotation.** --dontwarn retrofit2.Platform$Java8 +# === Keep EH classes +-keep class exh.** { *; } +-keep class xyz.nulldev.** { *; } -# 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 *; -} +# === Keep RxAndroid, https://github.com/ReactiveX/RxAndroid/issues/350 +-keep class rx.android.** { *; } -# RxJava 1.1.0 +# === RxJava 1.3.8 -dontwarn sun.misc.** -keepclassmembers class rx.internal.util.unsafe.*ArrayQueue*Field* { @@ -45,37 +41,41 @@ rx.internal.util.atomic.LinkedQueueNode consumerNode; } -### Support v7, Design -# http://stackoverflow.com/questions/29679177/cardview-shadow-not-appearing-in-lollipop-after-obfuscate-with-proguard/29698051 --keep class android.support.v7.widget.RoundRectDrawable { *; } +-dontnote rx.internal.util.PlatformDependent --keep public class android.support.v7.widget.** { *; } --keep public class android.support.v7.internal.widget.** { *; } --keep public class android.support.v7.internal.view.menu.** { *; } --keep public class android.support.v7.graphics.drawable.** { *; } +# === Reactive network: https://github.com/pwittchen/ReactiveNetwork/tree/v0.12.4#proguard-configuration +-dontwarn com.github.pwittchen.reactivenetwork.library.rx2.ReactiveNetwork +-dontwarn io.reactivex.functions.Function +-dontwarn rx.internal.util.** +-dontwarn sun.misc.Unsafe --keep public class * extends android.support.v4.view.ActionProvider { - public (android.content.Context); -} +# === Okhttp: https://github.com/square/okhttp/blob/3637fc56f70f87da696847defd311dbfb28e87b5/okhttp/src/main/resources/META-INF/proguard/okhttp3.pro +# JSR 305 annotations are for embedding nullability information. +-dontwarn javax.annotation.** +# A resource is loaded with a relative path so the package of this class must be preserved. +-keepnames class okhttp3.internal.publicsuffix.PublicSuffixDatabase +# Animal Sniffer compileOnly dependency to ensure APIs are compatible with older versions of Java. +-dontwarn org.codehaus.mojo.animal_sniffer.* +# OkHttp platform used only on JVM and when Conscrypt dependency is available. +-dontwarn okhttp3.internal.platform.ConscryptPlatform --dontwarn android.support.** --dontwarn android.support.design.** --keep class android.support.design.** { *; } --keep interface android.support.design.** { *; } --keep public class android.support.design.R$* { *; } - - -# ReactiveNetwork --dontwarn com.github.pwittchen.reactivenetwork.** - -## GSON ## +# === Okio: https://github.com/square/okio/tree/9b8545e7fa267c9d89753283990f24a35cd69cd6#proguard +-dontwarn okio.** +# === GSON: https://raw.githubusercontent.com/google/gson/master/examples/android-proguard-example/proguard.cfg # Gson uses generic type information stored in a class file when working with fields. Proguard # removes such information by default, so configure it to keep all of it. -keepattributes Signature +# For using GSON @Expose annotation +-keepattributes *Annotation* + # Gson specific classes --keep class sun.misc.Unsafe { *; } +-dontwarn sun.misc.** +#-keep class com.google.gson.stream.** { *; } + +# Application classes that will be serialized/deserialized over Gson +-keep class com.google.gson.examples.android.model.** { ; } # Prevent proguard from stripping interface information from TypeAdapterFactory, # JsonSerializer, JsonDeserializer instances (so they can be used in @JsonAdapter) @@ -83,55 +83,150 @@ -keep class * implements com.google.gson.JsonSerializer -keep class * implements com.google.gson.JsonDeserializer -# SnakeYaml --keep class org.yaml.snakeyaml.** { public protected private *; } --dontwarn org.yaml.snakeyaml.** +# Prevent R8 from leaving Data object members always null +-keepclassmembers,allowobfuscation class * { + @com.google.gson.annotations.SerializedName ; +} -# Duktape --keep class com.squareup.duktape.** { *; } +# == Nucleus +-keepclassmembers class * extends nucleus.presenter.Presenter { + (); +} -# [EH] --keep class exh.** { *; } --dontwarn com.fasterxml.jackson.databind.ext.DOMSerializer --dontwarn com.fasterxml.jackson.databind.ext.Java7SupportImpl --dontwarn com.fasterxml.jackson.module.kotlin.KotlinNamesAnnotationIntrospector$hasCreatorAnnotation$1 --dontwarn com.fasterxml.jackson.module.kotlin.KotlinValueInstantiator --dontwarn exh.metadata.MetadataUtilKt$joinTagsToGenreString$2 --keep class xyz.nulldev.** { *; } +# TODO Changeloglib? Does it need proguard? -## Attempt to fix: java.lang.NoClassDefFoundError: uy.kohesive.injekt.registry.default.DefaultRegistrar$NOKEY$1 +# === Injekt +## From original config: "Attempt to fix: java.lang.NoClassDefFoundError: uy.kohesive.injekt.registry.default.DefaultRegistrar$NOKEY$1" -keep class uy.kohesive.injekt.** { *; } -# Realm --dontnote rx.internal.util.PlatformDependent --keep public class * extends io.realm.RealmObject --keep public class * implements io.realm.RealmModel --keep class io.realm.annotations.RealmModule --keep @io.realm.annotations.RealmModule class * --keep class io.realm.internal.Keep --keep @io.realm.internal.Keep class * --dontwarn io.realm.** -# Keep google stuff --dontwarn com.google.android.gms.** --dontwarn com.google.firebase.** - -# Jackson -# Proguard configuration for Jackson 2.x --keep class com.fasterxml.jackson.databind.ObjectMapper { - public ; - protected ; -} --keep class com.fasterxml.jackson.databind.ObjectWriter { - public ** writeValueAsString(**); -} --keepnames class com.fasterxml.jackson.** { *; } --dontwarn com.fasterxml.jackson.databind.** -# Proguard configuration for Jackson 2.x --dontwarn com.fasterxml.jackson.databind.** --keepclassmembers class * { - @com.fasterxml.jackson.annotation.* *; +# === Glide +-keep public class * implements com.bumptech.glide.module.GlideModule +-keep public class * extends com.bumptech.glide.module.AppGlideModule +-keep public enum com.bumptech.glide.load.ImageHeaderParser$** { + **[] $VALUES; + public *; } -# Better Proguard + sugarify compatibility --keepattributes EnclosingMethod \ No newline at end of file +-dontwarn com.bumptech.glide.load.resource.bitmap.VideoDecoder + +# === Glide-transformations: https://github.com/wasabeef/glide-transformations/blob/3aa8e53c6a51b8351d312f802ba1354c5b115168/transformations/proguard-rules.txt +-dontwarn jp.co.cyberagent.android.gpuimage.** + +# === Conductor +# This isn't in the consumer proguard rules yet: https://github.com/bluelinelabs/Conductor/pull/550/files +-keepclassmembers public class * extends com.bluelinelabs.conductor.ControllerChangeHandler { + public (); +} + +# === RxBinding +-dontwarn com.google.auto.value.AutoValue + +# === Crashlytics +-keepattributes *Annotation* +-keepattributes SourceFile,LineNumberTable +-keep class com.crashlytics.** { *; } +-dontwarn com.crashlytics.** + +# === Humanize + Guava: https://github.com/google/guava/wiki/UsingProGuardWithGuava +-dontwarn javax.lang.model.element.Modifier + +# Note: We intentionally don't add the flags we'd need to make Enums work. +# That's because the Proguard configuration required to make it work on +# optimized code would preclude lots of optimization, like converting enums +# into ints. + +# Throwables uses internal APIs for lazy stack trace resolution +-dontnote sun.misc.SharedSecrets +-keep class sun.misc.SharedSecrets { + *** getJavaLangAccess(...); +} +-dontnote sun.misc.JavaLangAccess +-keep class sun.misc.JavaLangAccess { + *** getStackTraceElement(...); + *** getStackTraceDepth(...); +} + +# FinalizableReferenceQueue calls this reflectively +# Proguard is intelligent enough to spot the use of reflection onto this, so we +# only need to keep the names, and allow it to be stripped out if +# FinalizableReferenceQueue is unused. +-keepnames class com.google.common.base.internal.Finalizer { + *** startFinalizer(...); +} +# However, it cannot "spot" that this method needs to be kept IF the class is. +-keepclassmembers class com.google.common.base.internal.Finalizer { + *** startFinalizer(...); +} +-keepnames class com.google.common.base.FinalizableReference { + void finalizeReferent(); +} +-keepclassmembers class com.google.common.base.FinalizableReference { + void finalizeReferent(); +} + +# Striped64, LittleEndianByteArray, UnsignedBytes, AbstractFuture +-dontwarn sun.misc.Unsafe + +# Striped64 appears to make some assumptions about object layout that +# really might not be safe. This should be investigated. +-keepclassmembers class com.google.common.cache.Striped64 { + *** base; + *** busy; +} +-keepclassmembers class com.google.common.cache.Striped64$Cell { + ; +} + +-dontwarn java.lang.SafeVarargs + +-keep class java.lang.Throwable { + *** addSuppressed(...); +} + +# Futures.getChecked, in both of its variants, is incompatible with proguard. + +# Used by AtomicReferenceFieldUpdater and sun.misc.Unsafe +-keepclassmembers class com.google.common.util.concurrent.AbstractFuture** { + *** waiters; + *** value; + *** listeners; + *** thread; + *** next; +} +-keepclassmembers class com.google.common.util.concurrent.AtomicDouble { + *** value; +} +-keepclassmembers class com.google.common.util.concurrent.AggregateFutureState { + *** remaining; + *** seenExceptions; +} + +# Since Unsafe is using the field offsets of these inner classes, we don't want +# to have class merging or similar tricks applied to these classes and their +# fields. It's safe to allow obfuscation, since the by-name references are +# already preserved in the -keep statement above. +-keep,allowshrinking,allowobfuscation class com.google.common.util.concurrent.AbstractFuture** { + ; +} + +# Futures.getChecked (which often won't work with Proguard anyway) uses this. It +# has a fallback, but again, don't use Futures.getChecked on Android regardless. +-dontwarn java.lang.ClassValue + +# MoreExecutors references AppEngine +-dontnote com.google.appengine.api.ThreadManager +-keep class com.google.appengine.api.ThreadManager { + static *** currentRequestThreadFactory(...); +} +-dontnote com.google.apphosting.api.ApiProxy +-keep class com.google.apphosting.api.ApiProxy { + static *** getCurrentEnvironment (...); +} + +# === Support library +# From original config: http://stackoverflow.com/questions/29679177/cardview-shadow-not-appearing-in-lollipop-after-obfuscate-with-proguard/29698051 +-keep class android.support.v7.widget.RoundRectDrawable { *; } + +# Fix missing back button: https://stackoverflow.com/a/46207775/5054192 +-keep class android.support.v7.graphics.** { *; } diff --git a/app/src/main/java/eu/kanade/tachiyomi/App.kt b/app/src/main/java/eu/kanade/tachiyomi/App.kt index 2a252806b..bf2e42938 100755 --- a/app/src/main/java/eu/kanade/tachiyomi/App.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/App.kt @@ -188,12 +188,17 @@ open class App : Application() { // EXH private fun setupDebugOverlay() { - DebugOverlay.Builder(this) - .modules(FpsModule(), EHDebugModeOverlay(this)) - .bgColor(Color.parseColor("#7F000000")) - .notification(false) - .allowSystemLayer(false) - .build() - .install() + try { + DebugOverlay.Builder(this) + .modules(FpsModule(), EHDebugModeOverlay(this)) + .bgColor(Color.parseColor("#7F000000")) + .notification(false) + .allowSystemLayer(false) + .build() + .install() + } catch(e: IllegalStateException) { + // Crashes if app is in background + XLog.e("Failed to initialize debug overlay, app in background?", e) + } } } diff --git a/app/src/main/res/layout/main_activity.xml b/app/src/main/res/layout/main_activity.xml index cbc9d2a6f..aa0111d92 100755 --- a/app/src/main/res/layout/main_activity.xml +++ b/app/src/main/res/layout/main_activity.xml @@ -32,7 +32,6 @@ android:layout_height="wrap_content" android:theme="@style/Theme.ActionBar.Tab" app:tabIndicatorColor="@android:color/white" - app:tabGravity="center" app:tabMode="scrollable" app:tabMinWidth="75dp"/> diff --git a/build.gradle b/build.gradle index 14b45beac..9cedac989 100755 --- a/build.gradle +++ b/build.gradle @@ -16,7 +16,7 @@ buildscript { // in the individual module build.gradle files // Realm (EH) - classpath "io.realm:realm-gradle-plugin:5.10.0" + classpath "io.realm:realm-gradle-plugin:5.13.1" // Firebase (EH) classpath 'io.fabric.tools:gradle:1.31.0'