-I fix a bug: The loading icon was static after the registraron of the user. (I attached prove in telegram)

-Change “seed” text to “Backup brainkey”
-Add backup leyend
-Set icon for button ok
-Add button “Copy” to copy brainkey to clipboard
-Develope algoritm for copy to clipboard functionality
This commit is contained in:
dtvv 2018-07-31 13:18:13 -05:00
parent 09009e003c
commit 1cd36489eb
6 changed files with 166 additions and 53 deletions

View file

@ -6,6 +6,7 @@
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.NFC" />
<application
android:name=".application.CrystalApplication"
@ -60,6 +61,14 @@
android:name=".activities.SettingsActivity"
android:theme="@style/AppTheme.NoActionBar"
android:windowSoftInputMode="adjustPan">
<intent-filter>
<action android:name="android.nfc.action.NDEF_DISCOVERED"/>
<category android:name="android.intent.category.DEFAULT"/>
<data
android:scheme="https"
android:host="my.yubico.com"
android:pathPrefix="/neo"/>
</intent-filter>
</activity>
<activity
android:name=".activities.AccountsActivity"

View file

@ -3,11 +3,17 @@ package cy.agorise.crystalwallet.activities;
import android.arch.lifecycle.LiveData;
import android.arch.lifecycle.Observer;
import android.arch.lifecycle.ViewModelProviders;
import android.content.ClipData;
import android.content.ClipboardManager;
import android.content.Context;
import android.content.Intent;
import android.graphics.Point;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.view.Display;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import butterknife.BindView;
@ -21,15 +27,23 @@ public class BackupSeedActivity extends AppCompatActivity {
AccountSeedViewModel accountSeedViewModel;
@BindView(R.id.tvMnemonic)
TextView tvMnemonic;
@BindView(R.id.backup_seed_view_textview_brainkey)
TextView textfieldBrainkey;
@BindView(R.id.btnOk)
Button btnOk;
@BindView(R.id.backup_seed_view_button_copy)
Button btnCopy;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.backup_seed);
/* Note: Test porpouses
final TextView textView = findViewById(R.id.backup_seed_view_textview_brainkey);
textView.setText("sakk902909321o p3k21kldsa0'dsa90'e930eidakdñsakdñlsakdi90i03 2i90idopsasakk902909321op3k21 kldsa0'dsa90'e930eid akdñsakdñlsakdi90i032i90idopsa");
*/
ButterKnife.bind(this);
long seedId = getIntent().getLongExtra("SEED_ID",-1);
@ -41,7 +55,7 @@ public class BackupSeedActivity extends AppCompatActivity {
liveDataAccountSeed.observe(this, new Observer<AccountSeed>() {
@Override
public void onChanged(@Nullable AccountSeed accountSeed) {
tvMnemonic.setText(accountSeed.getMasterSeed());
textfieldBrainkey.setText(accountSeed.getMasterSeed());
}
});
accountSeedViewModel.loadSeed(seedId);
@ -56,4 +70,22 @@ public class BackupSeedActivity extends AppCompatActivity {
Intent intent = new Intent(this, IntroActivity.class);
startActivity(intent);
}
/*
* Clic on button copy to clipboard
* */
@OnClick(R.id.backup_seed_view_button_copy)
public void btnCopyClick(){
/*
* Save to clipboard the brainkey chain
* */
ClipboardManager clipboard = (ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE);
ClipData clip = ClipData.newPlainText(textfieldBrainkey.getText(), textfieldBrainkey.getText().toString());
clipboard.setPrimaryClip(clip);
/*
* Success message
* */
}
}

View file

@ -16,6 +16,7 @@ import butterknife.ButterKnife;
import butterknife.OnClick;
import butterknife.OnTextChanged;
import cy.agorise.crystalwallet.R;
import cy.agorise.crystalwallet.dialogs.ProgressCreatingAccountDialog;
import cy.agorise.crystalwallet.requestmanagers.CryptoNetInfoRequestListener;
import cy.agorise.crystalwallet.requestmanagers.CryptoNetInfoRequests;
import cy.agorise.crystalwallet.requestmanagers.ValidateCreateBitsharesAccountRequest;
@ -25,6 +26,35 @@ import cy.agorise.crystalwallet.viewmodels.validators.CreateSeedValidator;
import cy.agorise.crystalwallet.viewmodels.validators.UIValidatorListener;
import cy.agorise.crystalwallet.viewmodels.validators.validationfields.ValidationField;
/*
* Commented code backup
*
*
* alertBuilder.setTitle("Processing");
alertBuilder.setMessage("Creating Bitshares Account");
------
AlertDialog.Builder alertBuilder = new AlertDialog.Builder(CreateSeedActivity.this,R.style.AppTheme);
alertBuilder.setView(R.layout.progress_creating_account);
final AlertDialog processDialog = alertBuilder.create();
CreateSeedActivity.this.runOnUiThread(new Runnable() { //Run on UI Thread
@Override
public void run() {
processDialog.setCancelable(false);
processDialog.show();
processDialog.getWindow().setLayout(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
}
});
*/
public class CreateSeedActivity extends AppCompatActivity implements UIValidatorListener {
AccountSeedViewModel accountSeedViewModel;
@ -111,25 +141,20 @@ public class CreateSeedActivity extends AppCompatActivity implements UIValidator
new ValidateCreateBitsharesAccountRequest(tietAccountName.getText().toString(), getApplicationContext());
//DTVV: Friday 27 July 2018
//Makes dialog to tell the user that the account is been created
AlertDialog.Builder alertBuilder = new AlertDialog.Builder(CreateSeedActivity.this,R.style.AppTheme);
alertBuilder.setView(R.layout.progress_creating_account);
//alertBuilder.setTitle("Processing");
//alertBuilder.setMessage("Creating Bitshares Account");
final AlertDialog processDialog = alertBuilder.create();
final ProgressCreatingAccountDialog progressCreatingAccountDialog = new ProgressCreatingAccountDialog(CreateSeedActivity.this);
progressCreatingAccountDialog.show();
CreateSeedActivity.this.runOnUiThread(new Runnable() {
@Override
public void run() {
processDialog.setCancelable(false);
processDialog.show();
processDialog.getWindow().setLayout(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
progressCreatingAccountDialog.show();
}
});
request.setListener(new CryptoNetInfoRequestListener() {
@Override
public void onCarryOut() {
processDialog.dismiss();
progressCreatingAccountDialog.dismiss();
if (request.getStatus().equals(ValidateCreateBitsharesAccountRequest.StatusCode.SUCCEEDED)) {
GrapheneAccount accountSeed = request.getAccount();
Intent intent = new Intent(getApplicationContext(), BackupSeedActivity.class);

View file

@ -1,13 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<!--DTVV: Friday July 28 2018
Change android:repeatCount="0" to android:repeatCount="1000"
-->
<rotate xmlns:android="http://schemas.android.com/apk/res/android"
android:fromDegrees="0"
android:pivotX="50%"
android:pivotY="50%"
android:interpolator="@android:anim/accelerate_decelerate_interpolator"
android:duration="1000"
android:repeatCount="0"
android:repeatCount="1000"
android:toDegrees="360" />
</set>

View file

@ -1,52 +1,91 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="@color/white"
android:paddingBottom="0dp"
android:paddingLeft="0dp"
android:paddingRight="0dp"
android:paddingTop="@dimen/activity_vertical_margin">
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true">
<TextView
android:id="@+id/tvMnemonicTitle"
android:layout_width="match_parent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/activity_horizontal_margin"
android:layout_marginRight="@dimen/activity_horizontal_margin"
android:layout_marginTop="10dp"
android:text="@string/seed_words"
android:layout_marginBottom="20dp"
android:text="@string/window_seed_backup"
android:layout_centerHorizontal="true"
android:textSize="20dp"
android:textStyle="bold" />
<TextView
android:id="@+id/tvMnemonic"
android:layout_width="match_parent"
android:layout_height="40dp"
android:id="@+id/backup_seed_view_textview_brainkey"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/tvMnemonicTitle"
android:layout_marginLeft="@dimen/activity_horizontal_margin"
android:layout_marginRight="@dimen/activity_horizontal_margin"
android:gravity="center"
android:background="@drawable/edittext_bg"
android:inputType="number"
android:maxLines="1"
android:textColor="@color/black" />
android:layout_centerHorizontal="true"
android:textColor="@color/black"
android:layout_marginBottom="20dp"/>
<ImageView
android:id="@+id/backup_seeed_imageview_warning"
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_alignParentStart="true"
android:layout_marginLeft="35dp"
android:layout_alignTop="@+id/backup_seed_textview_leyend_backup"
android:background="@drawable/warning" />
<TextView
android:id="@+id/backup_seed_textview_leyend_backup"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="70dp"
android:textColor="@color/send_strong_orange"
android:layout_marginRight="70dp"
android:text="@string/window_seed_leyend_backup"
android:textSize="14dp"
android:layout_below="@+id/backup_seed_view_textview_brainkey"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/activity_horizontal_margin"
android:layout_marginRight="@dimen/activity_horizontal_margin"
android:layout_marginTop="10dp"
android:gravity="center"
android:orientation="horizontal">
android:layout_width="wrap_content"
android:layout_height="40dp"
android:layout_marginTop="20dp"
android:layout_below="@+id/backup_seed_textview_leyend_backup"
android:layout_centerHorizontal="true"
android:weightSum="2">
<Button
android:id="@+id/btnOk"
android:layout_width="wrap_content"
android:layout_weight="1"
android:layout_width="40dp"
android:layout_height="wrap_content"
android:background="@drawable/ok"/>
<Button
android:id="@+id/backup_seed_view_button_copy"
android:layout_width="80dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_gravity="center"
android:layout_margin="10dp"
android:background="@color/pink"
android:text="@string/ok"
android:textColor="@color/white" />
android:text="@string/window_seed_copy"
android:textColor="@color/black" />
</LinearLayout>
</LinearLayout>
</RelativeLayout>
</RelativeLayout>

View file

@ -33,6 +33,10 @@
<string name="account_label">Choose File</string>
<string name="loading_msg">Please wait until Balances are loading</string>
<string name="window_seed_backup">Backup brainkey</string>
<string name="window_seed_copy">Copy</string>
<string name="window_seed_leyend_backup">IMPORTANT: Print this out, or write it down. Anyone with access to your recovery key will have access to funds within this wallet</string>
<string name="seed_words">Seed</string>
<string name="txt_6_digits_pin">PIN (6+ digits)</string>
<string name="txt_6_digits_pin_confirm">PIN confirm</string>