Add transaction indicator

This commit is contained in:
Tanguy Herbron 2018-08-20 18:12:35 +02:00
parent ffd103fad3
commit 4c65596718
3 changed files with 129 additions and 101 deletions

View File

@ -53,11 +53,11 @@ public class TradeListAdapter extends ArrayAdapter<Trade> {
if(trade.isBuyer()) if(trade.isBuyer())
{ {
tradeIndicator.setBackgroundColor(context.getColor(R.color.green)); tradeIndicator.setBackgroundColor(context.getResources().getColor(R.color.green));
} }
else else
{ {
tradeIndicator.setBackgroundColor(context.getColor(R.color.red)); tradeIndicator.setBackgroundColor(context.getResources().getColor(R.color.red));
} }
return convertView; return convertView;

View File

@ -88,6 +88,21 @@ public class TransactionListAdapter extends ArrayAdapter<Transaction> {
} }
}); });
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); setupSwipeView(convertView);
return convertView; return convertView;

View File

@ -1,12 +1,22 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="50dp"
android:orientation="horizontal">
<View
android:id="@+id/transactionIndicator"
android:layout_width="5dp"
android:layout_height="match_parent"/>
<LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:orientation="vertical"> android:orientation="vertical">
<com.daimajia.swipe.SwipeLayout xmlns:android="http://schemas.android.com/apk/res/android" <com.daimajia.swipe.SwipeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="50dp" android:layout_height="49dp"
android:id="@+id/swipeLayout"> android:id="@+id/swipeLayout">
<!-- Bottom View Start--> <!-- Bottom View Start-->
<LinearLayout <LinearLayout
@ -14,7 +24,8 @@
android:layout_width="100dp" android:layout_width="100dp"
android:weightSum="1" android:weightSum="1"
android:layout_height="match_parent" android:layout_height="match_parent"
android:orientation="horizontal"> android:orientation="horizontal"
android:baselineAligned="false">
<!--What you want to show--> <!--What you want to show-->
<LinearLayout <LinearLayout
@ -105,3 +116,5 @@
android:background="@color/separationColor" /> android:background="@color/separationColor" />
</LinearLayout> </LinearLayout>
</LinearLayout>