Add transaction indicator
This commit is contained in:
parent
ffd103fad3
commit
4c65596718
@ -53,11 +53,11 @@ public class TradeListAdapter extends ArrayAdapter<Trade> {
|
||||
|
||||
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;
|
||||
|
@ -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);
|
||||
|
||||
return convertView;
|
||||
|
@ -1,107 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<com.daimajia.swipe.SwipeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="50dp"
|
||||
android:id="@+id/swipeLayout">
|
||||
<!-- Bottom View Start-->
|
||||
<LinearLayout
|
||||
android:id="@+id/bottom_wrapper"
|
||||
android:layout_width="100dp"
|
||||
android:weightSum="1"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="horizontal">
|
||||
<!--What you want to show-->
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/editTransactionLayout"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_weight="0.5"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="center"
|
||||
android:gravity="center"
|
||||
android:background="@color/green">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:background="@drawable/ic_edit_white_24dp"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/deleteTransactionLayout"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_weight="0.5"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="center"
|
||||
android:gravity="center"
|
||||
android:background="@color/red">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:background="@drawable/ic_delete_white_24dp"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
<!-- Bottom View End-->
|
||||
|
||||
<!-- Surface View Start -->
|
||||
<LinearLayout
|
||||
android:padding="5dp"
|
||||
android:background="#ffffff"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
<!--What you want to show in SurfaceView-->
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="0.5"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/amountPurchased"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="15dp"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/puchasedValue"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="10dp"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="0.5"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/purchaseDate"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="right"/>
|
||||
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
<!-- Surface View End -->
|
||||
</com.daimajia.swipe.SwipeLayout>
|
||||
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_height="@dimen/separationLineSize"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:background="@color/separationColor" />
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<com.daimajia.swipe.SwipeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="49dp"
|
||||
android:id="@+id/swipeLayout">
|
||||
<!-- Bottom View Start-->
|
||||
<LinearLayout
|
||||
android:id="@+id/bottom_wrapper"
|
||||
android:layout_width="100dp"
|
||||
android:weightSum="1"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="horizontal"
|
||||
android:baselineAligned="false">
|
||||
<!--What you want to show-->
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/editTransactionLayout"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_weight="0.5"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="center"
|
||||
android:gravity="center"
|
||||
android:background="@color/green">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:background="@drawable/ic_edit_white_24dp"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/deleteTransactionLayout"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_weight="0.5"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="center"
|
||||
android:gravity="center"
|
||||
android:background="@color/red">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:background="@drawable/ic_delete_white_24dp"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
<!-- Bottom View End-->
|
||||
|
||||
<!-- Surface View Start -->
|
||||
<LinearLayout
|
||||
android:padding="5dp"
|
||||
android:background="#ffffff"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
<!--What you want to show in SurfaceView-->
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="0.5"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/amountPurchased"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="15dp"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/puchasedValue"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="10dp"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="0.5"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/purchaseDate"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="right"/>
|
||||
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
<!-- Surface View End -->
|
||||
</com.daimajia.swipe.SwipeLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/separationLineSize"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:background="@color/separationColor" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
Loading…
Reference in New Issue
Block a user