From 480d4b1e9a4317f7315cac0bfcbe1e21719a4bfa Mon Sep 17 00:00:00 2001 From: tom5079 Date: Thu, 11 Jul 2019 21:24:25 +0900 Subject: [PATCH] Image loading optimized Adds gallery to history when opened directly by gallery ID Fixed blurred image --- .gitignore | 5 ++- .idea/misc.xml | 2 +- app/build.gradle | 6 +-- app/google-services.json | 40 ------------------- app/release/output.json | 2 +- .../pupil/adapters/GalleryBlockAdapter.kt | 9 +++-- .../quaver/pupil/adapters/ReaderAdapter.kt | 15 ++----- .../java/xyz/quaver/pupil/ui/MainActivity.kt | 7 ++-- .../xyz/quaver/pupil/ui/ReaderActivity.kt | 3 +- .../quaver/pupil/util/GalleryDownloader.kt | 15 ++++--- build.gradle | 2 +- .../test/java/xyz/quaver/hitomi/UnitTest.kt | 2 +- 12 files changed, 33 insertions(+), 75 deletions(-) delete mode 100644 app/google-services.json diff --git a/.gitignore b/.gitignore index 725932c5..9a319865 100644 --- a/.gitignore +++ b/.gitignore @@ -13,4 +13,7 @@ .externalNativeBuild #Github pages -/gh-pages \ No newline at end of file +/gh-pages + +#Private files +/app/google-services.json \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml index 7bfef59d..37a75096 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,6 +1,6 @@ - + diff --git a/app/build.gradle b/app/build.gradle index 6616e614..f9d1a7e6 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -13,8 +13,8 @@ android { applicationId "xyz.quaver.pupil" minSdkVersion 16 targetSdkVersion 29 - versionCode 23 - versionName "3.0.2" + versionCode 25 + versionName "3.1" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" multiDexEnabled true vectorDrawables.useSupportLibrary = true @@ -44,7 +44,7 @@ dependencies { implementation "org.jetbrains.kotlinx:kotlinx-serialization-runtime:0.11.0" implementation 'androidx.appcompat:appcompat:1.0.2' implementation 'androidx.constraintlayout:constraintlayout:1.1.3' - implementation 'androidx.preference:preference:1.1.0-beta01' + implementation 'androidx.preference:preference:1.1.0-rc01' implementation 'androidx.constraintlayout:constraintlayout:1.1.3' implementation 'androidx.lifecycle:lifecycle-extensions:2.0.0' implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.0.0' diff --git a/app/google-services.json b/app/google-services.json deleted file mode 100644 index 63160fa4..00000000 --- a/app/google-services.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "project_info": { - "project_number": "844152206517", - "firebase_url": "https://pupil-88795.firebaseio.com", - "project_id": "pupil-88795", - "storage_bucket": "pupil-88795.appspot.com" - }, - "client": [ - { - "client_info": { - "mobilesdk_app_id": "1:844152206517:android:ed7bdde2b57d6448", - "android_client_info": { - "package_name": "xyz.quaver.pupil" - } - }, - "oauth_client": [ - { - "client_id": "844152206517-5t8c3marg1hio8fotsip4s6qvs9bhrj0.apps.googleusercontent.com", - "client_type": 3 - } - ], - "api_key": [ - { - "current_key": "AIzaSyC47pCfQRw9D6bkdQzMSuCJ0xY52vK7Q8w" - } - ], - "services": { - "appinvite_service": { - "other_platform_oauth_client": [ - { - "client_id": "844152206517-5t8c3marg1hio8fotsip4s6qvs9bhrj0.apps.googleusercontent.com", - "client_type": 3 - } - ] - } - } - } - ], - "configuration_version": "1" -} \ No newline at end of file diff --git a/app/release/output.json b/app/release/output.json index cde30724..16d1dc23 100644 --- a/app/release/output.json +++ b/app/release/output.json @@ -1 +1 @@ -[{"outputType":{"type":"APK"},"apkData":{"type":"MAIN","splits":[],"versionCode":23,"versionName":"3.0.2","enabled":true,"outputFile":"app-release.apk","fullName":"release","baseName":"release"},"path":"app-release.apk","properties":{}}] \ No newline at end of file +[{"outputType":{"type":"APK"},"apkData":{"type":"MAIN","splits":[],"versionCode":25,"versionName":"3.1","enabled":true,"outputFile":"app-release.apk","fullName":"release","baseName":"release"},"path":"app-release.apk","properties":{}}] \ No newline at end of file diff --git a/app/src/main/java/xyz/quaver/pupil/adapters/GalleryBlockAdapter.kt b/app/src/main/java/xyz/quaver/pupil/adapters/GalleryBlockAdapter.kt index 1b29b645..7f515740 100644 --- a/app/src/main/java/xyz/quaver/pupil/adapters/GalleryBlockAdapter.kt +++ b/app/src/main/java/xyz/quaver/pupil/adapters/GalleryBlockAdapter.kt @@ -32,6 +32,7 @@ import androidx.recyclerview.widget.RecyclerView import androidx.vectordrawable.graphics.drawable.Animatable2Compat import androidx.vectordrawable.graphics.drawable.AnimatedVectorDrawableCompat import com.bumptech.glide.Glide +import com.bumptech.glide.RequestManager import com.bumptech.glide.load.engine.DiskCacheStrategy import com.google.android.material.chip.Chip import kotlinx.android.synthetic.main.item_galleryblock.view.* @@ -54,7 +55,7 @@ import kotlin.collections.ArrayList import kotlin.collections.HashMap import kotlin.concurrent.schedule -class GalleryBlockAdapter(private val galleries: List>>) : RecyclerView.Adapter() { +class GalleryBlockAdapter(private val glide: RequestManager, private val galleries: List>>) : RecyclerView.Adapter() { enum class ViewType { NEXT, @@ -65,7 +66,7 @@ class GalleryBlockAdapter(private val galleries: List>) { + fun bind(item: Pair>) { with(view) { val resources = context.resources val languages = resources.getStringArray(R.array.languages).map { @@ -82,7 +83,7 @@ class GalleryBlockAdapter(private val galleries: List) : RecyclerView.Adapter() { +class ReaderAdapter(private val glide: RequestManager, private val images: List) : RecyclerView.Adapter() { var isFullScreen = false @@ -43,18 +42,12 @@ class ReaderAdapter(private val images: List) : RecyclerView.Adapter { - xyz.quaver.hiyobi.getReader(galleryID).let { - when { - it.readerItems.isEmpty() -> { - useHiyobi = false - getReader(galleryID) - } - else -> it - } + try { + xyz.quaver.hiyobi.getReader(galleryID) + } catch(e: Exception) { + useHiyobi = false + getReader(galleryID) } } else -> { @@ -159,6 +157,7 @@ class GalleryDownloader( reader } catch (e: Exception) { + Crashlytics.logException(e) Reader("", listOf()) } } diff --git a/build.gradle b/build.gradle index 548c220f..2a44e56b 100644 --- a/build.gradle +++ b/build.gradle @@ -10,7 +10,7 @@ buildscript { } } dependencies { - classpath 'com.android.tools.build:gradle:3.4.1' + classpath 'com.android.tools.build:gradle:3.4.2' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" classpath "org.jetbrains.kotlin:kotlin-android-extensions:$kotlin_version" classpath "org.jetbrains.kotlin:kotlin-serialization:$kotlin_version" diff --git a/libpupil/src/test/java/xyz/quaver/hitomi/UnitTest.kt b/libpupil/src/test/java/xyz/quaver/hitomi/UnitTest.kt index 851ce929..79091867 100644 --- a/libpupil/src/test/java/xyz/quaver/hitomi/UnitTest.kt +++ b/libpupil/src/test/java/xyz/quaver/hitomi/UnitTest.kt @@ -70,7 +70,7 @@ class UnitTest { @Test fun test_getReader() { - val reader = getReader(1404693) + val reader = getReader(1442740) print(reader) }