From 91a75b681d76a863e28db7c14ff1ffd215698997 Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Tue, 4 Apr 2023 21:36:30 +0200 Subject: ui: always use MaterialAlertDialogBuilder Signed-off-by: Jason A. Donenfeld --- .../java/com/wireguard/android/preference/DonatePreference.kt | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'ui') diff --git a/ui/src/main/java/com/wireguard/android/preference/DonatePreference.kt b/ui/src/main/java/com/wireguard/android/preference/DonatePreference.kt index ae2c1c91..59980dcb 100644 --- a/ui/src/main/java/com/wireguard/android/preference/DonatePreference.kt +++ b/ui/src/main/java/com/wireguard/android/preference/DonatePreference.kt @@ -5,13 +5,13 @@ package com.wireguard.android.preference -import android.app.AlertDialog import android.content.Context import android.content.Intent import android.net.Uri import android.util.AttributeSet import android.widget.Toast import androidx.preference.Preference +import com.google.android.material.dialog.MaterialAlertDialogBuilder import com.wireguard.android.BuildConfig import com.wireguard.android.R import com.wireguard.android.util.ErrorMessages @@ -22,13 +22,15 @@ class DonatePreference(context: Context, attrs: AttributeSet?) : Preference(cont override fun getTitle() = context.getString(R.string.donate_title) override fun onClick() { + /* Google Play Store forbids links to our donation page. */ if (BuildConfig.IS_GOOGLE_PLAY) { - AlertDialog.Builder(context) + MaterialAlertDialogBuilder(context) .setTitle(R.string.donate_title) .setMessage(R.string.donate_google_play_disappointment) .show() return } + val intent = Intent(Intent.ACTION_VIEW) intent.data = Uri.parse("https://www.wireguard.com/donations/") try { @@ -37,4 +39,4 @@ class DonatePreference(context: Context, attrs: AttributeSet?) : Preference(cont Toast.makeText(context, ErrorMessages[e], Toast.LENGTH_SHORT).show() } } -} \ No newline at end of file +} -- cgit v1.2.3