mirror of
https://github.com/FossifyOrg/Gallery.git
synced 2024-11-26 06:28:00 +01:00
remeasure the screen if the width and height are set to 0 at fullscreen view
This commit is contained in:
parent
2560d9a1c2
commit
686cee83ed
3 changed files with 26 additions and 3 deletions
|
@ -47,7 +47,7 @@ ext {
|
|||
}
|
||||
|
||||
dependencies {
|
||||
implementation 'com.simplemobiletools:commons:4.6.0'
|
||||
implementation 'com.simplemobiletools:commons:4.6.3'
|
||||
implementation 'com.theartofdev.edmodo:android-image-cropper:2.7.0'
|
||||
implementation 'com.android.support:multidex:1.0.3'
|
||||
implementation 'it.sephiroth.android.exif:library:1.0.1'
|
||||
|
|
|
@ -2,6 +2,7 @@ package com.simplemobiletools.gallery.activities
|
|||
|
||||
import android.animation.Animator
|
||||
import android.animation.ValueAnimator
|
||||
import android.annotation.SuppressLint
|
||||
import android.annotation.TargetApi
|
||||
import android.app.Activity
|
||||
import android.content.Intent
|
||||
|
@ -965,9 +966,10 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
|
|||
initBottomActionsLayout()
|
||||
}
|
||||
|
||||
@SuppressLint("NewApi")
|
||||
private fun measureScreen() {
|
||||
val metrics = DisplayMetrics()
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
|
||||
if (isJellyBean1Plus()) {
|
||||
windowManager.defaultDisplay.getRealMetrics(metrics)
|
||||
screenWidth = metrics.widthPixels
|
||||
screenHeight = metrics.heightPixels
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package com.simplemobiletools.gallery.fragments
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.Intent
|
||||
import android.content.res.Configuration
|
||||
import android.graphics.Bitmap
|
||||
|
@ -11,6 +12,7 @@ import android.media.ExifInterface.*
|
|||
import android.net.Uri
|
||||
import android.os.Bundle
|
||||
import android.os.Handler
|
||||
import android.util.DisplayMetrics
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
|
@ -19,6 +21,7 @@ import com.davemorrissey.labs.subscaleview.ImageSource
|
|||
import com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView
|
||||
import com.simplemobiletools.commons.extensions.*
|
||||
import com.simplemobiletools.commons.helpers.OTG_PATH
|
||||
import com.simplemobiletools.commons.helpers.isJellyBean1Plus
|
||||
import com.simplemobiletools.commons.helpers.isLollipopPlus
|
||||
import com.simplemobiletools.gallery.R
|
||||
import com.simplemobiletools.gallery.activities.PanoramaActivity
|
||||
|
@ -39,7 +42,7 @@ import java.io.FileOutputStream
|
|||
|
||||
class PhotoFragment : ViewPagerFragment() {
|
||||
private val DEFAULT_DOUBLE_TAP_ZOOM = 2f
|
||||
private val ZOOMABLE_VIEW_LOAD_DELAY = 500L
|
||||
private val ZOOMABLE_VIEW_LOAD_DELAY = 300L
|
||||
|
||||
private var isFragmentVisible = false
|
||||
private var isFullscreen = false
|
||||
|
@ -78,6 +81,10 @@ class PhotoFragment : ViewPagerFragment() {
|
|||
}
|
||||
}
|
||||
|
||||
if (ViewPagerActivity.screenWidth == 0 || ViewPagerActivity.screenHeight == 0) {
|
||||
measureScreen()
|
||||
}
|
||||
|
||||
storeStateVariables()
|
||||
if (!isFragmentVisible && activity is PhotoActivity) {
|
||||
isFragmentVisible = true
|
||||
|
@ -167,6 +174,20 @@ class PhotoFragment : ViewPagerFragment() {
|
|||
}
|
||||
}
|
||||
|
||||
@SuppressLint("NewApi")
|
||||
private fun measureScreen() {
|
||||
val metrics = DisplayMetrics()
|
||||
if (isJellyBean1Plus()) {
|
||||
activity!!.windowManager.defaultDisplay.getRealMetrics(metrics)
|
||||
ViewPagerActivity.screenWidth = metrics.widthPixels
|
||||
ViewPagerActivity.screenHeight = metrics.heightPixels
|
||||
} else {
|
||||
activity!!.windowManager.defaultDisplay.getMetrics(metrics)
|
||||
ViewPagerActivity.screenWidth = metrics.widthPixels
|
||||
ViewPagerActivity.screenHeight = metrics.heightPixels
|
||||
}
|
||||
}
|
||||
|
||||
private fun gifFragmentVisibilityChanged(isVisible: Boolean) {
|
||||
if (isVisible) {
|
||||
gifDrawable?.start()
|
||||
|
|
Loading…
Reference in a new issue