From 25aeba4b99b2b9cfb5dee6a0b84a1ac9ccbd7d94 Mon Sep 17 00:00:00 2001 From: tibbi Date: Mon, 1 Apr 2019 21:55:17 +0200 Subject: [PATCH] updating the way video resolution is fetched --- .../gallery/pro/activities/ViewPagerActivity.kt | 6 +++--- .../gallery/pro/fragments/VideoFragment.kt | 9 +++------ .../gallery/pro/fragments/ViewPagerFragment.kt | 2 +- 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/ViewPagerActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/ViewPagerActivity.kt index 0588987c3..6ba9995da 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/ViewPagerActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/ViewPagerActivity.kt @@ -981,9 +981,9 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View flipSides = orientation == ExifInterface.ORIENTATION_ROTATE_90 || orientation == ExifInterface.ORIENTATION_ROTATE_270 } catch (e: Exception) { } - val res = getCurrentPath().getResolution() ?: return - val width = if (flipSides) res.y else res.x - val height = if (flipSides) res.x else res.y + val resolution = applicationContext.getResolution(getCurrentPath()) ?: return + val width = if (flipSides) resolution.y else resolution.x + val height = if (flipSides) resolution.x else resolution.y if (width > height) { requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE } else if (width < height) { diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/fragments/VideoFragment.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/fragments/VideoFragment.kt index 890654b1d..8bf276b80 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/fragments/VideoFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/fragments/VideoFragment.kt @@ -56,7 +56,7 @@ class VideoFragment : ViewPagerFragment(), TextureView.SurfaceTextureListener, S private var mPositionWhenInit = 0 private var mExoPlayer: SimpleExoPlayer? = null - private var mVideoSize = Point(0, 0) + private var mVideoSize = Point(1, 1) private var mTimerHandler = Handler() private var mStoredShowExtendedDetails = false @@ -138,7 +138,7 @@ class VideoFragment : ViewPagerFragment(), TextureView.SurfaceTextureListener, S initTimeHolder() checkIfPanorama() - mMedium.path.getVideoResolution()?.apply { + activity?.getVideoResolution(mMedium.path)?.apply { mVideoSize.x = x mVideoSize.y = y } @@ -160,10 +160,7 @@ class VideoFragment : ViewPagerFragment(), TextureView.SurfaceTextureListener, S } mWasFragmentInit = true - - if (mVideoSize.x != 0 && mVideoSize.y != 0) { - setVideoSize() - } + setVideoSize() mView.apply { mBrightnessSideScroll.initialize(activity!!, slide_info, true, container) { x, y -> diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/fragments/ViewPagerFragment.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/fragments/ViewPagerFragment.kt index adfe13075..d6df0add0 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/fragments/ViewPagerFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/fragments/ViewPagerFragment.kt @@ -55,7 +55,7 @@ abstract class ViewPagerFragment : Fragment() { } if (detailsFlag and EXT_RESOLUTION != 0) { - file.absolutePath.getResolution()?.formatAsResolution().let { if (it?.isNotEmpty() == true) details.appendln(it) } + context!!.getResolution(file.absolutePath)?.formatAsResolution().let { if (it?.isNotEmpty() == true) details.appendln(it) } } if (detailsFlag and EXT_LAST_MODIFIED != 0) {