From b4abb2e7273cbf416cc89f376ec74a85237a59ec Mon Sep 17 00:00:00 2001 From: M66B Date: Mon, 2 Nov 2015 21:57:05 +0100 Subject: [PATCH] Disable donate button after click --- app/src/main/java/eu/faircode/netguard/ActivityMain.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/app/src/main/java/eu/faircode/netguard/ActivityMain.java b/app/src/main/java/eu/faircode/netguard/ActivityMain.java index 2486946a..bb754ea6 100644 --- a/app/src/main/java/eu/faircode/netguard/ActivityMain.java +++ b/app/src/main/java/eu/faircode/netguard/ActivityMain.java @@ -525,6 +525,11 @@ public class ActivityMain extends AppCompatActivity implements SharedPreferences @Override public void onClick(View view) { new AsyncTask() { + @Override + protected void onPreExecute() { + btnDonate.setEnabled(false); + } + @Override protected Object doInBackground(Object... objects) { try { @@ -553,6 +558,8 @@ public class ActivityMain extends AppCompatActivity implements SharedPreferences } catch (Throwable ex) { Log.e(TAG, ex.toString() + "\n" + Log.getStackTraceString(ex)); Toast.makeText(ActivityMain.this, result.toString(), Toast.LENGTH_LONG).show(); + } finally { + btnDonate.setEnabled(true); } } }.execute();