check medium resolution at fullscreen media change

This commit is contained in:
tibbi 2017-03-25 12:41:20 +01:00
parent 2815244f58
commit 2540763480
3 changed files with 11 additions and 6 deletions

View file

@ -7,7 +7,4 @@ class PhotoActivity : PhotoVideoActivity() {
PhotoVideoActivity.mIsVideo = false PhotoVideoActivity.mIsVideo = false
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
} }
override fun systemUiVisibilityChanged(visibility: Int) {
}
} }

View file

@ -359,6 +359,7 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
updateActionbarTitle() updateActionbarTitle()
updatePagerItems() updatePagerItems()
invalidateOptionsMenu() invalidateOptionsMenu()
checkOrientation()
} }
mCurrAsyncTask!!.execute() mCurrAsyncTask!!.execute()
} }
@ -384,6 +385,12 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
scanPath(mDirectory) {} scanPath(mDirectory) {}
} }
private fun checkOrientation() {
if (config.autoRotateScreen) {
val res = getCurrentFile().getResolution()
}
}
override fun fragmentClicked() { override fun fragmentClicked() {
mIsFullScreen = !mIsFullScreen mIsFullScreen = !mIsFullScreen
if (mIsFullScreen) { if (mIsFullScreen) {
@ -426,6 +433,7 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
updateActionbarTitle() updateActionbarTitle()
mRotationDegrees = 0f mRotationDegrees = 0f
supportInvalidateOptionsMenu() supportInvalidateOptionsMenu()
checkOrientation()
} }
override fun onPageScrollStateChanged(state: Int) { override fun onPageScrollStateChanged(state: Int) {

View file

@ -41,7 +41,7 @@ class VideoFragment : ViewPagerFragment(), SurfaceHolder.Callback, SeekBar.OnSee
private var mDuration = 0 private var mDuration = 0
lateinit var mView: View lateinit var mView: View
lateinit var mMedium: Medium lateinit var medium: Medium
companion object { companion object {
private val TAG = VideoFragment::class.java.simpleName private val TAG = VideoFragment::class.java.simpleName
@ -51,7 +51,7 @@ class VideoFragment : ViewPagerFragment(), SurfaceHolder.Callback, SeekBar.OnSee
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
mView = inflater.inflate(R.layout.pager_video_item, container, false) mView = inflater.inflate(R.layout.pager_video_item, container, false)
mMedium = arguments.getSerializable(MEDIUM) as Medium medium = arguments.getSerializable(MEDIUM) as Medium
if (savedInstanceState != null) { if (savedInstanceState != null) {
mCurrTime = savedInstanceState.getInt(PROGRESS) mCurrTime = savedInstanceState.getInt(PROGRESS)
} }
@ -209,7 +209,7 @@ class VideoFragment : ViewPagerFragment(), SurfaceHolder.Callback, SeekBar.OnSee
try { try {
mMediaPlayer = MediaPlayer().apply { mMediaPlayer = MediaPlayer().apply {
setDataSource(context, Uri.parse(mMedium.path)) setDataSource(context, Uri.parse(medium.path))
setDisplay(mSurfaceHolder) setDisplay(mSurfaceHolder)
setOnCompletionListener { videoCompleted() } setOnCompletionListener { videoCompleted() }
setOnVideoSizeChangedListener({ mediaPlayer, width, height -> setVideoSize() }) setOnVideoSizeChangedListener({ mediaPlayer, width, height -> setVideoSize() })