1 |
|
|
2 |
|
package pl.magot.vetch.ancal.views; |
3 |
|
|
4 |
|
|
5 |
|
import android.content.Context; |
6 |
|
import android.graphics.Canvas; |
7 |
|
|
8 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (35) |
Complexity: 7 |
Complexity Density: 0,29 |
|
9 |
|
public class ViewTodayItemTask extends ViewTodayItem |
10 |
|
{ |
11 |
|
|
12 |
|
private boolean bDone = false; |
13 |
|
private boolean bAlarm = false; |
14 |
|
|
15 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
16 |
30
|
public ViewTodayItemTask(Context context)... |
17 |
|
{ |
18 |
30
|
super(context); |
19 |
|
} |
20 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0,33 |
|
21 |
30
|
public void SetItemData(boolean bDone, String sText, boolean bAlarm)... |
22 |
|
{ |
23 |
30
|
this.bDone = bDone; |
24 |
30
|
this.bAlarm = bAlarm; |
25 |
30
|
SetText(sText); |
26 |
|
} |
27 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (28) |
Complexity: 5 |
Complexity Density: 0,25 |
|
28 |
257
|
@Override... |
29 |
|
protected void onDraw(Canvas canvas) |
30 |
|
{ |
31 |
257
|
super.onDraw(canvas); |
32 |
|
|
33 |
|
|
34 |
257
|
final int iposX = ViewTodayItemHeader.GetTextPosX(); |
35 |
|
|
36 |
|
|
37 |
257
|
int iIconX = iposX; |
38 |
257
|
int iIconY = (this.getHeight() >> 1) - (iIconH >> 1); |
39 |
|
|
40 |
257
|
if (bDone) |
41 |
|
{ |
42 |
135
|
iconDone.setBounds(iIconX, iIconY, iIconX + iIconW, iIconY + iIconH); |
43 |
135
|
iconDone.draw(canvas); |
44 |
|
} else { |
45 |
122
|
iconUnDone.setBounds(iIconX, iIconY, iIconX + iIconW, iIconY + iIconH); |
46 |
122
|
iconUnDone.draw(canvas); |
47 |
|
} |
48 |
|
|
49 |
257
|
int iposY = iMargin - (int)mpt.ascent(); |
50 |
|
|
51 |
257
|
int iTextClipWidth = getWidth() - iSpace; |
52 |
257
|
if (bAlarm) |
53 |
174
|
iTextClipWidth -= iIconW; |
54 |
|
|
55 |
257
|
final int iTextPosX = iposX + iIconW + iSpace; |
56 |
|
|
57 |
257
|
mpt.setStrikeThruText(bDone); |
58 |
|
|
59 |
257
|
DrawItemText(canvas, iTextPosX, iposY, iTextClipWidth, bDone?iColorTextActive_disabled:iColorTextActive_enabled); |
60 |
|
|
61 |
|
|
62 |
257
|
if (bAlarm) |
63 |
|
{ |
64 |
174
|
iIconX = getWidth() - iIconW; |
65 |
174
|
iconAlarm.setBounds(iIconX, iIconY, iIconX + iIconW, iIconY + iIconH); |
66 |
174
|
iconAlarm.draw(canvas); |
67 |
|
} |
68 |
|
} |
69 |
|
} |