1 |
|
package game.shad.tempus.hearts; |
2 |
|
|
3 |
|
|
4 |
|
import game.shad.tempus.hearts.GameThread.State; |
5 |
|
import android.R.integer; |
6 |
|
import android.app.Activity; |
7 |
|
import android.content.Context; |
8 |
|
import android.content.Intent; |
9 |
|
import android.hardware.Sensor; |
10 |
|
import android.hardware.SensorManager; |
11 |
|
import android.media.AudioManager; |
12 |
|
import android.os.AsyncTask; |
13 |
|
import android.os.Bundle; |
14 |
|
import android.os.Handler; |
15 |
|
import android.os.PowerManager; |
16 |
|
import android.util.Log; |
17 |
|
import android.view.Display; |
18 |
|
import android.view.View; |
19 |
|
import android.widget.CheckBox; |
20 |
|
import android.widget.EditText; |
21 |
|
import android.widget.ProgressBar; |
22 |
|
import android.widget.RadioButton; |
23 |
|
import android.widget.TextView; |
24 |
|
import android.widget.Toast; |
25 |
|
import android.widget.ViewSwitcher; |
26 |
|
|
|
|
| 67,1% |
Uncovered Elements: 28 (85) |
Complexity: 14 |
Complexity Density: 0,23 |
|
27 |
|
public class MainMenu extends Activity{ |
28 |
|
public static final String TAG = "Hearts--Main"; |
29 |
|
|
30 |
|
EditText et; |
31 |
|
public Game game; |
32 |
|
public GameThread gt; |
33 |
|
public GameView gameView; |
34 |
|
public Handler handler; |
35 |
|
|
36 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0,25 |
|
37 |
1
|
public void onCreate(Bundle savedInstanceState) {... |
38 |
1
|
super.onCreate(savedInstanceState); |
39 |
1
|
setContentView(R.layout.main); |
40 |
|
|
41 |
1
|
et = (EditText) findViewById(R.id.playerName); |
42 |
1
|
et.setText("Your name"); |
43 |
|
|
44 |
|
} |
45 |
|
|
46 |
|
|
47 |
|
|
|
|
| 96% |
Uncovered Elements: 2 (50) |
Complexity: 7 |
Complexity Density: 0,18 |
|
48 |
8
|
public void onStartPressed(View v){... |
49 |
8
|
Intent gameIntent =new Intent(this, game.shad.tempus.hearts.MainActivity.class); |
50 |
8
|
Bundle gameBundle = new Bundle(); |
51 |
8
|
et = (EditText) findViewById(R.id.playerName); |
52 |
8
|
String s = et.getText().toString(); |
53 |
8
|
System.out.println(s); |
54 |
8
|
gameBundle.putString("name", s); |
55 |
8
|
gameBundle.putBoolean("restart", true); |
56 |
8
|
RadioButton easy = (RadioButton) findViewById(R.id.easy); |
57 |
8
|
RadioButton medium = (RadioButton) findViewById(R.id.medium); |
58 |
8
|
RadioButton hard = (RadioButton) findViewById(R.id.hard); |
59 |
|
|
60 |
8
|
if(easy.isChecked()){ |
61 |
1
|
gameBundle.putInt("diff", 1); |
62 |
|
} |
63 |
7
|
else if(medium.isChecked()){ |
64 |
1
|
gameBundle.putInt("diff", 2); |
65 |
|
} |
66 |
6
|
else if(hard.isChecked()){ |
67 |
6
|
gameBundle.putInt("diff", 3); |
68 |
|
} |
69 |
|
|
70 |
8
|
RadioButton shuffleDrop = (RadioButton) findViewById(R.id.dropShuffle); |
71 |
8
|
RadioButton shuffleSwap = (RadioButton) findViewById(R.id.randomSwap); |
72 |
8
|
RadioButton mixShuffle = (RadioButton) findViewById(R.id.mixShuffle); |
73 |
|
|
74 |
8
|
if(shuffleDrop.isChecked()){ |
75 |
3
|
gameBundle.putInt("shuffle", 1); |
76 |
|
} |
77 |
5
|
else if(shuffleSwap.isChecked()){ |
78 |
1
|
gameBundle.putInt("shuffle", 2); |
79 |
|
} |
80 |
4
|
else if(mixShuffle.isChecked()){ |
81 |
4
|
gameBundle.putInt("shuffle", 3); |
82 |
|
} |
83 |
8
|
CheckBox playerHelper = (CheckBox) findViewById(R.id.playerHelper); |
84 |
8
|
boolean ph = playerHelper.isChecked(); |
85 |
8
|
gameBundle.putBoolean("playerHelper", ph); |
86 |
8
|
CheckBox voidHelper = (CheckBox) findViewById(R.id.trackVoidsBox); |
87 |
8
|
boolean vh = voidHelper.isChecked(); |
88 |
8
|
gameBundle.putBoolean("voidHelper", vh); |
89 |
8
|
Display display = getWindowManager().getDefaultDisplay(); |
90 |
8
|
int width = display.getWidth(); |
91 |
8
|
int height = display.getHeight(); |
92 |
8
|
gameBundle.putInt("height", height); |
93 |
8
|
gameBundle.putInt("width", width); |
94 |
8
|
gameIntent.putExtras(gameBundle); |
95 |
8
|
startActivity(gameIntent); |
96 |
|
|
97 |
|
} |
98 |
|
|
99 |
|
|
100 |
|
|
101 |
|
|
102 |
|
|
103 |
|
|
104 |
|
|
105 |
|
|
106 |
|
|
107 |
|
|
108 |
|
|
109 |
|
|
110 |
|
|
111 |
|
|
112 |
|
|
113 |
|
|
114 |
|
|
115 |
|
|
116 |
|
|
117 |
|
|
118 |
|
|
119 |
|
|
120 |
|
|
121 |
|
|
122 |
|
|
123 |
|
|
124 |
|
|
125 |
|
|
126 |
|
|
127 |
|
|
128 |
|
|
129 |
|
|
130 |
|
|
131 |
|
|
132 |
|
|
133 |
|
|
134 |
|
|
135 |
|
|
136 |
|
|
137 |
|
|
138 |
|
|
139 |
|
|
140 |
|
|
141 |
|
|
142 |
|
|
143 |
|
|
144 |
|
|
145 |
|
|
146 |
|
|
147 |
|
|
148 |
|
|
149 |
|
|
150 |
|
|
151 |
|
|
152 |
|
|
153 |
|
|
154 |
|
|
155 |
|
|
|
|
| 0% |
Uncovered Elements: 25 (25) |
Complexity: 4 |
Complexity Density: 0,21 |
|
156 |
0
|
public void onResumePressed(View v){... |
157 |
0
|
Intent gameIntent =new Intent(this, game.shad.tempus.hearts.Game.class); |
158 |
0
|
et = (EditText) findViewById(R.id.playerName); |
159 |
0
|
String s = et.getText().toString(); |
160 |
0
|
System.out.println(s); |
161 |
0
|
gameIntent.putExtra("name", s); |
162 |
0
|
gameIntent.putExtra("restart", false); |
163 |
0
|
RadioButton easy = (RadioButton) findViewById(R.id.easy); |
164 |
0
|
RadioButton medium = (RadioButton) findViewById(R.id.medium); |
165 |
0
|
RadioButton hard = (RadioButton) findViewById(R.id.hard); |
166 |
0
|
if(easy.isChecked()){ |
167 |
0
|
gameIntent.putExtra("diff", 1); |
168 |
|
} |
169 |
0
|
else if(medium.isChecked()){ |
170 |
0
|
gameIntent.putExtra("diff", 2); |
171 |
|
} |
172 |
0
|
else if(hard.isChecked()){ |
173 |
0
|
gameIntent.putExtra("diff", 3); |
174 |
|
} |
175 |
|
|
176 |
|
|
177 |
0
|
CheckBox voidHelper = (CheckBox) findViewById(R.id.trackVoidsBox); |
178 |
0
|
boolean vh = voidHelper.isChecked(); |
179 |
0
|
gameIntent.putExtra("voidHelper", vh); |
180 |
0
|
startActivity(gameIntent); |
181 |
|
|
182 |
|
} |
183 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
184 |
1
|
public void textSelected(View v){... |
185 |
|
|
186 |
|
} |
187 |
|
|
188 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
189 |
2
|
public void todo(View v){... |
190 |
2
|
Toast.makeText(MainMenu.this, "Still in progress...", Toast.LENGTH_SHORT).show(); |
191 |
|
|
192 |
|
} |
193 |
|
|
194 |
|
|
195 |
|
} |