Skip to content
This repository was archived by the owner on Jun 27, 2020. It is now read-only.

Commit 1f900c4

Browse files
author
Evgeniy Kanivets
committed
Added colors and divider to report view
1 parent aca2b6d commit 1f900c4

File tree

2 files changed

+44
-23
lines changed

2 files changed

+44
-23
lines changed

app/src/main/java/com/blogspot/e_kanivets/moneytracker/adapter/ReportItemAdapter.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,13 @@ public View getView(int i, View view, ViewGroup viewGroup) {
4747
LayoutInflater layoutInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
4848
view = layoutInflater.inflate(R.layout.view_report_item, null);
4949

50+
//Customize view to fit to model and UI
51+
if(i == getCount()-1) {
52+
view.findViewById(R.id.line).setVisibility(View.VISIBLE);
53+
}
54+
view.setBackgroundColor(records.get(i).second < 0 ? context.getResources().getColor(R.color.white_red) :
55+
context.getResources().getColor(R.color.white_green));
56+
5057
TextView tvCategory = (TextView) view.findViewById(R.id.tv_category);
5158
TextView tvTotal = (TextView) view.findViewById(R.id.tv_total);
5259

Lines changed: 37 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,48 @@
11
<?xml version="1.0" encoding="utf-8"?>
22

33
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
4-
android:orientation="horizontal" android:layout_width="match_parent"
4+
android:orientation="vertical" android:layout_width="match_parent"
55
android:layout_height="wrap_content"
66
android:background="@color/trans">
77

8-
<TextView
8+
<View
9+
android:id="@+id/line"
910
android:layout_width="match_parent"
10-
android:layout_height="match_parent"
11-
android:text="Category"
12-
android:id="@+id/tv_category"
13-
android:textSize="18dp"
14-
android:layout_gravity="center"
15-
android:minWidth="5dp"
16-
android:layout_marginLeft="10dp"
17-
android:background="@color/trans"
18-
android:layout_weight="1"
19-
android:layout_margin="10dp"
20-
android:gravity="left" />
11+
android:layout_height="2dp"
12+
android:background="@color/black"
13+
android:visibility="gone" />
2114

22-
<TextView
15+
<LinearLayout
16+
android:orientation="horizontal"
2317
android:layout_width="match_parent"
24-
android:layout_height="wrap_content"
25-
android:text="Total"
26-
android:id="@+id/tv_total"
27-
android:textSize="18dp"
28-
android:layout_gravity="center_vertical"
29-
android:background="@color/trans"
30-
android:layout_weight="1"
31-
android:layout_margin="10dp"
32-
android:gravity="right" />
18+
android:layout_height="wrap_content">
19+
20+
<TextView
21+
android:layout_width="match_parent"
22+
android:layout_height="match_parent"
23+
android:text="Category"
24+
android:id="@+id/tv_category"
25+
android:textSize="18dp"
26+
android:layout_gravity="center"
27+
android:minWidth="5dp"
28+
android:layout_marginLeft="10dp"
29+
android:background="@color/trans"
30+
android:layout_weight="1"
31+
android:layout_margin="10dp"
32+
android:gravity="left" />
33+
34+
<TextView
35+
android:layout_width="match_parent"
36+
android:layout_height="wrap_content"
37+
android:text="New Text"
38+
android:id="@+id/tv_total"
39+
android:textSize="18dp"
40+
android:layout_gravity="center_vertical"
41+
android:background="@color/trans"
42+
android:layout_weight="1"
43+
android:layout_margin="10dp"
44+
android:gravity="right" />
45+
46+
</LinearLayout>
3347

3448
</LinearLayout>

0 commit comments

Comments
 (0)