From 7084be469683a2076f86818805ef019df2beb336 Mon Sep 17 00:00:00 2001 From: Severiano Jaramillo Date: Thu, 21 Jun 2018 15:08:50 -0500 Subject: [PATCH] Improve transactions UI/UX --- app/build.gradle | 1 + .../views/TransactionViewHolder.java | 46 ++-- .../res/drawable/ic_arrow_forward_receive.xml | 10 + .../main/res/layout/transaction_list_item.xml | 218 +++++++++++++++++- app/src/main/res/values/colors.xml | 11 +- 5 files changed, 240 insertions(+), 46 deletions(-) create mode 100644 app/src/main/res/drawable/ic_arrow_forward_receive.xml diff --git a/app/build.gradle b/app/build.gradle index aab91fa..07cd688 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -47,6 +47,7 @@ dependencies { implementation 'com.android.support:appcompat-v7:27.1.1' implementation 'com.android.support:support-v4:27.1.1' implementation 'com.android.support:design:27.1.1' + implementation 'com.android.support:cardview-v7:27.1.1' implementation 'com.android.support.constraint:constraint-layout:1.1.2' implementation 'android.arch.lifecycle:runtime:1.1.1' implementation 'android.arch.lifecycle:extensions:1.1.1' diff --git a/app/src/main/java/cy/agorise/crystalwallet/views/TransactionViewHolder.java b/app/src/main/java/cy/agorise/crystalwallet/views/TransactionViewHolder.java index b4b134b..f4893ec 100644 --- a/app/src/main/java/cy/agorise/crystalwallet/views/TransactionViewHolder.java +++ b/app/src/main/java/cy/agorise/crystalwallet/views/TransactionViewHolder.java @@ -1,26 +1,20 @@ package cy.agorise.crystalwallet.views; -import android.arch.lifecycle.LifecycleOwner; import android.arch.lifecycle.LiveData; -import android.arch.lifecycle.Observer; import android.arch.lifecycle.ViewModelProviders; import android.content.Context; import android.content.Intent; -import android.support.annotation.Nullable; import android.support.v4.app.Fragment; import android.support.v7.widget.RecyclerView; import android.view.View; -import android.widget.RelativeLayout; import android.widget.TextView; import java.text.DateFormat; import java.text.SimpleDateFormat; -import java.time.LocalDateTime; import java.util.TimeZone; import cy.agorise.crystalwallet.R; import cy.agorise.crystalwallet.activities.CryptoCoinTransactionReceiptActivity; -import cy.agorise.crystalwallet.models.CryptoCoinTransaction; import cy.agorise.crystalwallet.models.CryptoCoinTransactionExtended; import cy.agorise.crystalwallet.models.CryptoCurrency; import cy.agorise.crystalwallet.models.CryptoNetAccount; @@ -47,10 +41,10 @@ public class TransactionViewHolder extends RecyclerView.ViewHolder { /* * The view holding the transaction amount */ - private TextView tvAmount; - private TextView tvEquivalent; - private TextView tvTransactionDate; - private TextView tvTransactionHour; + private TextView tvCryptoAmount; + private TextView tvFiatEquivalent; + private TextView tvDate; + private TextView tvTime; private View rootView; private Fragment fragment; @@ -62,13 +56,13 @@ public class TransactionViewHolder extends RecyclerView.ViewHolder { //TODO: use ButterKnife to load this this.cryptoCoinTransactionId = -1; - rootView = itemView.findViewById(R.id.rlTransactionItem); - tvFrom = (TextView) itemView.findViewById(R.id.fromText); - tvTo = (TextView) itemView.findViewById(R.id.toText); - tvAmount = (TextView) itemView.findViewById(R.id.tvAmount); - tvEquivalent = (TextView) itemView.findViewById(R.id.tvEquivalent); - tvTransactionDate = (TextView) itemView.findViewById(R.id.tvTransactionDate); - tvTransactionHour = (TextView) itemView.findViewById(R.id.tvTransactionHour); + rootView = itemView.findViewById(R.id.rootView); + tvFrom = itemView.findViewById(R.id.tvFrom); + tvTo = itemView.findViewById(R.id.tvTo); + tvDate = itemView.findViewById(R.id.tvDate); + tvTime = itemView.findViewById(R.id.tvTime); + tvCryptoAmount = itemView.findViewById(R.id.tvCryptoAmount); + tvFiatEquivalent = itemView.findViewById(R.id.tvFiatEquivalent); this.fragment = fragment; rootView.setOnClickListener(new View.OnClickListener() { @@ -104,10 +98,10 @@ public class TransactionViewHolder extends RecyclerView.ViewHolder { public void clear(){ tvFrom.setText("loading..."); tvTo.setText(""); - tvAmount.setText(""); - tvEquivalent.setText(""); - tvTransactionDate.setText(""); - tvTransactionHour.setText(""); + tvCryptoAmount.setText(""); + tvFiatEquivalent.setText(""); + tvDate.setText(""); + tvTime.setText(""); } /* @@ -140,8 +134,8 @@ public class TransactionViewHolder extends RecyclerView.ViewHolder { DateFormat hourFormat = new SimpleDateFormat("HH:mm:ss"); hourFormat.setTimeZone(userTimeZone); - tvTransactionDate.setText(dateFormat.format(transaction.getDate())); - tvTransactionHour.setText(hourFormat.format(transaction.getDate())); + tvDate.setText(dateFormat.format(transaction.getDate())); + tvTime.setText(hourFormat.format(transaction.getDate())); tvFrom.setText(transaction.getFrom()); tvTo.setText(transaction.getTo()); @@ -173,17 +167,17 @@ public class TransactionViewHolder extends RecyclerView.ViewHolder { String finalAmountText = ""; if (transaction.getInput()) { - tvAmount.setTextColor(itemView.getContext().getResources().getColor(R.color.green)); + tvCryptoAmount.setTextColor(itemView.getContext().getResources().getColor(R.color.green)); finalAmountText = "+ "+amountString + " " + cryptoCurrency.getName(); } else { - tvAmount.setTextColor(itemView.getContext().getResources().getColor(R.color.red)); + tvCryptoAmount.setTextColor(itemView.getContext().getResources().getColor(R.color.red)); finalAmountText = amountString + " " + cryptoCurrency.getName(); } - tvAmount.setText(finalAmountText); + tvCryptoAmount.setText(finalAmountText); //This will load the transaction receipt when the user clicks this view /*itemView.setOnClickListener(new View.OnClickListener() { @Override diff --git a/app/src/main/res/drawable/ic_arrow_forward_receive.xml b/app/src/main/res/drawable/ic_arrow_forward_receive.xml new file mode 100644 index 0000000..6a89bc6 --- /dev/null +++ b/app/src/main/res/drawable/ic_arrow_forward_receive.xml @@ -0,0 +1,10 @@ + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/transaction_list_item.xml b/app/src/main/res/layout/transaction_list_item.xml index 67aec33..5827993 100644 --- a/app/src/main/res/layout/transaction_list_item.xml +++ b/app/src/main/res/layout/transaction_list_item.xml @@ -1,4 +1,4 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml index 02ff5ff..351dff9 100644 --- a/app/src/main/res/values/colors.xml +++ b/app/src/main/res/values/colors.xml @@ -15,11 +15,8 @@ #147b00 #000000 - #BFD1FF - #f2f6ff #70882E #ff0000 - #FF4081 #DD4739 #FFFFFF @@ -29,12 +26,8 @@ #dddddd #ffffff - #669900 - #c5e1a5 - #DC473A - #ef9a9a - #BFE5F5 - #CCCCCC + #669900 + #DC473A #000000 #000000