Clover Coverage Report - HeartsSkyThread Coverage Report
Coverage timestamp: gio dic 18 2014 15:52:24 EST
../../../../img/srcFileCovDistChart0.png 76% of files have more coverage
32   131   22   3,2
14   95   0,69   10
10     2,2  
1    
This report was generated with an evaluation server license. Purchase Clover or configure your license.
 
  Gestures       Line # 10 32 22 0% 0.0
 
No Tests
 
1    package game.shad.tempus.hearts;
2   
3    import java.util.ArrayList;
4   
5    import android.graphics.Rect;
6    import android.view.GestureDetector;
7    import android.view.MotionEvent;
8    import android.widget.Toast;
9   
 
10    public class Gestures implements GestureDetector.OnGestureListener,
11    GestureDetector.OnDoubleTapListener
12    {
13   
14    private GameView gameView;
15    private static final int SWIPE_MIN_DISTANCE = 100;
16    private static final int SWIPE_MAX_OFF_PATH = 250;
17    private static final int SWIPE_THRESHOLD_VELOCITY = 200;
18   
19    private DeckHolder deckView = null;
20    private TableHolder tableView = null;
 
21  0 toggle public Gestures(GameView gameView)
22    {
23    //this.game = game;
24  0 this.gameView = gameView;
25  0 this.deckView = gameView.getDeckHolder();
26  0 this.tableView = gameView.getTableHolder();
27   
28    }
29   
 
30  0 toggle @Override
31    public boolean onDoubleTap(MotionEvent e)
32    {
33    //To select a card and send to pile
34  0 Toast.makeText(gameView.context, "Double Tap", Toast.LENGTH_SHORT).show();
35  0 return false;
36    }
37   
 
38  0 toggle @Override
39    public boolean onDoubleTapEvent(MotionEvent e)
40    {
41    // TODO Auto-generated method stub
42   
43  0 return false;
44    }
45   
 
46  0 toggle @Override
47    public boolean onSingleTapConfirmed(MotionEvent e)
48    {
49    //Add for buttons or info??
50  0 int x = (int) e.getX();
51  0 int y = (int) e.getY();
52  0 Rect bondsDV=deckView.getBounds();
53  0 Rect bondsTV=tableView.getBounds();
54   
55  0 if(bondsDV.contains(x, y)){
56  0 int y2=y-bondsDV.top;
57  0 Toast.makeText(gameView.context, "DeckView", Toast.LENGTH_SHORT).show();
58   
59  0 gameView.deckViewTouched(x, y2);
60    }
61  0 else if(bondsTV.contains(x, y)){
62  0 Toast.makeText(gameView.context, "TableView", Toast.LENGTH_SHORT).show();
63    }
64  0 return false;
65    }
66   
 
67  0 toggle @Override
68    public boolean onDown(MotionEvent e)
69    {
70    // TODO Auto-generated method stub
71  0 return false;
72    }
73   
 
74  0 toggle @Override
75    public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX,
76    float velocityY)
77    {
78    //to move through cards in hand (fix sensitvity in up and down)
79  0 try {
80  0 if (Math.abs(e1.getY() - e2.getY()) > SWIPE_MAX_OFF_PATH)
81  0 return false;
82    // right to left swipe
83  0 if(e1.getX() - e2.getX() > SWIPE_MIN_DISTANCE && Math.abs(velocityX) > SWIPE_THRESHOLD_VELOCITY) {
84    //Toast.makeText(game.getApplicationContext(), "Left Swipe", Toast.LENGTH_SHORT).show();
85  0 this.deckView.swipeLeft();
86  0 } else if (e2.getX() - e1.getX() > SWIPE_MIN_DISTANCE && Math.abs(velocityX) > SWIPE_THRESHOLD_VELOCITY) {
87    //Toast.makeText(game.getApplicationContext(), "Right Swipe", Toast.LENGTH_SHORT).show();
88  0 this.deckView.swipeRight();
89    }
90  0 else if(e1.getY() - e2.getY() > SWIPE_MIN_DISTANCE && Math.abs(velocityY) > SWIPE_THRESHOLD_VELOCITY) {
91  0 Toast.makeText(gameView.context, "Swipe up", Toast.LENGTH_SHORT).show();
92  0 } else if (e2.getY() - e1.getY() > SWIPE_MIN_DISTANCE && Math.abs(velocityY) > SWIPE_THRESHOLD_VELOCITY) {
93  0 Toast.makeText(gameView.context, "Swipe down", Toast.LENGTH_SHORT).show();
94    }
95    } catch (Exception e) {
96    // nothing
97    }
98   
99  0 return false;
100    }
101   
 
102  0 toggle @Override
103    public void onLongPress(MotionEvent e)
104    {
105    // TODO Auto-generated method stub
106   
107    }
108   
 
109  0 toggle @Override
110    public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX,
111    float distanceY)
112    {
113    // TODO Auto-generated method stub
114  0 return false;
115    }
116   
 
117  0 toggle @Override
118    public void onShowPress(MotionEvent e)
119    {
120    // TODO Auto-generated method stub
121   
122    }
123   
 
124  0 toggle @Override
125    public boolean onSingleTapUp(MotionEvent e)
126    {
127    // TODO Auto-generated method stub
128  0 return false;
129    }
130   
131    }