ui: always use MaterialAlertDialogBuilder
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
		
							parent
							
								
									0efdf0cdd7
								
							
						
					
					
						commit
						91a75b681d
					
				@ -5,13 +5,13 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
package com.wireguard.android.preference
 | 
					package com.wireguard.android.preference
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import android.app.AlertDialog
 | 
					 | 
				
			||||||
import android.content.Context
 | 
					import android.content.Context
 | 
				
			||||||
import android.content.Intent
 | 
					import android.content.Intent
 | 
				
			||||||
import android.net.Uri
 | 
					import android.net.Uri
 | 
				
			||||||
import android.util.AttributeSet
 | 
					import android.util.AttributeSet
 | 
				
			||||||
import android.widget.Toast
 | 
					import android.widget.Toast
 | 
				
			||||||
import androidx.preference.Preference
 | 
					import androidx.preference.Preference
 | 
				
			||||||
 | 
					import com.google.android.material.dialog.MaterialAlertDialogBuilder
 | 
				
			||||||
import com.wireguard.android.BuildConfig
 | 
					import com.wireguard.android.BuildConfig
 | 
				
			||||||
import com.wireguard.android.R
 | 
					import com.wireguard.android.R
 | 
				
			||||||
import com.wireguard.android.util.ErrorMessages
 | 
					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 getTitle() = context.getString(R.string.donate_title)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    override fun onClick() {
 | 
					    override fun onClick() {
 | 
				
			||||||
 | 
					        /* Google Play Store forbids links to our donation page. */
 | 
				
			||||||
        if (BuildConfig.IS_GOOGLE_PLAY) {
 | 
					        if (BuildConfig.IS_GOOGLE_PLAY) {
 | 
				
			||||||
            AlertDialog.Builder(context)
 | 
					            MaterialAlertDialogBuilder(context)
 | 
				
			||||||
                .setTitle(R.string.donate_title)
 | 
					                .setTitle(R.string.donate_title)
 | 
				
			||||||
                .setMessage(R.string.donate_google_play_disappointment)
 | 
					                .setMessage(R.string.donate_google_play_disappointment)
 | 
				
			||||||
                .show()
 | 
					                .show()
 | 
				
			||||||
            return
 | 
					            return
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        val intent = Intent(Intent.ACTION_VIEW)
 | 
					        val intent = Intent(Intent.ACTION_VIEW)
 | 
				
			||||||
        intent.data = Uri.parse("https://www.wireguard.com/donations/")
 | 
					        intent.data = Uri.parse("https://www.wireguard.com/donations/")
 | 
				
			||||||
        try {
 | 
					        try {
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user