updating the way video resolution is fetched

This commit is contained in:
tibbi 2019-04-01 21:55:17 +02:00
parent acbc2e1868
commit 25aeba4b99
3 changed files with 7 additions and 10 deletions

View file

@ -981,9 +981,9 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
flipSides = orientation == ExifInterface.ORIENTATION_ROTATE_90 || orientation == ExifInterface.ORIENTATION_ROTATE_270 flipSides = orientation == ExifInterface.ORIENTATION_ROTATE_90 || orientation == ExifInterface.ORIENTATION_ROTATE_270
} catch (e: Exception) { } catch (e: Exception) {
} }
val res = getCurrentPath().getResolution() ?: return val resolution = applicationContext.getResolution(getCurrentPath()) ?: return
val width = if (flipSides) res.y else res.x val width = if (flipSides) resolution.y else resolution.x
val height = if (flipSides) res.x else res.y val height = if (flipSides) resolution.x else resolution.y
if (width > height) { if (width > height) {
requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE
} else if (width < height) { } else if (width < height) {

View file

@ -56,7 +56,7 @@ class VideoFragment : ViewPagerFragment(), TextureView.SurfaceTextureListener, S
private var mPositionWhenInit = 0 private var mPositionWhenInit = 0
private var mExoPlayer: SimpleExoPlayer? = null private var mExoPlayer: SimpleExoPlayer? = null
private var mVideoSize = Point(0, 0) private var mVideoSize = Point(1, 1)
private var mTimerHandler = Handler() private var mTimerHandler = Handler()
private var mStoredShowExtendedDetails = false private var mStoredShowExtendedDetails = false
@ -138,7 +138,7 @@ class VideoFragment : ViewPagerFragment(), TextureView.SurfaceTextureListener, S
initTimeHolder() initTimeHolder()
checkIfPanorama() checkIfPanorama()
mMedium.path.getVideoResolution()?.apply { activity?.getVideoResolution(mMedium.path)?.apply {
mVideoSize.x = x mVideoSize.x = x
mVideoSize.y = y mVideoSize.y = y
} }
@ -160,10 +160,7 @@ class VideoFragment : ViewPagerFragment(), TextureView.SurfaceTextureListener, S
} }
mWasFragmentInit = true mWasFragmentInit = true
setVideoSize()
if (mVideoSize.x != 0 && mVideoSize.y != 0) {
setVideoSize()
}
mView.apply { mView.apply {
mBrightnessSideScroll.initialize(activity!!, slide_info, true, container) { x, y -> mBrightnessSideScroll.initialize(activity!!, slide_info, true, container) { x, y ->

View file

@ -55,7 +55,7 @@ abstract class ViewPagerFragment : Fragment() {
} }
if (detailsFlag and EXT_RESOLUTION != 0) { 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) { if (detailsFlag and EXT_LAST_MODIFIED != 0) {