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 return mView
} }
mMedium = arguments!!.getSerializable(MEDIUM) as Medium
mView.apply { mView.apply {
subsampling_view.setOnClickListener { photoClicked() } subsampling_view.setOnClickListener { photoClicked() }
gestures_view.setOnClickListener { photoClicked() } gestures_view.setOnClickListener { photoClicked() }
@ -149,7 +151,6 @@ class PhotoFragment : ViewPagerFragment() {
mIsFragmentVisible = true mIsFragmentVisible = true
} }
mMedium = arguments!!.getSerializable(MEDIUM) as Medium
if (mMedium.path.startsWith("content://") && !mMedium.path.startsWith("content://mms/")) { if (mMedium.path.startsWith("content://") && !mMedium.path.startsWith("content://mms/")) {
val originalPath = mMedium.path val originalPath = mMedium.path
mMedium.path = context!!.getRealPathFromURI(Uri.parse(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 private lateinit var mSeekBar: SeekBar
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
mMedium = arguments!!.getSerializable(MEDIUM) as Medium
mConfig = context!!.config mConfig = context!!.config
mView = inflater.inflate(R.layout.pager_video_item, container, false).apply { mView = inflater.inflate(R.layout.pager_video_item, container, false).apply {
instant_prev_item.setOnClickListener { listener?.goToPrevItem() } 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)) { if (!arguments!!.getBoolean(SHOULD_INIT_FRAGMENT, true)) {
return mView return mView
} }