author | Xeli |
Sun, 21 Aug 2011 19:40:01 +0200 | |
branch | hedgeroid |
changeset 5627 | ce2d92589cbc |
parent 5621 | ea796c83ea47 |
permissions | -rw-r--r-- |
5621 | 1 |
/* |
2 |
* Hedgewars for Android. An Android port of Hedgewars, a free turn based strategy game |
|
3 |
* Copyright (c) 2011 Richard Deurwaarder <xeli@xelification.com> |
|
4 |
* |
|
5 |
* This program is free software; you can redistribute it and/or modify |
|
6 |
* it under the terms of the GNU General Public License as published by |
|
7 |
* the Free Software Foundation; version 2 of the License |
|
8 |
* |
|
9 |
* This program is distributed in the hope that it will be useful, |
|
10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 |
* GNU General Public License for more details. |
|
13 |
* |
|
14 |
* You should have received a copy of the GNU General Public License |
|
15 |
* along with this program; if not, write to the Free Software |
|
16 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA |
|
17 |
*/ |
|
18 |
||
19 |
||
5467
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
20 |
package org.hedgewars.mobile; |
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
21 |
|
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
22 |
import java.io.File; |
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
23 |
import java.io.FileNotFoundException; |
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
24 |
import java.io.FileOutputStream; |
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
25 |
import java.io.IOException; |
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
26 |
import java.util.ArrayList; |
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
27 |
import java.util.HashMap; |
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
28 |
|
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
29 |
import org.hedgewars.mobile.EngineProtocol.FrontendDataUtils; |
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
30 |
import org.hedgewars.mobile.EngineProtocol.Team; |
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
31 |
|
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
32 |
import android.app.Activity; |
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
33 |
import android.graphics.Bitmap; |
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
34 |
import android.graphics.drawable.Drawable; |
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
35 |
import android.media.MediaPlayer; |
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
36 |
import android.os.Bundle; |
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
37 |
import android.view.View; |
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
38 |
import android.view.View.OnClickListener; |
5542
141c12a23787
start of implementation of the save button, check if there's something to save and update TeamSelectionActivity if a change has been made
Xeli
parents:
5467
diff
changeset
|
39 |
import android.view.View.OnFocusChangeListener; |
5467
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
40 |
import android.widget.AdapterView; |
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
41 |
import android.widget.AdapterView.OnItemSelectedListener; |
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
42 |
import android.widget.ArrayAdapter; |
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
43 |
import android.widget.EditText; |
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
44 |
import android.widget.ImageButton; |
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
45 |
import android.widget.ImageView; |
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
46 |
import android.widget.LinearLayout; |
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
47 |
import android.widget.RelativeLayout; |
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
48 |
import android.widget.ScrollView; |
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
49 |
import android.widget.SimpleAdapter; |
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
50 |
import android.widget.Spinner; |
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
51 |
import android.widget.TextView; |
5613 | 52 |
import android.widget.Toast; |
5467
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
53 |
|
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
54 |
public class TeamCreatorActivity extends Activity { |
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
55 |
|
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
56 |
private TextView name; |
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
57 |
private Spinner difficulty, grave, flag, voice, fort; |
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
58 |
private ImageView imgFort; |
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
59 |
private ArrayList<ImageButton> hogDice = new ArrayList<ImageButton>(); |
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
60 |
private ArrayList<Spinner> hogHat = new ArrayList<Spinner>(); |
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
61 |
private ArrayList<EditText> hogName = new ArrayList<EditText>(); |
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
62 |
private ImageButton back, save, voiceButton; |
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
63 |
private ScrollView scroller; |
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
64 |
private MediaPlayer mp = null; |
5542
141c12a23787
start of implementation of the save button, check if there's something to save and update TeamSelectionActivity if a change has been made
Xeli
parents:
5467
diff
changeset
|
65 |
private boolean settingsChanged = false; |
141c12a23787
start of implementation of the save button, check if there's something to save and update TeamSelectionActivity if a change has been made
Xeli
parents:
5467
diff
changeset
|
66 |
private boolean saved = false; |
5467
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
67 |
|
5613 | 68 |
public void onCreate(Bundle savedInstanceState) { |
5467
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
69 |
super.onCreate(savedInstanceState); |
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
70 |
setContentView(R.layout.team_creation); |
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
71 |
|
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
72 |
name = (TextView) findViewById(R.id.txtName); |
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
73 |
difficulty = (Spinner) findViewById(R.id.spinType); |
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
74 |
grave = (Spinner) findViewById(R.id.spinGrave); |
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
75 |
flag = (Spinner) findViewById(R.id.spinFlag); |
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
76 |
voice = (Spinner) findViewById(R.id.spinVoice); |
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
77 |
fort = (Spinner) findViewById(R.id.spinFort); |
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
78 |
|
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
79 |
imgFort = (ImageView) findViewById(R.id.imgFort); |
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
80 |
|
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
81 |
back = (ImageButton) findViewById(R.id.btnBack); |
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
82 |
save = (ImageButton) findViewById(R.id.btnSave); |
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
83 |
voiceButton = (ImageButton) findViewById(R.id.btnPlay); |
5542
141c12a23787
start of implementation of the save button, check if there's something to save and update TeamSelectionActivity if a change has been made
Xeli
parents:
5467
diff
changeset
|
84 |
|
5467
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
85 |
scroller = (ScrollView) findViewById(R.id.scroller); |
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
86 |
|
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
87 |
save.setOnClickListener(saveClicker); |
5542
141c12a23787
start of implementation of the save button, check if there's something to save and update TeamSelectionActivity if a change has been made
Xeli
parents:
5467
diff
changeset
|
88 |
back.setOnClickListener(backClicker); |
141c12a23787
start of implementation of the save button, check if there's something to save and update TeamSelectionActivity if a change has been made
Xeli
parents:
5467
diff
changeset
|
89 |
|
5467
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
90 |
LinearLayout ll = (LinearLayout) findViewById(R.id.HogsContainer); |
5613 | 91 |
for (int i = 0; i < ll.getChildCount(); i++) { |
92 |
RelativeLayout team_creation_entry = (RelativeLayout) ll |
|
93 |
.getChildAt(i); |
|
5542
141c12a23787
start of implementation of the save button, check if there's something to save and update TeamSelectionActivity if a change has been made
Xeli
parents:
5467
diff
changeset
|
94 |
|
5613 | 95 |
hogHat.add((Spinner) team_creation_entry |
96 |
.findViewById(R.id.spinTeam1)); |
|
97 |
hogDice.add((ImageButton) team_creation_entry |
|
98 |
.findViewById(R.id.btnTeam1)); |
|
99 |
hogName.add((EditText) team_creation_entry |
|
100 |
.findViewById(R.id.txtTeam1)); |
|
5467
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
101 |
} |
5613 | 102 |
ArrayList<HashMap<String, ?>> gravesData = FrontendDataUtils |
103 |
.getGraves(this); |
|
104 |
SimpleAdapter sa = new SimpleAdapter(this, gravesData, |
|
105 |
R.layout.spinner_textimg_entry, new String[] { "txt", "img" }, |
|
106 |
new int[] { R.id.spinner_txt, R.id.spinner_img }); |
|
107 |
||
5467
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
108 |
sa.setViewBinder(viewBinder); |
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
109 |
grave.setAdapter(sa); |
5542
141c12a23787
start of implementation of the save button, check if there's something to save and update TeamSelectionActivity if a change has been made
Xeli
parents:
5467
diff
changeset
|
110 |
grave.setOnFocusChangeListener(focusser); |
5467
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
111 |
|
5613 | 112 |
ArrayList<HashMap<String, ?>> flagsData = FrontendDataUtils |
113 |
.getFlags(this); |
|
114 |
sa = new SimpleAdapter(this, flagsData, R.layout.spinner_textimg_entry, |
|
115 |
new String[] { "txt", "img" }, new int[] { R.id.spinner_txt, |
|
116 |
R.id.spinner_img }); |
|
5467
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
117 |
sa.setViewBinder(viewBinder); |
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
118 |
flag.setAdapter(sa); |
5542
141c12a23787
start of implementation of the save button, check if there's something to save and update TeamSelectionActivity if a change has been made
Xeli
parents:
5467
diff
changeset
|
119 |
flag.setOnFocusChangeListener(focusser); |
141c12a23787
start of implementation of the save button, check if there's something to save and update TeamSelectionActivity if a change has been made
Xeli
parents:
5467
diff
changeset
|
120 |
|
5613 | 121 |
ArrayList<HashMap<String, ?>> typesData = FrontendDataUtils |
122 |
.getTypes(this); |
|
123 |
sa = new SimpleAdapter(this, typesData, R.layout.spinner_textimg_entry, |
|
124 |
new String[] { "txt", "img" }, new int[] { R.id.spinner_txt, |
|
125 |
R.id.spinner_img }); |
|
5467
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
126 |
difficulty.setAdapter(sa); |
5542
141c12a23787
start of implementation of the save button, check if there's something to save and update TeamSelectionActivity if a change has been made
Xeli
parents:
5467
diff
changeset
|
127 |
difficulty.setOnFocusChangeListener(focusser); |
5613 | 128 |
|
129 |
ArrayList<HashMap<String, ?>> hatsData = FrontendDataUtils |
|
130 |
.getHats(this); |
|
131 |
sa = new SimpleAdapter(this, hatsData, R.layout.spinner_textimg_entry, |
|
132 |
new String[] { "txt", "img" }, new int[] { R.id.spinner_txt, |
|
133 |
R.id.spinner_img }); |
|
5467
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
134 |
sa.setViewBinder(viewBinder); |
5613 | 135 |
for (Spinner spin : hogHat) { |
5467
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
136 |
spin.setAdapter(sa); |
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
137 |
} |
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
138 |
|
5613 | 139 |
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, |
140 |
R.layout.listview_item, FrontendDataUtils.getVoices(this)); |
|
5467
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
141 |
voice.setAdapter(adapter); |
5542
141c12a23787
start of implementation of the save button, check if there's something to save and update TeamSelectionActivity if a change has been made
Xeli
parents:
5467
diff
changeset
|
142 |
voice.setOnFocusChangeListener(focusser); |
5467
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
143 |
voiceButton.setOnClickListener(voiceClicker); |
5542
141c12a23787
start of implementation of the save button, check if there's something to save and update TeamSelectionActivity if a change has been made
Xeli
parents:
5467
diff
changeset
|
144 |
|
5613 | 145 |
adapter = new ArrayAdapter<String>(this, R.layout.listview_item, |
146 |
FrontendDataUtils.getForts(this)); |
|
5467
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
147 |
fort.setAdapter(adapter); |
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
148 |
fort.setOnItemSelectedListener(fortSelector); |
5542
141c12a23787
start of implementation of the save button, check if there's something to save and update TeamSelectionActivity if a change has been made
Xeli
parents:
5467
diff
changeset
|
149 |
fort.setOnFocusChangeListener(focusser); |
141c12a23787
start of implementation of the save button, check if there's something to save and update TeamSelectionActivity if a change has been made
Xeli
parents:
5467
diff
changeset
|
150 |
|
5467
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
151 |
Team t = this.getIntent().getParcelableExtra("team"); |
5613 | 152 |
if (t != null) { |
5467
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
153 |
name.setText(t.name); |
5613 | 154 |
int position = ((ArrayAdapter<String>) voice.getAdapter()) |
155 |
.getPosition(t.voice); |
|
5467
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
156 |
voice.setSelection(position); |
5542
141c12a23787
start of implementation of the save button, check if there's something to save and update TeamSelectionActivity if a change has been made
Xeli
parents:
5467
diff
changeset
|
157 |
|
5613 | 158 |
position = ((ArrayAdapter<String>) fort.getAdapter()) |
159 |
.getPosition(t.fort); |
|
5467
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
160 |
fort.setSelection(position); |
5542
141c12a23787
start of implementation of the save button, check if there's something to save and update TeamSelectionActivity if a change has been made
Xeli
parents:
5467
diff
changeset
|
161 |
|
5467
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
162 |
position = 0; |
5613 | 163 |
for (HashMap<String, ?> hashmap : typesData) { |
164 |
if (hashmap.get("txt").equals(t.levels[0])) { |
|
5467
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
165 |
difficulty.setSelection(position); |
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
166 |
break; |
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
167 |
} |
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
168 |
} |
5542
141c12a23787
start of implementation of the save button, check if there's something to save and update TeamSelectionActivity if a change has been made
Xeli
parents:
5467
diff
changeset
|
169 |
|
5467
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
170 |
position = 0; |
5613 | 171 |
for (HashMap<String, ?> hashmap : gravesData) { |
172 |
if (hashmap.get("txt").equals(t.grave)) { |
|
5467
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
173 |
grave.setSelection(position); |
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
174 |
break; |
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
175 |
} |
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
176 |
} |
5542
141c12a23787
start of implementation of the save button, check if there's something to save and update TeamSelectionActivity if a change has been made
Xeli
parents:
5467
diff
changeset
|
177 |
|
5467
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
178 |
position = 0; |
5613 | 179 |
for (HashMap<String, ?> hashmap : typesData) { |
180 |
if (hashmap.get("txt").equals(t.flag)) { |
|
5467
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
181 |
flag.setSelection(position); |
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
182 |
break; |
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
183 |
} |
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
184 |
} |
5542
141c12a23787
start of implementation of the save button, check if there's something to save and update TeamSelectionActivity if a change has been made
Xeli
parents:
5467
diff
changeset
|
185 |
|
5613 | 186 |
for (int i = 0; i < Team.maxNumberOfHogs; i++) { |
5467
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
187 |
position = 0; |
5613 | 188 |
for (HashMap<String, ?> hashmap : hatsData) { |
189 |
if (hashmap.get("txt").equals(t.hats[i])) { |
|
5467
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
190 |
hogHat.get(i).setSelection(position); |
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
191 |
} |
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
192 |
} |
5542
141c12a23787
start of implementation of the save button, check if there's something to save and update TeamSelectionActivity if a change has been made
Xeli
parents:
5467
diff
changeset
|
193 |
|
5467
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
194 |
hogName.get(i).setText(t.hogNames[i]); |
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
195 |
} |
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
196 |
} |
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
197 |
} |
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
198 |
|
5613 | 199 |
public void onDestroy() { |
5467
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
200 |
super.onDestroy(); |
5613 | 201 |
if (mp != null) { |
5467
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
202 |
mp.release(); |
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
203 |
mp = null; |
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
204 |
} |
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
205 |
} |
5542
141c12a23787
start of implementation of the save button, check if there's something to save and update TeamSelectionActivity if a change has been made
Xeli
parents:
5467
diff
changeset
|
206 |
|
5613 | 207 |
private OnFocusChangeListener focusser = new OnFocusChangeListener() { |
5542
141c12a23787
start of implementation of the save button, check if there's something to save and update TeamSelectionActivity if a change has been made
Xeli
parents:
5467
diff
changeset
|
208 |
public void onFocusChange(View v, boolean hasFocus) { |
141c12a23787
start of implementation of the save button, check if there's something to save and update TeamSelectionActivity if a change has been made
Xeli
parents:
5467
diff
changeset
|
209 |
settingsChanged = true; |
141c12a23787
start of implementation of the save button, check if there's something to save and update TeamSelectionActivity if a change has been made
Xeli
parents:
5467
diff
changeset
|
210 |
} |
5613 | 211 |
|
5542
141c12a23787
start of implementation of the save button, check if there's something to save and update TeamSelectionActivity if a change has been made
Xeli
parents:
5467
diff
changeset
|
212 |
}; |
5613 | 213 |
|
214 |
public void onBackPressed() { |
|
5542
141c12a23787
start of implementation of the save button, check if there's something to save and update TeamSelectionActivity if a change has been made
Xeli
parents:
5467
diff
changeset
|
215 |
onFinishing(); |
141c12a23787
start of implementation of the save button, check if there's something to save and update TeamSelectionActivity if a change has been made
Xeli
parents:
5467
diff
changeset
|
216 |
super.onBackPressed(); |
5613 | 217 |
|
5542
141c12a23787
start of implementation of the save button, check if there's something to save and update TeamSelectionActivity if a change has been made
Xeli
parents:
5467
diff
changeset
|
218 |
} |
5613 | 219 |
|
220 |
private OnClickListener backClicker = new OnClickListener() { |
|
221 |
public void onClick(View v) { |
|
5542
141c12a23787
start of implementation of the save button, check if there's something to save and update TeamSelectionActivity if a change has been made
Xeli
parents:
5467
diff
changeset
|
222 |
onFinishing(); |
141c12a23787
start of implementation of the save button, check if there's something to save and update TeamSelectionActivity if a change has been made
Xeli
parents:
5467
diff
changeset
|
223 |
finish(); |
141c12a23787
start of implementation of the save button, check if there's something to save and update TeamSelectionActivity if a change has been made
Xeli
parents:
5467
diff
changeset
|
224 |
} |
141c12a23787
start of implementation of the save button, check if there's something to save and update TeamSelectionActivity if a change has been made
Xeli
parents:
5467
diff
changeset
|
225 |
}; |
141c12a23787
start of implementation of the save button, check if there's something to save and update TeamSelectionActivity if a change has been made
Xeli
parents:
5467
diff
changeset
|
226 |
|
5613 | 227 |
private void onFinishing() { |
228 |
if (settingsChanged) { |
|
5542
141c12a23787
start of implementation of the save button, check if there's something to save and update TeamSelectionActivity if a change has been made
Xeli
parents:
5467
diff
changeset
|
229 |
setResult(RESULT_OK); |
5613 | 230 |
} else { |
5542
141c12a23787
start of implementation of the save button, check if there's something to save and update TeamSelectionActivity if a change has been made
Xeli
parents:
5467
diff
changeset
|
231 |
setResult(RESULT_CANCELED); |
141c12a23787
start of implementation of the save button, check if there's something to save and update TeamSelectionActivity if a change has been made
Xeli
parents:
5467
diff
changeset
|
232 |
} |
141c12a23787
start of implementation of the save button, check if there's something to save and update TeamSelectionActivity if a change has been made
Xeli
parents:
5467
diff
changeset
|
233 |
} |
141c12a23787
start of implementation of the save button, check if there's something to save and update TeamSelectionActivity if a change has been made
Xeli
parents:
5467
diff
changeset
|
234 |
|
5613 | 235 |
private OnClickListener saveClicker = new OnClickListener() { |
5467
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
236 |
public void onClick(View v) { |
5627
ce2d92589cbc
Added a visual imageview to show how many teams have been selected, plus feedback when creating a new team:
Xeli
parents:
5621
diff
changeset
|
237 |
Toast.makeText(TeamCreatorActivity.this, R.string.saved, Toast.LENGTH_SHORT).show(); |
5542
141c12a23787
start of implementation of the save button, check if there's something to save and update TeamSelectionActivity if a change has been made
Xeli
parents:
5467
diff
changeset
|
238 |
saved = true; |
5467
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
239 |
Team team = new Team(); |
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
240 |
team.name = name.getText().toString(); |
5613 | 241 |
HashMap<String, Object> hashmap = (HashMap<String, Object>) flag |
242 |
.getSelectedItem(); |
|
5542
141c12a23787
start of implementation of the save button, check if there's something to save and update TeamSelectionActivity if a change has been made
Xeli
parents:
5467
diff
changeset
|
243 |
|
5613 | 244 |
team.flag = (String) hashmap.get("txt"); |
5467
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
245 |
team.fort = fort.getSelectedItem().toString(); |
5613 | 246 |
hashmap = (HashMap<String, Object>) grave.getSelectedItem(); |
5467
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
247 |
team.grave = hashmap.get("txt").toString(); |
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
248 |
team.hash = "0"; |
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
249 |
team.voice = voice.getSelectedItem().toString(); |
5542
141c12a23787
start of implementation of the save button, check if there's something to save and update TeamSelectionActivity if a change has been made
Xeli
parents:
5467
diff
changeset
|
250 |
|
5613 | 251 |
hashmap = ((HashMap<String, Object>) difficulty.getSelectedItem()); |
5467
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
252 |
String levelString = hashmap.get("txt").toString(); |
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
253 |
int levelInt; |
5613 | 254 |
if (levelString.equals(getString(R.string.human))) { |
5467
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
255 |
levelInt = 0; |
5613 | 256 |
} else if (levelString.equals(getString(R.string.bot5))) { |
5467
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
257 |
levelInt = 1; |
5613 | 258 |
} else if (levelString.equals(getString(R.string.bot4))) { |
5467
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
259 |
levelInt = 2; |
5613 | 260 |
} else if (levelString.equals(getString(R.string.bot3))) { |
5467
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
261 |
levelInt = 3; |
5613 | 262 |
} else if (levelString.equals(getString(R.string.bot2))) { |
5467
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
263 |
levelInt = 4; |
5613 | 264 |
} else { |
5467
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
265 |
levelInt = 5; |
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
266 |
} |
5542
141c12a23787
start of implementation of the save button, check if there's something to save and update TeamSelectionActivity if a change has been made
Xeli
parents:
5467
diff
changeset
|
267 |
|
5613 | 268 |
for (int i = 0; i < hogName.size(); i++) { |
5467
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
269 |
team.hogNames[i] = hogName.get(i).getText().toString(); |
5613 | 270 |
hashmap = (HashMap<String, Object>) hogHat.get(i) |
271 |
.getSelectedItem(); |
|
5467
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
272 |
team.hats[i] = hashmap.get("txt").toString(); |
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
273 |
team.levels[i] = levelInt; |
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
274 |
} |
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
275 |
try { |
5613 | 276 |
File teamsDir = new File(getFilesDir().getAbsolutePath() + '/' |
277 |
+ Team.DIRECTORY_TEAMS); |
|
278 |
if (!teamsDir.exists()) |
|
279 |
teamsDir.mkdir(); |
|
280 |
FileOutputStream fos = new FileOutputStream(String.format( |
|
281 |
"%s/%s.xml", teamsDir.getAbsolutePath(), team.name)); |
|
5467
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
282 |
team.writeToXml(fos); |
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
283 |
} catch (FileNotFoundException e) { |
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
284 |
e.printStackTrace(); |
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
285 |
} |
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
286 |
} |
5542
141c12a23787
start of implementation of the save button, check if there's something to save and update TeamSelectionActivity if a change has been made
Xeli
parents:
5467
diff
changeset
|
287 |
|
5467
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
288 |
}; |
5542
141c12a23787
start of implementation of the save button, check if there's something to save and update TeamSelectionActivity if a change has been made
Xeli
parents:
5467
diff
changeset
|
289 |
|
5613 | 290 |
private OnItemSelectedListener fortSelector = new OnItemSelectedListener() { |
5467
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
291 |
@SuppressWarnings("unchecked") |
5613 | 292 |
public void onItemSelected(AdapterView<?> arg0, View arg1, |
293 |
int position, long arg3) { |
|
5542
141c12a23787
start of implementation of the save button, check if there's something to save and update TeamSelectionActivity if a change has been made
Xeli
parents:
5467
diff
changeset
|
294 |
settingsChanged = true; |
5467
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
295 |
String fortName = (String) arg0.getAdapter().getItem(position); |
5613 | 296 |
Drawable fortIconDrawable = Drawable.createFromPath(Utils |
297 |
.getDownloadPath(TeamCreatorActivity.this) |
|
298 |
+ "Forts/" |
|
299 |
+ fortName + "L.png"); |
|
5467
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
300 |
imgFort.setImageDrawable(fortIconDrawable); |
5613 | 301 |
scroller.fullScroll(ScrollView.FOCUS_DOWN);// Scroll the scrollview |
302 |
// to the bottom, work |
|
303 |
// around for scollview |
|
304 |
// invalidation (scrolls |
|
305 |
// back to top) |
|
5467
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
306 |
} |
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
307 |
|
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
308 |
public void onNothingSelected(AdapterView<?> arg0) { |
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
309 |
} |
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
310 |
|
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
311 |
}; |
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
312 |
|
5613 | 313 |
private OnClickListener voiceClicker = new OnClickListener() { |
5467
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
314 |
public void onClick(View v) { |
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
315 |
try { |
5613 | 316 |
File dir = new File(String.format("%sSounds/voices/%s", |
317 |
Utils.getDownloadPath(TeamCreatorActivity.this), |
|
318 |
voice.getSelectedItem())); |
|
5467
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
319 |
String file = ""; |
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
320 |
File[] dirs = dir.listFiles(); |
5613 | 321 |
File f = dirs[(int) Math.round(Math.random() * dirs.length)]; |
322 |
if (f.getName().endsWith(".ogg")) |
|
323 |
file = f.getAbsolutePath(); |
|
5542
141c12a23787
start of implementation of the save button, check if there's something to save and update TeamSelectionActivity if a change has been made
Xeli
parents:
5467
diff
changeset
|
324 |
|
5613 | 325 |
if (mp == null) |
326 |
mp = new MediaPlayer(); |
|
327 |
else |
|
328 |
mp.reset(); |
|
5467
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
329 |
mp.setDataSource(file); |
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
330 |
mp.prepare(); |
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
331 |
mp.start(); |
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
332 |
} catch (IllegalArgumentException e) { |
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
333 |
e.printStackTrace(); |
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
334 |
} catch (IllegalStateException e) { |
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
335 |
e.printStackTrace(); |
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
336 |
} catch (IOException e) { |
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
337 |
e.printStackTrace(); |
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
338 |
} |
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
339 |
} |
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
340 |
}; |
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
341 |
|
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
342 |
private SimpleAdapter.ViewBinder viewBinder = new SimpleAdapter.ViewBinder() { |
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
343 |
|
5613 | 344 |
public boolean setViewValue(View view, Object data, |
345 |
String textRepresentation) { |
|
346 |
if (view instanceof ImageView && data instanceof Bitmap) { |
|
347 |
ImageView v = (ImageView) view; |
|
348 |
v.setImageBitmap((Bitmap) data); |
|
5467
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
349 |
return true; |
5613 | 350 |
} else { |
5467
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
351 |
return false; |
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
352 |
} |
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
353 |
} |
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
354 |
}; |
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
355 |
|
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
356 |
} |