small edits at videoplayer setup

This commit is contained in:
tibbi 2017-05-24 22:49:01 +02:00
parent 128f90d50b
commit e1b461e2f1

View file

@ -52,6 +52,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)
setupPlayer()
medium = arguments.getSerializable(MEDIUM) as Medium medium = arguments.getSerializable(MEDIUM) as Medium
if (savedInstanceState != null) { if (savedInstanceState != null) {
@ -59,7 +60,6 @@ class VideoFragment : ViewPagerFragment(), SurfaceHolder.Callback, SeekBar.OnSee
} }
mIsFullscreen = activity.window.decorView.systemUiVisibility and View.SYSTEM_UI_FLAG_FULLSCREEN == View.SYSTEM_UI_FLAG_FULLSCREEN mIsFullscreen = activity.window.decorView.systemUiVisibility and View.SYSTEM_UI_FLAG_FULLSCREEN == View.SYSTEM_UI_FLAG_FULLSCREEN
setupPlayer()
activity.window.decorView.setOnSystemUiVisibilityChangeListener { visibility -> activity.window.decorView.setOnSystemUiVisibilityChangeListener { visibility ->
val fullscreen = visibility and View.SYSTEM_UI_FLAG_FULLSCREEN != 0 val fullscreen = visibility and View.SYSTEM_UI_FLAG_FULLSCREEN != 0
@ -289,7 +289,8 @@ class VideoFragment : ViewPagerFragment(), SurfaceHolder.Callback, SeekBar.OnSee
} }
override fun surfaceChanged(holder: SurfaceHolder, format: Int, width: Int, height: Int) { override fun surfaceChanged(holder: SurfaceHolder, format: Int, width: Int, height: Int) {
setVideoSize() if (width != 0 && height != 0)
setVideoSize()
} }
override fun surfaceDestroyed(holder: SurfaceHolder) { override fun surfaceDestroyed(holder: SurfaceHolder) {