Skip to content

Commit

Permalink
Merge pull request #69 from tom5079/dev
Browse files Browse the repository at this point in the history
Version 4.8
  • Loading branch information
tom5079 authored Feb 24, 2020
2 parents 4f249c0 + 65e9557 commit c9bde3c
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 25 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion app/release/output.json
Original file line number Diff line number Diff line change
@@ -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":{}}]
[{"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":{}}]
26 changes: 4 additions & 22 deletions app/src/main/java/xyz/quaver/pupil/adapters/ReaderAdapter.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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.*
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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()

Expand All @@ -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)
Expand All @@ -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())
Expand Down
3 changes: 3 additions & 0 deletions app/src/main/res/layout/item_reader.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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"/>
Expand Down

0 comments on commit c9bde3c

Please sign in to comment.