Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
DialogFullScreen
abstract class BaseFullFragment: DialogFragment() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setStyle(STYLE_NORMAL, R.style.AppTheme)
}
override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
return inflater.inflate(getLayout(), container, false)
}
abstract fun getLayout(): Int
override fun onStart() {
super.onStart()
val dialog: Dialog? = dialog
if (dialog != null) {
val width = ViewGroup.LayoutParams.MATCH_PARENT
val height = ViewGroup.LayoutParams.MATCH_PARENT
dialog.window?.setLayout(width, height)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment