From 9766c3fd0b9200323584f15fbc004d9bc1b0987f Mon Sep 17 00:00:00 2001 From: alansley Date: Thu, 22 Aug 2024 09:55:14 +1000 Subject: [PATCH] SS-75 Added 'Copied' toast when the user copies a URL in the Open URL dialog --- .../org/thoughtcrime/securesms/SessionDialogBuilder.kt | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/org/thoughtcrime/securesms/SessionDialogBuilder.kt b/app/src/main/java/org/thoughtcrime/securesms/SessionDialogBuilder.kt index d6d1e2d249..c5ee6ca6ed 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/SessionDialogBuilder.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/SessionDialogBuilder.kt @@ -22,6 +22,7 @@ import android.widget.RelativeLayout import android.widget.ScrollView import android.widget.Space import android.widget.TextView +import android.widget.Toast import androidx.annotation.AttrRes import androidx.annotation.LayoutRes import androidx.annotation.StringRes @@ -202,8 +203,6 @@ public fun Context.copyURLToClipboard(url: String) { fun Context.showOpenUrlDialog(url: String, showCloseButton: Boolean = true): AlertDialog { return SessionDialogBuilder(this).apply { - - // If we're not showing a close button we can just use a simple title.. if (!showCloseButton) { title(R.string.urlOpen) @@ -311,7 +310,10 @@ fun Context.showOpenUrlDialog(url: String, showCloseButton: Boolean = true): Ale // Note: The text and contentDescription are set on the `copyUrlButton` by the function. contentView.addView(scrollView) dangerButton(R.string.open, R.string.AccessibilityId_urlOpenBrowser) { openUrl(url) } - copyUrlButton { context.copyURLToClipboard(url) } + copyUrlButton { + context.copyURLToClipboard(url) + Toast.makeText(context, R.string.copied, Toast.LENGTH_SHORT).show() + } }.show() }