make fragment click listener nullable
This commit is contained in:
parent
436107be7e
commit
7854f75f22
3 changed files with 7 additions and 3 deletions
|
@ -66,6 +66,6 @@ class PhotoFragment : ViewPagerFragment(), View.OnClickListener {
|
|||
if (listener == null)
|
||||
listener = activity as ViewPagerFragment.FragmentClickListener
|
||||
|
||||
listener.fragmentClicked()
|
||||
listener?.fragmentClicked()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -161,7 +161,11 @@ class VideoFragment : ViewPagerFragment(), View.OnClickListener, SurfaceHolder.C
|
|||
else -> {
|
||||
mIsFullscreen = !mIsFullscreen
|
||||
checkFullscreen()
|
||||
listener.fragmentClicked()
|
||||
|
||||
if (listener == null)
|
||||
listener = activity as ViewPagerFragment.FragmentClickListener
|
||||
|
||||
listener?.fragmentClicked()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@ package com.simplemobiletools.gallery.fragments
|
|||
import android.support.v4.app.Fragment
|
||||
|
||||
abstract class ViewPagerFragment : Fragment() {
|
||||
lateinit var listener: FragmentClickListener
|
||||
var listener: FragmentClickListener? = null
|
||||
|
||||
abstract fun itemDragged()
|
||||
|
||||
|
|
Loading…
Reference in a new issue