calculate double click scaling factor differently
This commit is contained in:
parent
db9ddac55d
commit
5f4a926faa
|
@ -2,6 +2,7 @@ package com.simplemobiletools.gallery.extensions
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
|
import android.content.res.Configuration
|
||||||
import android.database.Cursor
|
import android.database.Cursor
|
||||||
import android.net.Uri
|
import android.net.Uri
|
||||||
import android.provider.MediaStore
|
import android.provider.MediaStore
|
||||||
|
@ -19,6 +20,8 @@ import com.simplemobiletools.gallery.models.Medium
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
|
||||||
|
val Context.portrait get() = resources.configuration.orientation == Configuration.ORIENTATION_PORTRAIT
|
||||||
|
|
||||||
fun Context.getRealPathFromURI(uri: Uri): String? {
|
fun Context.getRealPathFromURI(uri: Uri): String? {
|
||||||
var cursor: Cursor? = null
|
var cursor: Cursor? = null
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -27,6 +27,7 @@ import com.simplemobiletools.gallery.activities.ViewPagerActivity
|
||||||
import com.simplemobiletools.gallery.extensions.config
|
import com.simplemobiletools.gallery.extensions.config
|
||||||
import com.simplemobiletools.gallery.extensions.getFileSignature
|
import com.simplemobiletools.gallery.extensions.getFileSignature
|
||||||
import com.simplemobiletools.gallery.extensions.getRealPathFromURI
|
import com.simplemobiletools.gallery.extensions.getRealPathFromURI
|
||||||
|
import com.simplemobiletools.gallery.extensions.portrait
|
||||||
import com.simplemobiletools.gallery.helpers.GlideRotateTransformation
|
import com.simplemobiletools.gallery.helpers.GlideRotateTransformation
|
||||||
import com.simplemobiletools.gallery.helpers.MEDIUM
|
import com.simplemobiletools.gallery.helpers.MEDIUM
|
||||||
import com.simplemobiletools.gallery.models.Medium
|
import com.simplemobiletools.gallery.models.Medium
|
||||||
|
@ -238,12 +239,12 @@ class PhotoFragment : ViewPagerFragment() {
|
||||||
val height = bitmapOptions.outHeight
|
val height = bitmapOptions.outHeight
|
||||||
val bitmapAspectRatio = height / (width).toFloat()
|
val bitmapAspectRatio = height / (width).toFloat()
|
||||||
|
|
||||||
return if (Math.abs(displayAspectRatio - bitmapAspectRatio) < RATIO_THRESHOLD) {
|
return if (context.portrait && bitmapAspectRatio <= 1f) {
|
||||||
2f
|
ViewPagerActivity.screenHeight / height.toFloat()
|
||||||
} else if (bitmapAspectRatio > 1f) {
|
} else if (!context.portrait && bitmapAspectRatio >= 1f) {
|
||||||
width / (height).toFloat()
|
ViewPagerActivity.screenWidth / width.toFloat()
|
||||||
} else {
|
} else {
|
||||||
bitmapAspectRatio
|
2f
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue