initialize mMedium asap at fragments

This commit is contained in:
tibbi 2019-05-26 22:01:15 +02:00
parent d8e0e87cb1
commit e9c23d3d7b
2 changed files with 3 additions and 2 deletions

View File

@ -92,6 +92,8 @@ class PhotoFragment : ViewPagerFragment() {
return mView
}
mMedium = arguments!!.getSerializable(MEDIUM) as Medium
mView.apply {
subsampling_view.setOnClickListener { photoClicked() }
gestures_view.setOnClickListener { photoClicked() }
@ -149,7 +151,6 @@ class PhotoFragment : ViewPagerFragment() {
mIsFragmentVisible = true
}
mMedium = arguments!!.getSerializable(MEDIUM) as Medium
if (mMedium.path.startsWith("content://") && !mMedium.path.startsWith("content://mms/")) {
val originalPath = mMedium.path
mMedium.path = context!!.getRealPathFromURI(Uri.parse(originalPath)) ?: mMedium.path

View File

@ -74,6 +74,7 @@ class VideoFragment : ViewPagerFragment(), TextureView.SurfaceTextureListener, S
private lateinit var mSeekBar: SeekBar
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
mMedium = arguments!!.getSerializable(MEDIUM) as Medium
mConfig = context!!.config
mView = inflater.inflate(R.layout.pager_video_item, container, false).apply {
instant_prev_item.setOnClickListener { listener?.goToPrevItem() }
@ -122,7 +123,6 @@ class VideoFragment : ViewPagerFragment(), TextureView.SurfaceTextureListener, S
}
}
mMedium = arguments!!.getSerializable(MEDIUM) as Medium
if (!arguments!!.getBoolean(SHOULD_INIT_FRAGMENT, true)) {
return mView
}