From 16ccc2075091be32e8334ecc62f6a595fceaed56 Mon Sep 17 00:00:00 2001 From: emanuele-f Date: Thu, 11 Apr 2024 10:55:05 +0200 Subject: [PATCH] Avoid duplicate cliboard copy notification on 13+ Since Android 13, Android itself will show a notification when copying data to the clipboard --- app/src/main/java/com/emanuelef/remote_capture/Utils.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/com/emanuelef/remote_capture/Utils.java b/app/src/main/java/com/emanuelef/remote_capture/Utils.java index e1cd63bd..3a68bcbe 100644 --- a/app/src/main/java/com/emanuelef/remote_capture/Utils.java +++ b/app/src/main/java/com/emanuelef/remote_capture/Utils.java @@ -917,7 +917,9 @@ public class Utils { ClipData clip = ClipData.newPlainText(ctx.getString(R.string.stats), contents); clipboard.setPrimaryClip(clip); - Utils.showToast(ctx, R.string.copied); + // Only show a toast for Android 12 and lower + if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.S_V2) + Utils.showToast(ctx, R.string.copied); } catch (Exception e) { Log.e(TAG, "copyToClipboard failed: " + e.getMessage()); Utils.showToastLong(ctx, R.string.error);