From 4c65596718deef503e8bfc5668ac7a0b1627ee56 Mon Sep 17 00:00:00 2001 From: Tanguy Herbron Date: Mon, 20 Aug 2018 18:12:35 +0200 Subject: [PATCH] Add transaction indicator --- .../CustomAdapters/TradeListAdapter.java | 4 +- .../TransactionListAdapter.java | 15 ++ .../res/layout/custom_transaction_row.xml | 211 ++++++++++-------- 3 files changed, 129 insertions(+), 101 deletions(-) diff --git a/app/src/main/java/com/herbron/moodl/CustomAdapters/TradeListAdapter.java b/app/src/main/java/com/herbron/moodl/CustomAdapters/TradeListAdapter.java index 93c56c1..dc84a75 100644 --- a/app/src/main/java/com/herbron/moodl/CustomAdapters/TradeListAdapter.java +++ b/app/src/main/java/com/herbron/moodl/CustomAdapters/TradeListAdapter.java @@ -53,11 +53,11 @@ public class TradeListAdapter extends ArrayAdapter { if(trade.isBuyer()) { - tradeIndicator.setBackgroundColor(context.getColor(R.color.green)); + tradeIndicator.setBackgroundColor(context.getResources().getColor(R.color.green)); } else { - tradeIndicator.setBackgroundColor(context.getColor(R.color.red)); + tradeIndicator.setBackgroundColor(context.getResources().getColor(R.color.red)); } return convertView; diff --git a/app/src/main/java/com/herbron/moodl/CustomAdapters/TransactionListAdapter.java b/app/src/main/java/com/herbron/moodl/CustomAdapters/TransactionListAdapter.java index df972de..b1864e3 100644 --- a/app/src/main/java/com/herbron/moodl/CustomAdapters/TransactionListAdapter.java +++ b/app/src/main/java/com/herbron/moodl/CustomAdapters/TransactionListAdapter.java @@ -88,6 +88,21 @@ public class TransactionListAdapter extends ArrayAdapter { } }); + View transactionIndicator = convertView.findViewById(R.id.transactionIndicator); + + switch (transaction.getType()) + { + case "b": + transactionIndicator.setBackgroundColor(context.getResources().getColor(R.color.increaseCandle)); + break; + case "s": + transactionIndicator.setBackgroundColor(context.getResources().getColor(R.color.decreaseCandle)); + break; + case "t": + transactionIndicator.setBackgroundColor(context.getResources().getColor(R.color.blue)); + break; + } + setupSwipeView(convertView); return convertView; diff --git a/app/src/main/res/layout/custom_transaction_row.xml b/app/src/main/res/layout/custom_transaction_row.xml index c2fd90e..7c96aaf 100644 --- a/app/src/main/res/layout/custom_transaction_row.xml +++ b/app/src/main/res/layout/custom_transaction_row.xml @@ -1,107 +1,120 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + android:layout_height="50dp" + android:orientation="horizontal"> + + + android:layout_height="match_parent" + android:orientation="vertical"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file