diff --git a/res/layout/activity_key_pair.xml b/res/layout/activity_key_pair.xml
index a5a09e996d..e6e9d1d2f9 100644
--- a/res/layout/activity_key_pair.xml
+++ b/res/layout/activity_key_pair.xml
@@ -43,10 +43,23 @@
android:layout_marginTop="16dp"
android:alpha="0.8"
android:textStyle="italic"
- android:textAlignment="center" />
+ android:textAlignment="center"
+ tools:text="quick brown fox jump lazy dog" />
+
+
+ app:cpb_textIdle="@string/activity_key_pair_register_button_title" />
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 01c67e9737..58cc856a9a 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -1526,6 +1526,8 @@
Create Your Loki Messenger Account
Please save the seed below in a safe location. It can be used to restore your account if you lose access, or to migrate to a new device.
- Register
+ Copy
+ Copied to Clipboard
+ Register
diff --git a/src/org/thoughtcrime/securesms/loki/KeyPairActivity.kt b/src/org/thoughtcrime/securesms/loki/KeyPairActivity.kt
index c27135ed28..0e1181e67c 100644
--- a/src/org/thoughtcrime/securesms/loki/KeyPairActivity.kt
+++ b/src/org/thoughtcrime/securesms/loki/KeyPairActivity.kt
@@ -1,7 +1,11 @@
package org.thoughtcrime.securesms.loki
+import android.content.ClipData
+import android.content.ClipboardManager
+import android.content.Context
import android.content.Intent
import android.os.Bundle
+import android.widget.Toast
import kotlinx.android.synthetic.main.activity_key_pair.*
import org.thoughtcrime.securesms.BaseActionBarActivity
import org.thoughtcrime.securesms.ConversationListActivity
@@ -18,6 +22,7 @@ import org.whispersystems.signalservice.loki.utilities.hexEncodedPublicKey
import java.io.File
import java.io.FileOutputStream
+
class KeyPairActivity : BaseActionBarActivity() {
private lateinit var languageFileDirectory: File
private var keyPair: IdentityKeyPair? = null
@@ -31,7 +36,8 @@ class KeyPairActivity : BaseActionBarActivity() {
setContentView(R.layout.activity_key_pair)
setUpLanguageFileDirectory()
updateKeyPair()
- nextButton.setOnClickListener { register() }
+ copyButton.setOnClickListener { copy() }
+ registerButton.setOnClickListener { register() }
}
// endregion
@@ -74,6 +80,13 @@ class KeyPairActivity : BaseActionBarActivity() {
// endregion
// region Interaction
+ private fun copy() {
+ val clipboard = getSystemService(Context.CLIPBOARD_SERVICE) as ClipboardManager
+ val clip = ClipData.newPlainText("mnemonic", mnemonic)
+ clipboard.primaryClip = clip
+ Toast.makeText(this, R.string.activity_key_pair_mnemonic_copied_message, Toast.LENGTH_SHORT).show()
+ }
+
private fun register() {
val publicKey = keyPair!!.publicKey
val hexEncodedPublicKey = keyPair!!.hexEncodedPublicKey