From 3df50a6836fc5025ac2defa3c9e10a6c9dc89692 Mon Sep 17 00:00:00 2001 From: Severiano Jaramillo Date: Tue, 5 Dec 2017 22:14:48 -0600 Subject: [PATCH] SendTransactionFragment animations and layout and small fixes --- .../activities/SendTransactionActivity.java | 18 +- .../fragments/SendTransactionFragment.java | 37 ++- app/src/main/res/drawable/ic_people.xml | 9 + app/src/main/res/drawable/ic_person_add.xml | 9 + .../drawable/send_transaction_top_view.xml | 9 + app/src/main/res/layout/board.xml | 2 +- app/src/main/res/layout/send_transaction.xml | 255 ++++++++++++------ app/src/main/res/values/strings.xml | 2 + 8 files changed, 236 insertions(+), 105 deletions(-) create mode 100644 app/src/main/res/drawable/ic_people.xml create mode 100644 app/src/main/res/drawable/ic_person_add.xml create mode 100644 app/src/main/res/drawable/send_transaction_top_view.xml diff --git a/app/src/main/java/cy/agorise/crystalwallet/activities/SendTransactionActivity.java b/app/src/main/java/cy/agorise/crystalwallet/activities/SendTransactionActivity.java index e2d7c9f..c2f6aec 100644 --- a/app/src/main/java/cy/agorise/crystalwallet/activities/SendTransactionActivity.java +++ b/app/src/main/java/cy/agorise/crystalwallet/activities/SendTransactionActivity.java @@ -44,8 +44,8 @@ public class SendTransactionActivity extends AppCompatActivity implements UIVali SendTransactionValidator sendTransactionValidator; - @BindView(R.id.etFrom) - EditText etFrom; + /*@BindView(R.id.etFrom) + EditText etFrom;*/ @BindView(R.id.tvFromError) TextView tvFromError; @BindView(R.id.etTo) @@ -111,18 +111,18 @@ public class SendTransactionActivity extends AppCompatActivity implements UIVali } }); - sendTransactionValidator = new SendTransactionValidator(this.getApplicationContext(), this.cryptoNetAccount, etFrom, etTo, spAsset, etAmount, etMemo); + //sendTransactionValidator = new SendTransactionValidator(this.getApplicationContext(), this.cryptoNetAccount, etFrom, etTo, spAsset, etAmount, etMemo); sendTransactionValidator.setListener(this); } else { this.finish(); } } - @OnTextChanged(value = R.id.etFrom, + /*@OnTextChanged(value = R.id.etFrom, callback = OnTextChanged.Callback.AFTER_TEXT_CHANGED) void afterFromChanged(Editable editable) { this.sendTransactionValidator.validate(); - } + }*/ @OnTextChanged(value = R.id.etTo, callback = OnTextChanged.Callback.AFTER_TEXT_CHANGED) @@ -177,9 +177,9 @@ public class SendTransactionActivity extends AppCompatActivity implements UIVali activity.runOnUiThread(new Runnable() { public void run() { - if (field.getView() == etFrom) { + /*if (field.getView() == etFrom) { tvFromError.setText(""); - } else if (field.getView() == etTo){ + } else*/ if (field.getView() == etTo){ tvToError.setText(""); } else if (field.getView() == etAmount){ tvAmountError.setText(""); @@ -201,9 +201,9 @@ public class SendTransactionActivity extends AppCompatActivity implements UIVali @Override public void onValidationFailed(ValidationField field) { - if (field.getView() == etFrom) { + /*if (field.getView() == etFrom) { tvFromError.setText(field.getMessage()); - } else if (field.getView() == etTo){ + } else*/ if (field.getView() == etTo){ tvToError.setText(field.getMessage()); } else if (field.getView() == spAsset){ tvAssetError.setText(field.getMessage()); diff --git a/app/src/main/java/cy/agorise/crystalwallet/fragments/SendTransactionFragment.java b/app/src/main/java/cy/agorise/crystalwallet/fragments/SendTransactionFragment.java index 503e05f..693628c 100644 --- a/app/src/main/java/cy/agorise/crystalwallet/fragments/SendTransactionFragment.java +++ b/app/src/main/java/cy/agorise/crystalwallet/fragments/SendTransactionFragment.java @@ -44,8 +44,8 @@ public class SendTransactionFragment extends DialogFragment implements UIValidat SendTransactionValidator sendTransactionValidator; - @BindView(R.id.etFrom) - EditText etFrom; + @BindView(R.id.spFrom) + Spinner spFrom; @BindView(R.id.tvFromError) TextView tvFromError; @BindView(R.id.etTo) @@ -66,8 +66,8 @@ public class SendTransactionFragment extends DialogFragment implements UIValidat TextView tvMemoError; //@BindView(R.id.btnSend) Button btnSend; - //@BindView(R.id.btnCancel) - Button btnCancel; + @BindView(R.id.btnCancel) + TextView btnCancel; private long cryptoNetAccountId; private CryptoNetAccount cryptoNetAccount; @@ -94,7 +94,7 @@ public class SendTransactionFragment extends DialogFragment implements UIValidat @Override public Dialog onCreateDialog(Bundle savedInstanceState) { AlertDialog.Builder builder = new AlertDialog.Builder(getActivity(), R.style.SendTransactionTheme); - builder.setTitle("Send"); + //builder.setTitle("Send"); LayoutInflater inflater = getActivity().getLayoutInflater(); View view = inflater.inflate(R.layout.send_transaction, null); @@ -127,15 +127,15 @@ public class SendTransactionFragment extends DialogFragment implements UIValidat spAsset.setAdapter(assetAdapter); } }); - - sendTransactionValidator = new SendTransactionValidator(this.getContext(), this.cryptoNetAccount, etFrom, etTo, spAsset, etAmount, etMemo); + // TODO SendTransactionValidator to accept spFrom + //sendTransactionValidator = new SendTransactionValidator(this.getContext(), this.cryptoNetAccount, spFrom, etTo, spAsset, etAmount, etMemo); sendTransactionValidator.setListener(this); - etFrom.setText(this.grapheneAccount.getName()); + // etFrom.setText(this.grapheneAccount.getName()); } builder.setView(view); - builder.setPositiveButton("Send", new DialogInterface.OnClickListener() { + /*builder.setPositiveButton("Send", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { sendTransaction(); @@ -146,7 +146,7 @@ public class SendTransactionFragment extends DialogFragment implements UIValidat public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } - }); + });*/ AlertDialog dialog = builder.create(); @@ -202,9 +202,8 @@ public class SendTransactionFragment extends DialogFragment implements UIValidat return view; }*/ - @OnTextChanged(value = R.id.etFrom, - callback = OnTextChanged.Callback.AFTER_TEXT_CHANGED) - void afterFromChanged(Editable editable) { + @OnItemSelected(R.id.spFrom) + public void afterFromSelected(Spinner spinner, int position) { this.sendTransactionValidator.validate(); } @@ -232,10 +231,10 @@ public class SendTransactionFragment extends DialogFragment implements UIValidat this.sendTransactionValidator.validate(); } - //@OnClick(R.id.btnCancel) - //public void cancel(){ - // this.finish(); - //} + @OnClick(R.id.btnCancel) + public void cancel(){ + this.dismiss(); + } //@OnClick(R.id.btnSend) public void sendTransaction(){ @@ -259,7 +258,7 @@ public class SendTransactionFragment extends DialogFragment implements UIValidat final SendTransactionFragment fragment = this; - if (field.getView() == etFrom) { + if (field.getView() == spFrom) { tvFromError.setText(""); } else if (field.getView() == etTo){ tvToError.setText(""); @@ -282,7 +281,7 @@ public class SendTransactionFragment extends DialogFragment implements UIValidat @Override public void onValidationFailed(ValidationField field) { - if (field.getView() == etFrom) { + if (field.getView() == spFrom) { tvFromError.setText(field.getMessage()); } else if (field.getView() == etTo){ tvToError.setText(field.getMessage()); diff --git a/app/src/main/res/drawable/ic_people.xml b/app/src/main/res/drawable/ic_people.xml new file mode 100644 index 0000000..4cdb005 --- /dev/null +++ b/app/src/main/res/drawable/ic_people.xml @@ -0,0 +1,9 @@ + + + diff --git a/app/src/main/res/drawable/ic_person_add.xml b/app/src/main/res/drawable/ic_person_add.xml new file mode 100644 index 0000000..e8c63ed --- /dev/null +++ b/app/src/main/res/drawable/ic_person_add.xml @@ -0,0 +1,9 @@ + + + diff --git a/app/src/main/res/drawable/send_transaction_top_view.xml b/app/src/main/res/drawable/send_transaction_top_view.xml new file mode 100644 index 0000000..6af3667 --- /dev/null +++ b/app/src/main/res/drawable/send_transaction_top_view.xml @@ -0,0 +1,9 @@ + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/board.xml b/app/src/main/res/layout/board.xml index f0032e1..19248c0 100644 --- a/app/src/main/res/layout/board.xml +++ b/app/src/main/res/layout/board.xml @@ -98,7 +98,7 @@ android:layout_gravity="end|bottom" android:layout_margin="@dimen/fab_margin" app:backgroundTint="@color/colorPrimaryDark" - app:srcCompat="@drawable/add_contact_fab" /> + app:srcCompat="@drawable/ic_person_add" /> diff --git a/app/src/main/res/layout/send_transaction.xml b/app/src/main/res/layout/send_transaction.xml index 539c465..4b7b631 100644 --- a/app/src/main/res/layout/send_transaction.xml +++ b/app/src/main/res/layout/send_transaction.xml @@ -1,105 +1,208 @@ - + android:layout_height="wrap_content" + android:minWidth="350dp"> + + - - - + android:layout_marginStart="24dp" + android:layout_marginTop="24dp" + android:text="Send Assets" + android:textColor="@color/white" + android:textSize="20sp" + android:textStyle="bold" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" /> + + + + + + + + android:textColor="@color/white" + android:textSize="20sp" + android:hint="@string/to_capital" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/gravatar" /> + + + - - - - + android:textColor="@color/red" + app:layout_constraintEnd_toEndOf="@+id/etTo" + app:layout_constraintStart_toStartOf="@+id/etTo" + app:layout_constraintTop_toBottomOf="@+id/etTo" /> + + + + + + android:textColor="@color/white" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintTop_toTopOf="@+id/etAmount" /> + - + android:textColor="@color/red" + app:layout_constraintBottom_toBottomOf="@+id/tvAmountError" + app:layout_constraintEnd_toEndOf="@+id/spAsset" + app:layout_constraintStart_toStartOf="@+id/spAsset" /> + + android:textColor="@color/white" + android:hint="@string/memo_capital" + android:textSize="20sp" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/tvAmountError" /> + - - \ No newline at end of file + android:layout_marginBottom="24dp" + android:layout_marginEnd="24dp" + android:text="@string/cancel_capital" + android:textSize="18sp" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toEndOf="parent" /> + + \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 4e91a18..d578600 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -452,4 +452,6 @@ Hello blank fragment + Scan a QR or NFC signal + CANCEL