0
0
Fork 0
mirror of https://github.com/YTVanced/VancedManager synced 2024-11-10 12:55:06 +00:00

create BindingBottomSheetDialogFragment

This commit is contained in:
HaliksaR 2020-11-15 23:30:22 +07:00
parent 52bb26b3e0
commit a1d4cdbbe5

View file

@ -0,0 +1,37 @@
package com.vanced.manager.ui.core
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.viewbinding.ViewBinding
import com.google.android.material.bottomsheet.BottomSheetDialogFragment
abstract class BindingBottomSheetDialogFragment<VB : ViewBinding> : BottomSheetDialogFragment() {
private var _binding: VB? = null
protected val binding: VB get() = requireNotNull(_binding)
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View {
_binding = binding(inflater, container, savedInstanceState)
otherSetups()
return binding.root
}
protected abstract fun binding(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): VB
protected open fun otherSetups() = Unit
override fun onDestroyView() {
super.onDestroyView()
_binding = null
}
}