minor code cleanup at videofragment
This commit is contained in:
parent
430f251406
commit
012e091349
2 changed files with 1 additions and 8 deletions
|
@ -273,7 +273,6 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
|
||||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR1 || !isDestroyed) {
|
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR1 || !isDestroyed) {
|
||||||
view_pager.apply {
|
view_pager.apply {
|
||||||
adapter = pagerAdapter
|
adapter = pagerAdapter
|
||||||
adapter!!.notifyDataSetChanged()
|
|
||||||
currentItem = mPos
|
currentItem = mPos
|
||||||
addOnPageChangeListener(this@ViewPagerActivity)
|
addOnPageChangeListener(this@ViewPagerActivity)
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,6 @@ import android.os.Bundle
|
||||||
import android.os.Handler
|
import android.os.Handler
|
||||||
import android.provider.Settings
|
import android.provider.Settings
|
||||||
import android.util.DisplayMetrics
|
import android.util.DisplayMetrics
|
||||||
import android.util.Log
|
|
||||||
import android.view.*
|
import android.view.*
|
||||||
import android.view.animation.AnimationUtils
|
import android.view.animation.AnimationUtils
|
||||||
import android.widget.SeekBar
|
import android.widget.SeekBar
|
||||||
|
@ -26,6 +25,7 @@ import java.io.IOException
|
||||||
class VideoFragment : ViewPagerFragment(), SurfaceHolder.Callback, SeekBar.OnSeekBarChangeListener {
|
class VideoFragment : ViewPagerFragment(), SurfaceHolder.Callback, SeekBar.OnSeekBarChangeListener {
|
||||||
private val CLICK_MAX_DURATION = 150
|
private val CLICK_MAX_DURATION = 150
|
||||||
private val SLIDE_INFO_FADE_DELAY = 1000L
|
private val SLIDE_INFO_FADE_DELAY = 1000L
|
||||||
|
private val PROGRESS = "progress"
|
||||||
|
|
||||||
private var mMediaPlayer: MediaPlayer? = null
|
private var mMediaPlayer: MediaPlayer? = null
|
||||||
private var mSurfaceView: SurfaceView? = null
|
private var mSurfaceView: SurfaceView? = null
|
||||||
|
@ -59,11 +59,6 @@ class VideoFragment : ViewPagerFragment(), SurfaceHolder.Callback, SeekBar.OnSee
|
||||||
lateinit var medium: Medium
|
lateinit var medium: Medium
|
||||||
lateinit var mTimeHolder: View
|
lateinit var mTimeHolder: View
|
||||||
|
|
||||||
companion object {
|
|
||||||
private val TAG = VideoFragment::class.java.simpleName
|
|
||||||
private val PROGRESS = "progress"
|
|
||||||
}
|
|
||||||
|
|
||||||
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)
|
||||||
mTimeHolder = mView.video_time_holder
|
mTimeHolder = mView.video_time_holder
|
||||||
|
@ -397,7 +392,6 @@ class VideoFragment : ViewPagerFragment(), SurfaceHolder.Callback, SeekBar.OnSee
|
||||||
prepareAsync()
|
prepareAsync()
|
||||||
}
|
}
|
||||||
} catch (e: IOException) {
|
} catch (e: IOException) {
|
||||||
Log.e(TAG, "init media player failed $e")
|
|
||||||
releaseMediaPlayer()
|
releaseMediaPlayer()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue