-
Notifications
You must be signed in to change notification settings - Fork 170
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add support for 24 word recovery phrases, add option to choose …
…word count on wallet creation.
- Loading branch information
1 parent
2abfa75
commit 7c8c75f
Showing
10 changed files
with
220 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,121 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:app="http://schemas.android.com/apk/res-auto" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent"> | ||
|
||
<androidx.appcompat.widget.Toolbar | ||
android:id="@+id/titleBar" | ||
android:layout_width="match_parent" | ||
android:layout_height="?attr/actionBarSize" | ||
app:layout_constraintTop_toTopOf="parent" | ||
app:navigationIcon="@drawable/ic_arrow_back" /> | ||
|
||
<LinearLayout | ||
android:id="@+id/register_panel" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
android:orientation="vertical" | ||
android:layout_marginTop="20dp" | ||
android:paddingHorizontal="20dp" | ||
android:paddingBottom="62dp" | ||
app:layout_constraintTop_toBottomOf="@id/titleBar"> | ||
|
||
<TextView | ||
android:id="@+id/title" | ||
style="@style/Headline5" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:layout_marginTop="?attr/actionBarSize" | ||
android:text="@string/select_security_level_title" | ||
android:textAlignment="gravity" /> | ||
|
||
<TextView | ||
android:id="@+id/description_1" | ||
style="@style/Body2" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:layout_marginTop="12dp" | ||
android:gravity="start" | ||
android:textAlignment="gravity" | ||
android:text="@string/select_security_level_message" /> | ||
|
||
<androidx.constraintlayout.widget.ConstraintLayout | ||
android:id="@+id/twelve_words_option" | ||
app:layout_constraintEnd_toEndOf="parent" | ||
app:layout_constraintStart_toStartOf="parent" | ||
app:layout_constraintTop_toBottomOf="@+id/register_panel" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:layout_marginTop="15dp" | ||
android:background="@drawable/light_grey_border_item" | ||
android:paddingHorizontal="20dp" | ||
android:paddingVertical="12dp"> | ||
|
||
<TextView | ||
android:id="@+id/twelve_words_option_title" | ||
style="@style/Subtitle1" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:text="@string/select_security_level_12_words_title" | ||
app:layout_constraintStart_toStartOf="parent" | ||
app:layout_constraintTop_toTopOf="parent" /> | ||
|
||
<TextView | ||
android:id="@+id/twelve_words_option_message" | ||
style="@style/Caption.Secondary" | ||
android:layout_width="0dp" | ||
android:layout_height="wrap_content" | ||
android:layout_marginEnd="20dp" | ||
android:text="@string/select_security_level_12_words_message" | ||
app:layout_constraintStart_toStartOf="parent" | ||
app:layout_constraintTop_toBottomOf="@id/twelve_words_option_title" /> | ||
</androidx.constraintlayout.widget.ConstraintLayout> | ||
<androidx.constraintlayout.widget.ConstraintLayout | ||
android:id="@+id/twenty_four_words_option" | ||
app:layout_constraintEnd_toEndOf="parent" | ||
app:layout_constraintStart_toStartOf="parent" | ||
app:layout_constraintTop_toBottomOf="@+id/intermediate_cl" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:layout_marginTop="15dp" | ||
android:background="@drawable/light_grey_border_item" | ||
android:paddingHorizontal="20dp" | ||
android:paddingVertical="12dp"> | ||
|
||
<TextView | ||
android:id="@+id/non_contested_name_title" | ||
style="@style/Subtitle1" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:text="@string/select_security_level_24_words_title" | ||
app:layout_constraintStart_toStartOf="parent" | ||
app:layout_constraintTop_toTopOf="parent" /> | ||
|
||
<TextView | ||
android:id="@+id/non_contested_name_description" | ||
style="@style/Caption.Secondary" | ||
android:layout_width="0dp" | ||
android:layout_height="wrap_content" | ||
android:layout_marginEnd="20dp" | ||
android:text="@string/select_security_level_24_words_message" | ||
app:layout_constraintStart_toStartOf="parent" | ||
app:layout_constraintTop_toBottomOf="@+id/non_contested_name_title" /> | ||
</androidx.constraintlayout.widget.ConstraintLayout> | ||
|
||
|
||
</LinearLayout> | ||
|
||
<Button | ||
android:id="@+id/continue_btn" | ||
style="@style/Button.Primary.Large.Blue" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:layout_margin="20dp" | ||
android:text="@string/button_continue" | ||
app:layout_constraintBottom_toBottomOf="parent" | ||
app:layout_constraintEnd_toEndOf="parent" | ||
app:layout_constraintStart_toStartOf="parent" /> | ||
|
||
|
||
</androidx.constraintlayout.widget.ConstraintLayout> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
wallet/src/de/schildbach/wallet/ui/onboarding/SelectSecurityLevelActivity.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
package de.schildbach.wallet.ui.onboarding | ||
|
||
import android.content.Intent | ||
import android.os.Bundle | ||
import de.schildbach.wallet_test.databinding.ActivityPhrasewordcountBinding | ||
import org.dash.wallet.common.SecureActivity | ||
|
||
class SelectSecurityLevelActivity : SecureActivity() { | ||
private lateinit var binding: ActivityPhrasewordcountBinding | ||
private var selectedWordCount: Int = 12 | ||
|
||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
binding = ActivityPhrasewordcountBinding.inflate(layoutInflater) | ||
setContentView(binding.root) | ||
|
||
binding.titleBar.setOnClickListener { | ||
setResult(RESULT_CANCELED) | ||
finish() | ||
} | ||
|
||
binding.twelveWordsOption.setOnClickListener { | ||
setMode(12) | ||
} | ||
|
||
binding.twentyFourWordsOption.setOnClickListener { | ||
setMode(24) | ||
} | ||
|
||
binding.continueBtn.setOnClickListener { | ||
setResult(RESULT_OK, Intent().apply { putExtra(EXTRA_WORD_COUNT, selectedWordCount) }) | ||
finish() | ||
} | ||
setMode(12) | ||
} | ||
|
||
private fun setMode(wordCount: Int) { | ||
if (wordCount == 12) { | ||
binding.twelveWordsOption.isSelected = true | ||
binding.twentyFourWordsOption.isSelected = false | ||
selectedWordCount = 12 | ||
} else { | ||
binding.twelveWordsOption.isSelected = false | ||
binding.twentyFourWordsOption.isSelected = true | ||
selectedWordCount = 24 | ||
} | ||
} | ||
|
||
companion object { | ||
const val EXTRA_WORD_COUNT = "extra_word_count" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters