ClipboardUtils: localize clipboard notification snack

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
Jason A. Donenfeld 2021-01-01 16:34:03 +01:00
parent f670ff22c6
commit 4a7969ef24
2 changed files with 3 additions and 1 deletions

View File

@ -11,6 +11,7 @@ import android.widget.TextView
import androidx.core.content.getSystemService import androidx.core.content.getSystemService
import com.google.android.material.snackbar.Snackbar import com.google.android.material.snackbar.Snackbar
import com.google.android.material.textfield.TextInputEditText import com.google.android.material.textfield.TextInputEditText
import com.wireguard.android.R
/** /**
* Standalone utilities for interacting with the system clipboard. * Standalone utilities for interacting with the system clipboard.
@ -28,6 +29,6 @@ object ClipboardUtils {
} }
val service = view.context.getSystemService<ClipboardManager>() ?: return val service = view.context.getSystemService<ClipboardManager>() ?: return
service.setPrimaryClip(ClipData.newPlainText(data.second, data.first)) service.setPrimaryClip(ClipData.newPlainText(data.second, data.first))
Snackbar.make(view, "${data.second} copied to clipboard", Snackbar.LENGTH_LONG).show() Snackbar.make(view, view.context.getString(R.string.copied_to_clipboard, data.second), Snackbar.LENGTH_LONG).show()
} }
} }

View File

@ -97,6 +97,7 @@
<string name="create_output_dir_error">Cannot create output directory</string> <string name="create_output_dir_error">Cannot create output directory</string>
<string name="create_temp_dir_error">Cannot create local temporary directory</string> <string name="create_temp_dir_error">Cannot create local temporary directory</string>
<string name="create_tunnel">Create Tunnel</string> <string name="create_tunnel">Create Tunnel</string>
<string name="copied_to_clipboard">%s copied to clipboard</string>
<string name="dark_theme_summary_off">Currently using light (day) theme</string> <string name="dark_theme_summary_off">Currently using light (day) theme</string>
<string name="dark_theme_summary_on">Currently using dark (night) theme</string> <string name="dark_theme_summary_on">Currently using dark (night) theme</string>
<string name="dark_theme_title">Use dark theme</string> <string name="dark_theme_title">Use dark theme</string>