make some dialogs stickier

This commit is contained in:
tibbi 2021-05-10 18:16:10 +02:00
parent a8a3a25bb6
commit 50f43ef2ec
6 changed files with 26 additions and 26 deletions

View file

@ -17,10 +17,10 @@ class DonateDialog(val activity: Activity) {
}
AlertDialog.Builder(activity)
.setPositiveButton(R.string.purchase) { dialog, which -> activity.launchViewIntent(R.string.thank_you_url) }
.setNegativeButton(R.string.cancel, null)
.create().apply {
activity.setupDialogStuff(view, this)
}
.setPositiveButton(R.string.purchase) { dialog, which -> activity.launchViewIntent(R.string.thank_you_url) }
.setNegativeButton(R.string.cancel, null)
.create().apply {
activity.setupDialogStuff(view, this, cancelOnTouchOutside = false)
}
}
}

View file

@ -12,8 +12,8 @@ class NewAppDialog(val activity: Activity, val packageName: String, val title: S
init {
val view = activity.layoutInflater.inflate(R.layout.dialog_textview, null).apply {
val text = String.format(activity.getString(R.string.new_app),
"https://play.google.com/store/apps/details?id=$packageName", title,
"https://play.google.com/store/apps/details?id=$packageName2", title2
"https://play.google.com/store/apps/details?id=$packageName", title,
"https://play.google.com/store/apps/details?id=$packageName2", title2
)
text_view.text = Html.fromHtml(text)
@ -21,9 +21,9 @@ class NewAppDialog(val activity: Activity, val packageName: String, val title: S
}
AlertDialog.Builder(activity)
.setPositiveButton(R.string.ok, null)
.create().apply {
activity.setupDialogStuff(view, this)
}
.setPositiveButton(R.string.ok, null)
.create().apply {
activity.setupDialogStuff(view, this, cancelOnTouchOutside = false)
}
}
}

View file

@ -33,7 +33,7 @@ class NewAppsIconsDialog(val activity: Activity) {
AlertDialog.Builder(activity)
.setPositiveButton(R.string.ok, null)
.create().apply {
activity.setupDialogStuff(view, this)
activity.setupDialogStuff(view, this, cancelOnTouchOutside = false)
}
}
}

View file

@ -26,7 +26,7 @@ class PurchaseThankYouDialog(val activity: Activity) {
.setPositiveButton(R.string.purchase) { dialog, which -> activity.launchPurchaseThankYouIntent() }
.setNegativeButton(R.string.cancel, null)
.create().apply {
activity.setupDialogStuff(view, this)
activity.setupDialogStuff(view, this, cancelOnTouchOutside = false)
}
}
}

View file

@ -27,11 +27,11 @@ class RateStarsDialog(val activity: Activity) {
}
dialog = AlertDialog.Builder(activity)
.setNegativeButton(R.string.cancel) { dialog, which -> dialogCancelled(false) }
.setOnCancelListener { dialogCancelled(false) }
.create().apply {
activity.setupDialogStuff(view, this)
}
.setNegativeButton(R.string.cancel) { dialog, which -> dialogCancelled(false) }
.setOnCancelListener { dialogCancelled(false) }
.create().apply {
activity.setupDialogStuff(view, this, cancelOnTouchOutside = false)
}
}
private fun dialogCancelled(showThankYou: Boolean) {

View file

@ -16,15 +16,15 @@ class UpgradeToProDialog(val activity: Activity) {
}
AlertDialog.Builder(activity)
.setPositiveButton(R.string.upgrade) { dialog, which -> upgradeApp() }
.setNeutralButton(R.string.more_info, null) // do not dismiss the dialog on pressing More Info
.setNegativeButton(R.string.cancel, null)
.create().apply {
activity.setupDialogStuff(view, this)
getButton(AlertDialog.BUTTON_NEUTRAL).setOnClickListener {
moreInfo()
}
.setPositiveButton(R.string.upgrade) { dialog, which -> upgradeApp() }
.setNeutralButton(R.string.more_info, null) // do not dismiss the dialog on pressing More Info
.setNegativeButton(R.string.cancel, null)
.create().apply {
activity.setupDialogStuff(view, this, cancelOnTouchOutside = false)
getButton(AlertDialog.BUTTON_NEUTRAL).setOnClickListener {
moreInfo()
}
}
}
private fun upgradeApp() {