From 83e93b254e9e6a1a5af550b9d354cf5163c27632 Mon Sep 17 00:00:00 2001 From: arkon Date: Wed, 8 Jun 2022 22:31:01 -0400 Subject: [PATCH] Don't show clipboard copy confirmation toast on Android 13 or above (cherry picked from commit 40f5d26945a61de0a6bea27bcee53e7b536174c6) --- .../eu/kanade/tachiyomi/util/system/ContextExtensions.kt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/util/system/ContextExtensions.kt b/app/src/main/java/eu/kanade/tachiyomi/util/system/ContextExtensions.kt index 134d8470d..d9a76d31e 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/util/system/ContextExtensions.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/util/system/ContextExtensions.kt @@ -87,7 +87,11 @@ fun Context.copyToClipboard(label: String, content: String) { val clipboard = getSystemService()!! clipboard.setPrimaryClip(ClipData.newPlainText(label, content)) - toast(getString(R.string.copied_to_clipboard, content.truncateCenter(50))) + // Android 13 and higher shows a visual confirmation of copied contents + // https://developer.android.com/about/versions/13/features/copy-paste + if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.S_V2) { + toast(getString(R.string.copied_to_clipboard, content.truncateCenter(50))) + } } catch (e: Throwable) { logcat(LogPriority.ERROR, e) toast(R.string.clipboard_copy_error)