diff --git a/src/org/thoughtcrime/securesms/WebxdcActivity.java b/src/org/thoughtcrime/securesms/WebxdcActivity.java index 1eaf4c4d1..66137fb74 100644 --- a/src/org/thoughtcrime/securesms/WebxdcActivity.java +++ b/src/org/thoughtcrime/securesms/WebxdcActivity.java @@ -62,13 +62,15 @@ public class WebxdcActivity extends WebViewActivity implements DcEventCenter.DcE private boolean internetAccess = false; public static void openWebxdcActivity(Context context, DcMsg instance) { - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { - if (Prefs.isDeveloperModeEnabled(context)) { - WebView.setWebContentsDebuggingEnabled(true); + if (!Util.isClickedRecently()) { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { + if (Prefs.isDeveloperModeEnabled(context)) { + WebView.setWebContentsDebuggingEnabled(true); + } + context.startActivity(getWebxdcIntent(context, instance.getId())); + } else { + Toast.makeText(context, "At least Android 5.0 (Lollipop) required for Webxdc.", Toast.LENGTH_LONG).show(); } - context.startActivity(getWebxdcIntent(context, instance.getId())); - } else { - Toast.makeText(context, "At least Android 5.0 (Lollipop) required for Webxdc.", Toast.LENGTH_LONG).show(); } } diff --git a/src/org/thoughtcrime/securesms/util/Util.java b/src/org/thoughtcrime/securesms/util/Util.java index 2a7af0606..3978a4426 100644 --- a/src/org/thoughtcrime/securesms/util/Util.java +++ b/src/org/thoughtcrime/securesms/util/Util.java @@ -333,4 +333,15 @@ public class Util { public static int rgbToArgbColor(int rgb) { return Color.argb(0xFF, Color.red(rgb), Color.green(rgb), Color.blue(rgb)); } + + private static long lastClickTime = 0; + public static boolean isClickedRecently() { + long now = System.currentTimeMillis(); + if (now - lastClickTime < 500) { + Log.i(TAG, "tap discarded"); + return true; + } + lastClickTime = now; + return false; + } }