Created CreateAccountFragment with its layout and the methods to show it when the user clicks the 'Create' button in the ImportBrainkeyFragment using Navigation AAC.

This commit is contained in:
Severiano Jaramillo 2019-01-05 15:23:42 -06:00
parent 0deecca8ed
commit 991967cd7d
8 changed files with 178 additions and 8 deletions

View file

@ -0,0 +1,26 @@
package cy.agorise.bitsybitshareswallet.fragments
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import cy.agorise.bitsybitshareswallet.R
import cy.agorise.graphenej.api.ConnectionStatusUpdate
import cy.agorise.graphenej.models.JsonRpcResponse
class CreateAccountFragment : ConnectedFragment() {
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
setHasOptionsMenu(true)
return inflater.inflate(R.layout.fragment_create_account, container, false)
}
override fun handleJsonRpcResponse(response: JsonRpcResponse<*>) {
// TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
}
override fun handleConnectionStatusUpdate(connectionStatusUpdate: ConnectionStatusUpdate) {
// TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
}
}

View file

@ -7,6 +7,7 @@ import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.appcompat.widget.Toolbar
import androidx.navigation.Navigation
import androidx.navigation.fragment.findNavController
import com.afollestad.materialdialogs.MaterialDialog
import com.afollestad.materialdialogs.list.listItemsSingleChoice
@ -97,6 +98,10 @@ class ImportBrainkeyFragment : ConnectedFragment() {
btnImport.isEnabled = false
btnImport.setOnClickListener { verifyBrainKey(false) }
btnCreate.setOnClickListener (
Navigation.createNavigateOnClickListener(R.id.create_account_action)
)
}
private fun validatePIN() {

View file

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@android:color/transparent"/>
<corners android:radius="4dp"/>
<stroke android:color="@color/colorAccent" android:width="1dp"/>
</shape>

View file

@ -0,0 +1,115 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin" xmlns:android="http://schemas.android.com/apk/res/android">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical">
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/tilAccountName"
style="@style/Widget.Bitsy.TextInputLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/text__bitshares_account_name">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/tietAccountName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="text"
android:digits="abcdefghijklmnopqrstuvwxyz0123456789-"
android:singleLine="true"/>
</com.google.android.material.textfield.TextInputLayout>
<!--<com.github.ybq.android.spinkit.SpinKitView-->
<!--android:id="@+id/spin_kit"-->
<!--android:layout_width="20dp"-->
<!--android:layout_height="20dp"-->
<!--android:layout_marginEnd="15dp"-->
<!--android:layout_alignParentEnd="true"-->
<!--android:layout_centerVertical="true"-->
<!--android:visibility="invisible"-->
<!--app:SpinKit_Color="@color/colorAccent"-->
<!--style="@style/SpinKitView.Small.ThreeBounce" />-->
</RelativeLayout>
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/tilPin"
style="@style/Widget.Bitsy.TextInputLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/spacing_same_topic"
android:hint="@string/text_field__6_digit_pin">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/tietPin"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="numberPassword"
android:singleLine="true"/>
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/tilPinConfirmation"
style="@style/Widget.Bitsy.TextInputLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/spacing_same_topic"
android:hint="@string/text_field__confirm_pin">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/tietPinConfirmation"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="numberPassword"
android:singleLine="true"/>
</com.google.android.material.textfield.TextInputLayout>
<TextView
android:id="@+id/brain_key"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/outline_rounded_corners"
android:gravity="center"
android:padding="8dp"
android:layout_marginTop="@dimen/spacing_different_topic"
tools:text="SAMPLE BRAINKEY SAMPLE BRAINKEY SAMPLE BRAINKEY SAMPLE BRAINKEY SAMPLE BRAINKEY SAMPLE BRAINKEY SAMPLE BRAINKEY"
android:textAppearance="@style/TextAppearance.Bitsy.Body1"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/msg__brainkey_info"
android:textAppearance="@style/TextAppearance.Bitsy.Body2"
android:gravity="center"
android:padding="8dp"/>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/spacing_different_topic">
<com.google.android.material.button.MaterialButton
android:id="@+id/btnCreate"
style="@style/Widget.Bitsy.Button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_marginBottom="4dp"
android:text="@string/button__create"/>
<com.google.android.material.button.MaterialButton
android:id="@+id/btnCancel"
style="@style/Widget.Bitsy.Button.TextButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="12dp"
android:layout_toStartOf="@id/btnCreate"
android:text="@android:string/cancel"/>
</RelativeLayout>
</LinearLayout>

View file

@ -95,7 +95,6 @@
android:layout_marginTop="@dimen/spacing_different_topic"
android:layout_marginStart="@dimen/activity_horizontal_margin"
android:layout_marginEnd="@dimen/activity_horizontal_margin"
android:text="@string/button__create"
android:enabled="false"/>
android:text="@string/button__create"/>
</LinearLayout>

View file

@ -83,7 +83,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/spacing_same_topic"
android:text="@string/btn__view_and_copy"/>
android:text="@string/button__view_and_copy"/>
<!-- Bugs or Ideas -->

View file

@ -100,7 +100,23 @@
android:id="@+id/import_brainkey_dest"
android:name="cy.agorise.bitsybitshareswallet.fragments.ImportBrainkeyFragment"
android:label="@string/app_name"
tools:layout="@layout/fragment_import_brainkey"/>
tools:layout="@layout/fragment_import_brainkey">
<action
android:id="@+id/create_account_action"
app:destination="@id/create_account_dest"
app:enterAnim="@anim/slide_in_right"
app:exitAnim="@anim/slide_out_left"
app:popEnterAnim="@anim/slide_in_left"
app:popExitAnim="@anim/slide_out_right"/>
</fragment>
<fragment
android:id="@+id/create_account_dest"
android:name="cy.agorise.bitsybitshareswallet.fragments.CreateAccountFragment"
android:label="@string/app_name"
tools:layout="@layout/fragment_create_account"/>
</navigation>

View file

@ -6,7 +6,7 @@
<string name="button__agree">Agree</string>
<string name="button__disagree">Disagree</string>
<!-- Import Brainkey Activity -->
<!-- Import Brainkey -->
<string name="text_field__6_digit_pin">6+ digits PIN</string>
<string name="error__pin_too_short">PIN too short</string>
<string name="text_field__confirm_pin">Confirm PIN</string>
@ -25,6 +25,9 @@
more than one account, please select which account you wish to import
</string>
<!-- Create Account -->
<string name="text__bitshares_account_name">BitShares account name</string>
<!-- Home -->
<string name="title_transactions">Transactions</string>
<string name="title_merchants">Merchants</string>
@ -93,10 +96,10 @@
<string name="msg__brainkey_description">BrainKey. Account recovery words that can be captured or copied, but not
edited.
</string>
<string name="msg__brainkey_info">Print this out, or write it down. Anyone with access to your recovery key will
have access to funds within this wallet.
<string name="msg__brainkey_info">Write this down! Be sure you have 2 copies of this BrainKey in 2 secure locations
in case of fire or loss. Security First! Anyone with access to your BrainKey can access the funds in your account!
</string>
<string name="btn__view_and_copy"><![CDATA[View & Copy]]></string>
<string name="button__view_and_copy"><![CDATA[View & Copy]]></string>
<string name="title__bugs_or_ideas">Bugs or Ideas?</string>
<string name="msg__bugs_or_ideas">Telegram chat: http://t.me/Agorise\nEmail: Agorise@protonmail.ch\nOpen Source:
https://github.com/Agorise