AddTunnelsSheet: Make behaviour nullable
Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
This commit is contained in:
parent
b3bb7c694b
commit
183273dcf5
@ -23,7 +23,7 @@ import com.wireguard.android.util.resolveAttribute
|
|||||||
|
|
||||||
class AddTunnelsSheet : BottomSheetDialogFragment() {
|
class AddTunnelsSheet : BottomSheetDialogFragment() {
|
||||||
|
|
||||||
private lateinit var behavior: BottomSheetBehavior<FrameLayout>
|
private var behavior: BottomSheetBehavior<FrameLayout>? = null
|
||||||
private val bottomSheetCallback = object : BottomSheetBehavior.BottomSheetCallback() {
|
private val bottomSheetCallback = object : BottomSheetBehavior.BottomSheetCallback() {
|
||||||
override fun onSlide(bottomSheet: View, slideOffset: Float) {
|
override fun onSlide(bottomSheet: View, slideOffset: Float) {
|
||||||
}
|
}
|
||||||
@ -51,7 +51,7 @@ class AddTunnelsSheet : BottomSheetDialogFragment() {
|
|||||||
view.viewTreeObserver.removeOnGlobalLayoutListener(this)
|
view.viewTreeObserver.removeOnGlobalLayoutListener(this)
|
||||||
val dialog = dialog as BottomSheetDialog? ?: return
|
val dialog = dialog as BottomSheetDialog? ?: return
|
||||||
behavior = dialog.behavior
|
behavior = dialog.behavior
|
||||||
behavior.apply {
|
behavior?.apply {
|
||||||
state = BottomSheetBehavior.STATE_EXPANDED
|
state = BottomSheetBehavior.STATE_EXPANDED
|
||||||
peekHeight = 0
|
peekHeight = 0
|
||||||
addBottomSheetCallback(bottomSheetCallback)
|
addBottomSheetCallback(bottomSheetCallback)
|
||||||
@ -78,7 +78,7 @@ class AddTunnelsSheet : BottomSheetDialogFragment() {
|
|||||||
|
|
||||||
override fun dismiss() {
|
override fun dismiss() {
|
||||||
super.dismiss()
|
super.dismiss()
|
||||||
behavior.removeBottomSheetCallback(bottomSheetCallback)
|
behavior?.removeBottomSheetCallback(bottomSheetCallback)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun requireTargetFragment(): Fragment {
|
private fun requireTargetFragment(): Fragment {
|
||||||
|
Loading…
Reference in New Issue
Block a user