mirror of
https://github.com/oxen-io/session-android.git
synced 2025-01-12 05:23:40 +00:00
Add copy mnemonic button
This commit is contained in:
parent
2c35ed2177
commit
e36d9e110c
@ -43,10 +43,23 @@
|
|||||||
android:layout_marginTop="16dp"
|
android:layout_marginTop="16dp"
|
||||||
android:alpha="0.8"
|
android:alpha="0.8"
|
||||||
android:textStyle="italic"
|
android:textStyle="italic"
|
||||||
android:textAlignment="center" />
|
android:textAlignment="center"
|
||||||
|
tools:text="quick brown fox jump lazy dog" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/copyButton"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="50dp"
|
||||||
|
android:layout_marginTop="20dp"
|
||||||
|
android:layout_gravity="center_horizontal"
|
||||||
|
android:background="@color/white"
|
||||||
|
android:textColor="@color/signal_primary"
|
||||||
|
android:text="@string/activity_key_pair_copy_button_title"
|
||||||
|
android:elevation="0dp"
|
||||||
|
android:stateListAnimator="@null" />
|
||||||
|
|
||||||
<com.dd.CircularProgressButton
|
<com.dd.CircularProgressButton
|
||||||
android:id="@+id/nextButton"
|
android:id="@+id/registerButton"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="50dp"
|
android:layout_height="50dp"
|
||||||
android:layout_marginTop="20dp"
|
android:layout_marginTop="20dp"
|
||||||
@ -57,7 +70,7 @@
|
|||||||
app:cpb_colorProgress="@color/textsecure_primary"
|
app:cpb_colorProgress="@color/textsecure_primary"
|
||||||
app:cpb_cornerRadius="4dp"
|
app:cpb_cornerRadius="4dp"
|
||||||
app:cpb_selectorIdle="@drawable/progress_button_state"
|
app:cpb_selectorIdle="@drawable/progress_button_state"
|
||||||
app:cpb_textIdle="@string/activity_key_pair_button_title" />
|
app:cpb_textIdle="@string/activity_key_pair_register_button_title" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
@ -1526,6 +1526,8 @@
|
|||||||
<!-- Key pair activity -->
|
<!-- Key pair activity -->
|
||||||
<string name="activity_key_pair_title">Create Your Loki Messenger Account</string>
|
<string name="activity_key_pair_title">Create Your Loki Messenger Account</string>
|
||||||
<string name="activity_key_pair_subtitle">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.</string>
|
<string name="activity_key_pair_subtitle">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.</string>
|
||||||
<string name="activity_key_pair_button_title">Register</string>
|
<string name="activity_key_pair_copy_button_title">Copy</string>
|
||||||
|
<string name="activity_key_pair_mnemonic_copied_message">Copied to Clipboard</string>
|
||||||
|
<string name="activity_key_pair_register_button_title">Register</string>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
@ -1,7 +1,11 @@
|
|||||||
package org.thoughtcrime.securesms.loki
|
package org.thoughtcrime.securesms.loki
|
||||||
|
|
||||||
|
import android.content.ClipData
|
||||||
|
import android.content.ClipboardManager
|
||||||
|
import android.content.Context
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
|
import android.widget.Toast
|
||||||
import kotlinx.android.synthetic.main.activity_key_pair.*
|
import kotlinx.android.synthetic.main.activity_key_pair.*
|
||||||
import org.thoughtcrime.securesms.BaseActionBarActivity
|
import org.thoughtcrime.securesms.BaseActionBarActivity
|
||||||
import org.thoughtcrime.securesms.ConversationListActivity
|
import org.thoughtcrime.securesms.ConversationListActivity
|
||||||
@ -18,6 +22,7 @@ import org.whispersystems.signalservice.loki.utilities.hexEncodedPublicKey
|
|||||||
import java.io.File
|
import java.io.File
|
||||||
import java.io.FileOutputStream
|
import java.io.FileOutputStream
|
||||||
|
|
||||||
|
|
||||||
class KeyPairActivity : BaseActionBarActivity() {
|
class KeyPairActivity : BaseActionBarActivity() {
|
||||||
private lateinit var languageFileDirectory: File
|
private lateinit var languageFileDirectory: File
|
||||||
private var keyPair: IdentityKeyPair? = null
|
private var keyPair: IdentityKeyPair? = null
|
||||||
@ -31,7 +36,8 @@ class KeyPairActivity : BaseActionBarActivity() {
|
|||||||
setContentView(R.layout.activity_key_pair)
|
setContentView(R.layout.activity_key_pair)
|
||||||
setUpLanguageFileDirectory()
|
setUpLanguageFileDirectory()
|
||||||
updateKeyPair()
|
updateKeyPair()
|
||||||
nextButton.setOnClickListener { register() }
|
copyButton.setOnClickListener { copy() }
|
||||||
|
registerButton.setOnClickListener { register() }
|
||||||
}
|
}
|
||||||
// endregion
|
// endregion
|
||||||
|
|
||||||
@ -74,6 +80,13 @@ class KeyPairActivity : BaseActionBarActivity() {
|
|||||||
// endregion
|
// endregion
|
||||||
|
|
||||||
// region Interaction
|
// 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() {
|
private fun register() {
|
||||||
val publicKey = keyPair!!.publicKey
|
val publicKey = keyPair!!.publicKey
|
||||||
val hexEncodedPublicKey = keyPair!!.hexEncodedPublicKey
|
val hexEncodedPublicKey = keyPair!!.hexEncodedPublicKey
|
||||||
|
Loading…
x
Reference in New Issue
Block a user