mirror of
https://github.com/mihonapp/mihon.git
synced 2024-11-30 05:41:52 -05:00
Don't show clipboard copy confirmation toast on Android 13 or above
(cherry picked from commit 40f5d26945
)
This commit is contained in:
parent
49c7dd0cac
commit
83e93b254e
1 changed files with 5 additions and 1 deletions
|
@ -87,7 +87,11 @@ fun Context.copyToClipboard(label: String, content: String) {
|
||||||
val clipboard = getSystemService<ClipboardManager>()!!
|
val clipboard = getSystemService<ClipboardManager>()!!
|
||||||
clipboard.setPrimaryClip(ClipData.newPlainText(label, content))
|
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) {
|
} catch (e: Throwable) {
|
||||||
logcat(LogPriority.ERROR, e)
|
logcat(LogPriority.ERROR, e)
|
||||||
toast(R.string.clipboard_copy_error)
|
toast(R.string.clipboard_copy_error)
|
||||||
|
|
Loading…
Reference in a new issue