Created
March 13, 2021 11:24
-
-
Save GeorgCantor/ae339a3b6b084c9ac7ca3816c43458d9 to your computer and use it in GitHub Desktop.
This file contains 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
fun Context.showOneButtonDialog( | |
title: String, | |
message: String, | |
isRegistrationDialog: Boolean, | |
transitionFunction: (View, ConstraintLayout) -> (Unit) | |
): View { | |
val dialogView = LayoutInflater.from(this).inflate(R.layout.dialog_one_button, null) | |
val builder = AlertDialog.Builder(this).setView(dialogView) | |
val alertDialog = builder.show() | |
with(alertDialog) { | |
window?.setBackgroundDrawable(ColorDrawable(TRANSPARENT)) | |
this.title.text = title | |
this.message.text = message | |
ok_button.setOnClickListener { | |
transitionFunction(dialogView, dialog_root_layout) | |
550L.runDelayed { dismiss() } | |
} | |
if (isRegistrationDialog) { | |
this.message.setMultiColoredText(R.string.terms_description) | |
this.message.setTextSize(TypedValue.COMPLEX_UNIT_SP, 14F) | |
this.line.visible() | |
this.extra_message.visible() | |
} | |
} | |
return dialogView | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment