Clover Coverage Report - AnCal Coverage Report
Coverage timestamp: gio dic 18 2014 12:18:42 EST
../../../../img/srcFileCovDistChart10.png 0% of files have more coverage
25   77   8   8,33
8   57   0,32   1,5
3     2,67  
2    
This report was generated with an evaluation server license. Purchase Clover or configure your license.
 
  SymbolButton       Line # 12 25 8 97,2% 0.9722222
  SymbolButton.symbol       Line # 19 0 0 - -1.0
 
No Tests
 
1   
2    package pl.magot.vetch.widgets;
3   
4   
5    import android.content.Context;
6    import android.graphics.Canvas;
7    import android.graphics.Paint;
8    import android.graphics.RectF;
9    import android.widget.Button;
10   
11   
 
12    public class SymbolButton extends Button
13    {
14    //fields
15    private static final int iColor = 0xffaaaaaa;
16    private static final int iColorActive = 0xff442200;
17   
18    //fields
 
19    public enum symbol { none, arrowLeft, arrowRight };
20   
21    //fields
22    private Paint pt = new Paint();
23    private RectF rect = new RectF();
24    private RectF rectDraw = new RectF();
25    private symbol symbolType = symbol.none;
26   
27    //methods
 
28  12 toggle public SymbolButton(Context context, symbol symbolType)
29    {
30  12 super(context);
31  12 this.symbolType = symbolType;
32    }
33   
 
34  123 toggle @Override
35    public void onDraw(Canvas canvas)
36    {
37  123 super.onDraw(canvas);
38   
39  123 pt.setAntiAlias(true);
40  123 pt.setStrokeCap(Paint.Cap.ROUND);
41   
42  123 rectDraw.set(0, 0, getWidth(), getHeight());
43  123 rectDraw.left += 6;
44  123 rectDraw.right -= 6;
45  123 rectDraw.top += 4;
46  123 rectDraw.bottom -= 8;
47   
48  123 if (symbolType != symbol.none)
49    {
50  123 pt.setStrokeWidth(5);
51   
52  123 pt.setColor(iColor);
53  123 if (this.isPressed() || this.isFocused())
54  30 pt.setColor(iColorActive);
55   
56  123 drawArrow(canvas);
57    }
58    }
59   
 
60  123 toggle private void drawArrow(Canvas canvas)
61    {
62  123 rect.set(rectDraw);
63  123 rect.inset(15, 5);
64  123 canvas.drawLine(rect.left, rect.centerY(), rect.right, rect.centerY(), pt);
65  123 if (symbolType == symbol.arrowRight)
66    {
67  70 canvas.drawLine(rect.right, rect.centerY(), rect.right - 6, rect.top, pt);
68  70 canvas.drawLine(rect.right, rect.centerY(), rect.right - 6, rect.bottom, pt);
69    }
70  123 if (symbolType == symbol.arrowLeft)
71    {
72  53 canvas.drawLine(rect.left, rect.centerY(), rect.left + 6, rect.top, pt);
73  53 canvas.drawLine(rect.left, rect.centerY(), rect.left + 6, rect.bottom, pt);
74    }
75    }
76   
77    }