Add legacy self-update so v3 users can get v4 update

This commit is contained in:
Rahul Kumar Patel
2021-03-01 22:02:09 +05:30
parent 09e75860a5
commit 90113ab338
10 changed files with 307 additions and 6 deletions

View File

@@ -54,6 +54,20 @@ fun Context.showDialog(title: String?, message: String?) {
}
}
fun Context.showDialog(title: String?, message: String?, listener: DialogInterface.OnDismissListener) {
runOnUiThread {
val backgroundColor: Int = getStyledAttributeColor(android.R.attr.colorBackground)
val builder = MaterialAlertDialogBuilder(this).apply {
setTitle(title)
setMessage(message)
setPositiveButton(android.R.string.ok) { dialog: DialogInterface, _ -> listener }
background = ColorDrawable(backgroundColor)
}.create()
builder.show()
}
}
fun Fragment.showDialog(@StringRes titleId: Int, @StringRes messageId: Int) {
requireContext().showDialog(titleId, messageId)
}