-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSettingsActivity.java
More file actions
229 lines (186 loc) · 6.8 KB
/
Copy pathSettingsActivity.java
File metadata and controls
229 lines (186 loc) · 6.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
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
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
package com.org.proj;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.graphics.Color;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
public class SettingsActivity extends Activity{
Button faceBook,twitter,about,home,settingMode,settingDifficulty,settingMusic,sfx;
String Tag="hi";
Context context=this;
// int special,music,mode,difficulty;
int a,b,c,d;
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.settings_screen);
//final MediaPlayer buttonSound=MediaPlayer.create(this,R.raw.button_1);
// MediaPlayer mp=MediaPlayer.create(this,R.raw.iron_man);
// mp.start();
home=(Button)findViewById(R.id.homesetting);
home.setBackgroundColor(Color.TRANSPARENT);
home.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
// TODO Auto-generated method stub
// Log.d(Tag,"clicked");
Intent i=new Intent(SettingsActivity.this,HomeActivity.class);finish();
i.putExtra("mode1",a);
i.putExtra("music1",b);
i.putExtra("difficulty1",c);
i.putExtra("special1",d);
startActivity(i);
//buttonSound.start();
}
});
/* faceBook=(Button)findViewById(R.id.faceBookButton);
faceBook.setBackgroundColor(Color.TRANSPARENT);
faceBook.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
// TODO Auto-generated method stub
Log.d(Tag,"clicked");
Intent i=new Intent(Setting.this,MyFaceBook.class);
startActivity(i);
buttonSound.start();
}
});
twitter=(Button)findViewById(R.id.twitterButton);
twitter.setBackgroundColor(Color.TRANSPARENT);
twitter.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
// TODO Auto-generated method stub
Log.d(Tag,"clickedtwitter");
Intent i=new Intent(Setting.this,Twitter.class);
startActivity(i);
buttonSound.start();
}
});*/
//adding sound to button
/* about=(Button)findViewById(R.id.aboutButton);
about.setBackgroundColor(Color.TRANSPARENT);
about.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
// TODO Auto-generated method stub
Log.d(Tag,"aboutclicked");
Intent i=new Intent(Setting.this,About.class);
startActivity(i);
buttonSound.start();
}
});*/
settingMode=(Button)findViewById(R.id.settingone);
settingMode.setBackgroundColor(Color.TRANSPARENT);
settingMode.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
// TODO Auto-generated method stub
Log.d(Tag,"clicked");
switch(v.getId())
{
case R.id.settingone:
openFirstSetting();
break;
}
}
private void openFirstSetting() {
// TODO Auto-generated method stub
new AlertDialog.Builder(context).setTitle(R.string.setting_one).setItems(R.array.Mode,new DialogInterface.OnClickListener(){
public void onClick(DialogInterface dialoginterface,int mode){
startMode(mode);
}
})
.show();
}
private void startMode(int mode)
{
Log.d(Tag,"clicked on"+ mode);
a=mode;
Values.mode=a;
}
});
settingDifficulty=(Button)findViewById(R.id.settingthree);
settingDifficulty.setBackgroundColor(Color.TRANSPARENT);
settingDifficulty.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
// TODO Auto-generated method stub
Log.d(Tag,"clicked");
switch(v.getId()){
case R.id.settingthree:
openThirdSetting();
break;
}
}
private void openThirdSetting() {
// TODO Auto-generated method stub
new AlertDialog.Builder(context).setTitle(R.string.game_difficulty).setItems(R.array.difficulty,new DialogInterface.OnClickListener(){
public void onClick(DialogInterface dialoginterface,int difficulty){
startMode(difficulty);
}
})
.show();
}
private void startMode(int difficulty)
{
Log.d(Tag,"clicked on"+ difficulty);
c=difficulty;
Values.diff=c;
}
});
settingMusic=(Button)findViewById(R.id.settingtwo);
settingMusic.setBackgroundColor(Color.TRANSPARENT);
settingMusic.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
// TODO Auto-generated method stub
Log.d(Tag,"clicked");
switch(v.getId()){
case R.id.settingtwo:
openSecondSetting();
break;
}
}
private void openSecondSetting() {
// TODO Auto-generated method stub
new AlertDialog.Builder(context).setTitle(R.string.setting_two).setItems(R.array.music,new DialogInterface.OnClickListener(){
public void onClick(DialogInterface dialoginterface,int music){
startMode(music);
}
})
.show();
}
private void startMode(int music)
{
Log.d(Tag,"clicked on"+ music);
b=music;
}
});
sfx=(Button)findViewById(R.id.settingfour);
sfx.setBackgroundColor(Color.TRANSPARENT);
sfx.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
// TODO Auto-generated method stub
Log.d(Tag,"clicked");
switch(R.id.settingfour){
case R.id.settingfour:
openFourthSetting();
break;
}
}
private void openFourthSetting() {
// TODO Auto-generated method stub
new AlertDialog.Builder(context).setTitle(R.string.special_effects).setItems(R.array.special_effects,new DialogInterface.OnClickListener(){
public void onClick(DialogInterface dialoginterface,int special){
startMode(special);
}
})
.show();
}
private void startMode(int special)
{
Log.d(Tag,"clicked on"+ special);
d=special;
}
});
}
}