mirror of
				https://github.com/SimpleMobileTools/Simple-Gallery.git
				synced 2025-06-05 21:59:19 +02:00 
			
		
		
		
	make videoFragment timeHolder nullable
This commit is contained in:
		| @@ -34,6 +34,7 @@ class VideoFragment : ViewPagerFragment(), SurfaceHolder.Callback, SeekBar.OnSee | |||||||
|     private var mCurrTimeView: TextView? = null |     private var mCurrTimeView: TextView? = null | ||||||
|     private var mTimerHandler: Handler? = null |     private var mTimerHandler: Handler? = null | ||||||
|     private var mSeekBar: SeekBar? = null |     private var mSeekBar: SeekBar? = null | ||||||
|  |     private var mTimeHolder: View? = null | ||||||
|  |  | ||||||
|     private var mIsPlaying = false |     private var mIsPlaying = false | ||||||
|     private var mIsDragged = false |     private var mIsDragged = false | ||||||
| @@ -60,7 +61,6 @@ class VideoFragment : ViewPagerFragment(), SurfaceHolder.Callback, SeekBar.OnSee | |||||||
|  |  | ||||||
|     lateinit var mView: View |     lateinit var mView: View | ||||||
|     lateinit var medium: Medium |     lateinit var medium: Medium | ||||||
|     lateinit var mTimeHolder: View |  | ||||||
|  |  | ||||||
|     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) | ||||||
| @@ -287,8 +287,8 @@ class VideoFragment : ViewPagerFragment(), SurfaceHolder.Callback, SeekBar.OnSee | |||||||
|     private fun initTimeHolder() { |     private fun initTimeHolder() { | ||||||
|         val res = resources |         val res = resources | ||||||
|         val height = context!!.navigationBarHeight |         val height = context!!.navigationBarHeight | ||||||
|         val left = mTimeHolder.paddingLeft |         val left = mTimeHolder!!.paddingLeft | ||||||
|         val top = mTimeHolder.paddingTop |         val top = mTimeHolder!!.paddingTop | ||||||
|         var right = res.getDimension(R.dimen.timer_padding).toInt() |         var right = res.getDimension(R.dimen.timer_padding).toInt() | ||||||
|         var bottom = 0 |         var bottom = 0 | ||||||
|  |  | ||||||
| @@ -299,7 +299,7 @@ class VideoFragment : ViewPagerFragment(), SurfaceHolder.Callback, SeekBar.OnSee | |||||||
|                 right += height |                 right += height | ||||||
|                 bottom += context!!.navigationBarHeight |                 bottom += context!!.navigationBarHeight | ||||||
|             } |             } | ||||||
|             mTimeHolder.setPadding(left, top, right, bottom) |             mTimeHolder!!.setPadding(left, top, right, bottom) | ||||||
|         } |         } | ||||||
|  |  | ||||||
|         mCurrTimeView = mView.video_curr_time |         mCurrTimeView = mView.video_curr_time | ||||||
| @@ -307,7 +307,7 @@ class VideoFragment : ViewPagerFragment(), SurfaceHolder.Callback, SeekBar.OnSee | |||||||
|         mSeekBar!!.setOnSeekBarChangeListener(this) |         mSeekBar!!.setOnSeekBarChangeListener(this) | ||||||
|  |  | ||||||
|         if (mIsFullscreen) |         if (mIsFullscreen) | ||||||
|             mTimeHolder.beInvisible() |             mTimeHolder!!.beInvisible() | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     private fun hasNavBar(): Boolean { |     private fun hasNavBar(): Boolean { | ||||||
| @@ -375,7 +375,7 @@ class VideoFragment : ViewPagerFragment(), SurfaceHolder.Callback, SeekBar.OnSee | |||||||
|         AnimationUtils.loadAnimation(activity, anim).apply { |         AnimationUtils.loadAnimation(activity, anim).apply { | ||||||
|             duration = 150 |             duration = 150 | ||||||
|             fillAfter = true |             fillAfter = true | ||||||
|             mTimeHolder.startAnimation(this) |             mTimeHolder?.startAnimation(this) | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|  |  | ||||||
| @@ -557,7 +557,7 @@ class VideoFragment : ViewPagerFragment(), SurfaceHolder.Callback, SeekBar.OnSee | |||||||
|                 onGlobalLayout { |                 onGlobalLayout { | ||||||
|                     if (height != 0) { |                     if (height != 0) { | ||||||
|                         val smallMargin = resources.getDimension(R.dimen.small_margin) |                         val smallMargin = resources.getDimension(R.dimen.small_margin) | ||||||
|                         val timeHolderHeight = mTimeHolder.height - context.navigationBarHeight |                         val timeHolderHeight = mTimeHolder!!.height - context.navigationBarHeight | ||||||
|                         y = context.usableScreenSize.y - height - timeHolderHeight - if (context.navigationBarHeight == 0) smallMargin else 0f |                         y = context.usableScreenSize.y - height - timeHolderHeight - if (context.navigationBarHeight == 0) smallMargin else 0f | ||||||
|                     } |                     } | ||||||
|                 } |                 } | ||||||
| @@ -598,7 +598,7 @@ class VideoFragment : ViewPagerFragment(), SurfaceHolder.Callback, SeekBar.OnSee | |||||||
|         mView.video_details.apply { |         mView.video_details.apply { | ||||||
|             if (visibility == View.VISIBLE) { |             if (visibility == View.VISIBLE) { | ||||||
|                 val smallMargin = resources.getDimension(R.dimen.small_margin) |                 val smallMargin = resources.getDimension(R.dimen.small_margin) | ||||||
|                 val timeHolderHeight = mTimeHolder.height - context.navigationBarHeight.toFloat() |                 val timeHolderHeight = mTimeHolder!!.height - context.navigationBarHeight.toFloat() | ||||||
|                 val fullscreenOffset = context.navigationBarHeight.toFloat() - smallMargin |                 val fullscreenOffset = context.navigationBarHeight.toFloat() - smallMargin | ||||||
|                 val newY = context.usableScreenSize.y - height + if (mIsFullscreen) fullscreenOffset else -(timeHolderHeight + if (context.navigationBarHeight == 0) smallMargin else 0f) |                 val newY = context.usableScreenSize.y - height + if (mIsFullscreen) fullscreenOffset else -(timeHolderHeight + if (context.navigationBarHeight == 0) smallMargin else 0f) | ||||||
|                 animate().y(newY) |                 animate().y(newY) | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user