1 |
|
package com.loopback.androidapps.saveapp; |
2 |
|
|
3 |
|
import android.content.Context; |
4 |
|
import android.util.Log; |
5 |
|
import android.view.LayoutInflater; |
6 |
|
import android.view.ViewGroup; |
7 |
|
import android.widget.LinearLayout; |
8 |
|
import android.widget.TextView; |
9 |
|
|
|
|
| 87% |
Uncovered Elements: 6 (46) |
Complexity: 7 |
Complexity Density: 0,21 |
|
10 |
|
public class OutlayListItem extends LinearLayout { |
11 |
|
|
12 |
|
private LinearLayout rootContainer; |
13 |
|
private TextView txtId, txtDate, txtTime, txtItem, txtPlace, txtCharge; |
14 |
|
private String date, charge, item, place, currencySymbol; |
15 |
|
|
16 |
|
public static SaveApp saveApp; |
17 |
|
|
|
|
| 86,7% |
Uncovered Elements: 6 (45) |
Complexity: 7 |
Complexity Density: 0,21 |
|
18 |
42
|
public OutlayListItem(Context _context, Outlay outlay, int position, boolean landscape) {... |
19 |
|
|
20 |
42
|
super(_context); |
21 |
42
|
Log.i("OLI", "Init..."); |
22 |
|
|
23 |
42
|
date = outlay.getDate(); |
24 |
42
|
item = String.valueOf(outlay.getItemDesc()); |
25 |
42
|
place = String.valueOf(outlay.getPlaceDesc()); |
26 |
42
|
charge = String.valueOf(outlay.getCharge()); |
27 |
42
|
currencySymbol = saveApp.getCurrencySymbol(); |
28 |
|
|
29 |
|
|
30 |
42
|
LayoutInflater inflater = (LayoutInflater) _context |
31 |
|
.getSystemService(Context.LAYOUT_INFLATER_SERVICE); |
32 |
42
|
if (landscape) |
33 |
0
|
rootContainer = (LinearLayout) inflater.inflate( |
34 |
|
R.layout.outlaylistitemland, |
35 |
|
(ViewGroup) findViewById(R.id.root_container)); |
36 |
|
else |
37 |
42
|
rootContainer = (LinearLayout) inflater.inflate( |
38 |
|
R.layout.outlaylistitem, |
39 |
|
(ViewGroup) findViewById(R.id.root_container)); |
40 |
|
|
41 |
|
|
42 |
42
|
txtId = (TextView) rootContainer.findViewById(R.id.ide); |
43 |
42
|
txtDate = (TextView) rootContainer.findViewById(R.id.date); |
44 |
42
|
txtTime = (TextView) rootContainer.findViewById(R.id.time); |
45 |
42
|
txtItem = (TextView) rootContainer.findViewById(R.id.item); |
46 |
42
|
txtPlace = (TextView) rootContainer.findViewById(R.id.place); |
47 |
42
|
txtCharge = (TextView) rootContainer.findViewById(R.id.charge); |
48 |
|
|
49 |
|
|
50 |
42
|
txtId.setTextColor(getResources().getColor(R.color.black)); |
51 |
42
|
txtDate.setTextColor(getResources().getColor(R.color.black)); |
52 |
42
|
txtTime.setTextColor(getResources().getColor(R.color.black)); |
53 |
42
|
txtItem.setTextColor(getResources().getColor(R.color.black)); |
54 |
42
|
txtPlace.setTextColor(getResources().getColor(R.color.black)); |
55 |
42
|
txtCharge.setTextColor(getResources().getColor(R.color.black)); |
56 |
42
|
if (Integer.valueOf(charge) > 0) |
57 |
30
|
txtCharge.setTextColor(getResources().getColor(R.color.green)); |
58 |
|
|
59 |
|
|
60 |
|
|
61 |
|
|
62 |
|
|
63 |
42
|
txtId.setText(String.valueOf(position)); |
64 |
42
|
txtDate.setText((date == null) ? "No data" : Utilities.printDate(date).substring(0, 10)); |
65 |
42
|
txtTime.setText((date == null) ? "No data" : date.substring(11, 16)); |
66 |
42
|
txtItem.setText((item == null) ? "No data" : item); |
67 |
42
|
txtPlace.setText((place == null) ? "No data" : place); |
68 |
42
|
txtCharge.setText(charge + currencySymbol); |
69 |
|
|
70 |
|
|
71 |
42
|
this.addView(rootContainer); |
72 |
42
|
Log.i("OLI", "Initiated"); |
73 |
|
|
74 |
|
} |
75 |
|
|
76 |
|
} |