Created
October 19, 2022 10:57
-
-
Save arsalanfakhar/f7a7356f96244c93dc9de5e8275d89b2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.example.samplemediumapp.base | |
import android.os.Bundle | |
import android.view.* | |
import androidx.databinding.ViewDataBinding | |
import androidx.fragment.app.DialogFragment | |
import com.example.samplemediumapp.R | |
abstract class BaseDialogFragment<VB : ViewDataBinding> : DialogFragment() { | |
protected open val dialogStyle: Int = R.style.DialogTheme | |
protected abstract fun getBindView( | |
inflater: LayoutInflater, | |
container: ViewGroup?, | |
): VB | |
protected lateinit var binding: VB | |
override fun onCreate(savedInstanceState: Bundle?) { | |
super.onCreate(savedInstanceState) | |
setStyle(STYLE_NO_FRAME, dialogStyle) | |
} | |
override fun onCreateView( | |
inflater: LayoutInflater, | |
container: ViewGroup?, | |
savedInstanceState: Bundle?, | |
): View? { | |
return getBindView(inflater, container).apply { | |
binding = this | |
lifecycleOwner = viewLifecycleOwner | |
}.root | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment