add an activity null check at toggling fullscreen

This commit is contained in:
tibbi 2017-02-09 20:51:42 +01:00
parent 3a48b5d41f
commit f728ca2650
1 changed files with 4 additions and 1 deletions

View File

@ -159,6 +159,9 @@ class VideoFragment : ViewPagerFragment(), SurfaceHolder.Callback, SeekBar.OnSee
} }
private fun checkFullscreen() { private fun checkFullscreen() {
if (activity == null)
return
var anim = android.R.anim.fade_in var anim = android.R.anim.fade_in
if (mIsFullscreen) { if (mIsFullscreen) {
anim = android.R.anim.fade_out anim = android.R.anim.fade_out
@ -167,7 +170,7 @@ class VideoFragment : ViewPagerFragment(), SurfaceHolder.Callback, SeekBar.OnSee
mSeekBar!!.setOnSeekBarChangeListener(this) mSeekBar!!.setOnSeekBarChangeListener(this)
} }
AnimationUtils.loadAnimation(context, anim).apply { AnimationUtils.loadAnimation(activity, anim).apply {
duration = 150 duration = 150
fillAfter = true fillAfter = true
mTimeHolder!!.startAnimation(this) mTimeHolder!!.startAnimation(this)