From 65e9557d9fd10b19551c35e6357136b21f822810 Mon Sep 17 00:00:00 2001 From: Pupil Date: Mon, 24 Feb 2020 20:02:44 +0900 Subject: [PATCH] Bug fix --- app/build.gradle | 4 +-- app/release/output.json | 2 +- .../quaver/pupil/adapters/ReaderAdapter.kt | 26 +++---------------- app/src/main/res/layout/item_reader.xml | 3 +++ 4 files changed, 10 insertions(+), 25 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index a9284b02..76e0fa34 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -19,8 +19,8 @@ android { applicationId "xyz.quaver.pupil" minSdkVersion 16 targetSdkVersion 29 - versionCode 43 - versionName "4.7" + versionCode 44 + versionName "4.8" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" multiDexEnabled true vectorDrawables.useSupportLibrary = true diff --git a/app/release/output.json b/app/release/output.json index cc20512c..f445680f 100644 --- a/app/release/output.json +++ b/app/release/output.json @@ -1 +1 @@ -[{"outputType":{"type":"APK"},"apkData":{"type":"MAIN","splits":[],"versionCode":43,"versionName":"4.7","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":44,"versionName":"4.8","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/ReaderAdapter.kt b/app/src/main/java/xyz/quaver/pupil/adapters/ReaderAdapter.kt index c0ec6ce1..d531e55b 100644 --- a/app/src/main/java/xyz/quaver/pupil/adapters/ReaderAdapter.kt +++ b/app/src/main/java/xyz/quaver/pupil/adapters/ReaderAdapter.kt @@ -19,7 +19,6 @@ package xyz.quaver.pupil.adapters import android.content.Context -import android.graphics.BitmapFactory import android.view.LayoutInflater import android.view.View import android.view.ViewGroup @@ -29,7 +28,6 @@ import com.bumptech.glide.Glide import com.bumptech.glide.ListPreloader import com.bumptech.glide.RequestBuilder import com.bumptech.glide.integration.recyclerview.RecyclerViewPreloader -import com.bumptech.glide.load.engine.DiskCacheStrategy import com.crashlytics.android.Crashlytics import io.fabric.sdk.android.Fabric import kotlinx.android.synthetic.main.item_reader.view.* @@ -65,8 +63,7 @@ class ReaderAdapter(private val context: Context, override fun getPreloadRequestBuilder(item: File): RequestBuilder<*>? { return glide .load(item) - .diskCacheStrategy(DiskCacheStrategy.NONE) - .skipMemoryCache(true) + .fitCenter() .error(R.drawable.image_broken_variant) .apply { if (BuildConfig.CENSOR) @@ -113,9 +110,10 @@ class ReaderAdapter(private val context: Context, onItemClickListener?.invoke(position) } - if (!isFullScreen) + if (!isFullScreen) { (holder.view.container.layoutParams as ConstraintLayout.LayoutParams) .dimensionRatio = "${reader!!.galleryInfo.files[position].width}:${reader!!.galleryInfo.files[position].height}" + } holder.view.reader_index.text = (position+1).toString() @@ -124,22 +122,10 @@ class ReaderAdapter(private val context: Context, if (progress?.isInfinite() == true && images != null) { holder.view.reader_item_progressbar.visibility = View.INVISIBLE - holder.view.container.apply { - val options = BitmapFactory.Options().apply { - inJustDecodeBounds = true - } - - BitmapFactory.decodeFile(images.canonicalPath, options) - - maxWidth = options.outWidth - maxHeight = options.outHeight - } glide .load(images) - .diskCacheStrategy(DiskCacheStrategy.NONE) - .skipMemoryCache(true) - .dontTransform() + .fitCenter() .error(R.drawable.image_broken_variant) .apply { if (BuildConfig.CENSOR) @@ -148,10 +134,6 @@ class ReaderAdapter(private val context: Context, .into(holder.view.image) } else { holder.view.reader_item_progressbar.visibility = View.VISIBLE - holder.view.container.apply { - maxWidth = Integer.MAX_VALUE - maxHeight = Integer.MAX_VALUE - } if (progress?.isNaN() == true) { if (Fabric.isInitialized()) diff --git a/app/src/main/res/layout/item_reader.xml b/app/src/main/res/layout/item_reader.xml index 01a50804..f3ba20d6 100644 --- a/app/src/main/res/layout/item_reader.xml +++ b/app/src/main/res/layout/item_reader.xml @@ -27,6 +27,8 @@ android:id="@+id/container" android:layout_width="match_parent" android:layout_height="0dp" + app:layout_constraintHeight_default="wrap" + app:layout_constraintHeight_max="2000dp" app:layout_constraintTop_toTopOf="parent" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintLeft_toLeftOf="parent" @@ -66,6 +68,7 @@ android:contentDescription="@string/reader_imageview_description" android:adjustViewBounds="true" android:scaleType="fitCenter" + android:maxHeight="2000dp" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingBottom="8dp"/>