Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save mksantoki/e7387c84f18100aa4005ef6d8ca8052b to your computer and use it in GitHub Desktop.
Save mksantoki/e7387c84f18100aa4005ef6d8ca8052b to your computer and use it in GitHub Desktop.
Binding BottomSheetDialogFragment
abstract class BaseDataBindingBottomSheetDialogFragment : BottomSheetDialogFragment() {
private var mProgressDialog: Dialog? = null
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
initControl()
initView(view)
setListener()
}
abstract fun initView(view: View)
abstract fun initControl()
abstract fun setListener()
open fun showProgressDialog() {
if (mProgressDialog == null) {
mProgressDialog = context?.let { Dialog(it) }
mProgressDialog!!.requestWindowFeature(Window.FEATURE_NO_TITLE)
mProgressDialog?.setContentView(R.layout.progress_bar_circular)
mProgressDialog!!.window!!.setBackgroundDrawable(ColorDrawable(Color.TRANSPARENT))
mProgressDialog?.setCancelable(false)
mProgressDialog?.setCanceledOnTouchOutside(false)
}
mProgressDialog!!.show()
}
open fun hideProgressDialog() {
if (mProgressDialog != null && mProgressDialog!!.isShowing) {
mProgressDialog!!.dismiss()
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment