Clover Coverage Report - HeartsSkyThread Coverage Report
Coverage timestamp: gio dic 18 2014 15:52:24 EST
../../../../img/srcFileCovDistChart9.png 0% of files have more coverage
39   145   16   2,79
4   99   0,41   14
14     1,14  
1    
This report was generated with an evaluation server license. Purchase Clover or configure your license.
 
  TableHolder       Line # 14 39 16 82,5% 0.8245614
 
No Tests
 
1    package game.shad.tempus.hearts;
2   
3    import android.content.Context;
4    import android.graphics.Canvas;
5    import android.graphics.Rect;
6    import android.util.Log;
7    import android.view.MotionEvent;
8    import android.view.SurfaceHolder;
9    import android.view.SurfaceHolder.Callback;
10    import android.view.SurfaceView;
11    import android.view.View;
12    import android.view.View.OnTouchListener;
13   
 
14    public class TableHolder extends SurfaceView implements Callback, OnTouchListener{
15    public static final String TAG = "Hearts--TableHolder";
16   
17    private Deck deck;
18    private Card Card;
19    private int screenWidth;
20    private int screenHeight;
21    private int position=0;
22    private SurfaceHolder surfaceHolder;
23   
24    private Context mContext;
25    private GameView gameView;
26   
27    private boolean full=false;
28    public boolean initialized = false; //made true on surfaceCreated()
29   
30    //Holds players deck, class to call for updates about deck and drawing the deck
31   
 
32  8 toggle public TableHolder(Context context, GameView gameView, int sW, int sH){
33  8 super(context);
34  8 this.mContext=context;
35  8 this.gameView = gameView;
36   
37  8 surfaceHolder = this.getHolder();
38  8 surfaceHolder.addCallback(this);
39  8 this.screenWidth = sW;
40  8 this.screenHeight = sH;
41  8 this.deck = new Deck();
42   
43  8 addBlankCards();
44    }
45   
46   
47    //protected void onMeasure(int width, int height){
48    // setMeasuredDimension(measureWidth(width),measureHeight(height));
49    //}
50   
51   
 
52  0 toggle public Card getCard(int i){
53  0 return this.deck.getCard(i);
54    }
55   
 
56  0 toggle public void addDeck(Deck deck){
57  0 this.deck = deck;
58    }
59   
60   
 
61  49 toggle public void addCard(Card c){
62  49 Log.d(TAG, "CARD added to table, "+c.name);
63  49 this.deck.removeCardAtIndex(0);
64  49 this.deck.addCard(c);
65  49 postInvalidate();
66    }
 
67  8 toggle public void removeAll(){
68  8 this.deck.clearALL();
69    }
70   
 
71  16 toggle public void addBlankCards(){
72  16 this.deck.clearALL();
73  16 this.position=0;
74  16 int i = 0;
75  80 while(i < 4){
76  64 this.deck.addCard(new Card(0,0, mContext));
77  64 i++;
78    }
79   
80   
81    }
 
82  216 toggle @Override
83    protected void onDraw(Canvas canvas){
84    // Log.d(TAG, "painting, deck size= "+deck.getSize());
85  216 full=false;
86  216 int cardWidth=(screenWidth/4);
87  1078 for (int i=0;i<this.deck.getSize();i++){
88  862 Card c=this.deck.getCard(i);
89  862 c.resizeBitmap(cardWidth, screenHeight);
90  862 c.setCoords(cardWidth*(i), 0, cardWidth+cardWidth*(i), screenHeight);
91  862 c.draw(canvas);
92   
93    }
94    }
95   
96   
 
97  0 toggle public void updateDeck(Deck deck){
98  0 this.deck = deck;
99    }
100   
 
101  0 toggle public void updateCurrentCard(Card Card){
102  0 this.Card = Card;
103    }
104   
 
105  0 toggle public Rect getBounds() {
106  0 return new Rect(0, 0, this.screenWidth, this.screenHeight);
107   
108    }
109   
 
110  8 toggle @Override
111    public void surfaceChanged(SurfaceHolder holder, int format, int width,
112    int height) {
113    // TODO Auto-generated method stub
114   
115    }
116   
117   
 
118  8 toggle @Override
119    public void surfaceCreated(SurfaceHolder holder) {
120  8 Log.d(TAG, "surface Created");
121  8 initialized = true;
122  8 setOnTouchListener(this);
123   
124    // TODO Set height width here.
125   
126    }
127   
128   
 
129  8 toggle @Override
130    public void surfaceDestroyed(SurfaceHolder holder) {
131  8 Log.d(TAG, "surface Created");
132  8 initialized = false;
133    // TODO Set height width here.
134   
135    }
136   
 
137  9 toggle @Override
138    public boolean onTouch(View v, MotionEvent event) {
139  9 Log.d(TAG, "Touching at x="+event.getX()+", y="+event.getY());
140  9 return false;
141    }
142   
143   
144   
145    }