author | Xeli |
Thu, 04 Aug 2011 17:34:21 +0200 | |
branch | hedgeroid |
changeset 5467 | 88e25840f532 |
child 5542 | 141c12a23787 |
permissions | -rw-r--r-- |
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
|
1 |
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
|
2 |
|
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
3 |
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
|
4 |
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
|
5 |
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
|
6 |
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
|
7 |
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
|
8 |
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
|
9 |
|
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
10 |
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
|
11 |
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
|
12 |
|
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
13 |
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
|
14 |
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
|
15 |
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
|
16 |
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
|
17 |
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
|
18 |
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
|
19 |
import android.view.View.OnClickListener; |
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 |
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
|
21 |
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
|
22 |
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
|
23 |
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
|
24 |
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
|
25 |
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
|
26 |
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
|
27 |
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
|
28 |
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
|
29 |
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
|
30 |
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
|
31 |
import android.widget.TextView; |
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 |
|
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 |
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
|
34 |
|
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 |
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
|
36 |
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
|
37 |
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
|
38 |
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
|
39 |
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
|
40 |
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
|
41 |
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
|
42 |
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
|
43 |
private MediaPlayer 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
|
44 |
private ArrayList<RelativeLayout> hogs; |
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 |
|
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 |
public void onCreate(Bundle 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
|
47 |
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
|
48 |
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
|
49 |
|
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 |
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
|
51 |
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
|
52 |
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
|
53 |
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
|
54 |
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
|
55 |
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
|
56 |
|
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 |
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
|
58 |
|
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 |
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
|
60 |
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
|
61 |
voiceButton = (ImageButton) findViewById(R.id.btnPlay); |
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 |
|
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 |
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
|
64 |
|
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
65 |
save.setOnClickListener(saveClicker); |
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
66 |
|
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 |
LinearLayout ll = (LinearLayout) findViewById(R.id.HogsContainer); |
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
68 |
hogs = new ArrayList<RelativeLayout>(ll.getChildCount()); |
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 |
for(int i = 0; i < ll.getChildCount(); 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
|
70 |
RelativeLayout team_creation_entry = (RelativeLayout) ll.getChildAt(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
|
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 |
hogHat.add((Spinner)team_creation_entry.findViewById(R.id.spinTeam1)); |
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 |
hogDice.add((ImageButton)team_creation_entry.findViewById(R.id.btnTeam1)); |
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 |
hogName.add((EditText)team_creation_entry.findViewById(R.id.txtTeam1)); |
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 |
} |
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 |
ArrayList<HashMap<String, ?>> gravesData = FrontendDataUtils.getGraves(this); |
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 |
SimpleAdapter sa = new SimpleAdapter(this, gravesData, R.layout.spinner_textimg_entry, new String[]{"txt", "img"}, new int[]{R.id.spinner_txt, R.id.spinner_img}); |
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 |
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
|
79 |
grave.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
|
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 |
ArrayList<HashMap<String, ?>> flagsData = FrontendDataUtils.getFlags(this); |
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 |
sa = new SimpleAdapter(this, flagsData, R.layout.spinner_textimg_entry, new String[]{"txt", "img"}, new int[]{R.id.spinner_txt, R.id.spinner_img}); |
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 |
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
|
84 |
flag.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
|
85 |
|
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 |
ArrayList<HashMap<String, ?>> typesData = FrontendDataUtils.getTypes(this); |
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 |
sa = new SimpleAdapter(this, typesData, R.layout.spinner_textimg_entry, new String[]{"txt", "img"}, new int[]{R.id.spinner_txt, R.id.spinner_img}); |
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
88 |
difficulty.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
|
89 |
|
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 |
ArrayList<HashMap<String, ?>> hatsData = FrontendDataUtils.getHats(this); |
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
91 |
sa = new SimpleAdapter(this, hatsData, R.layout.spinner_textimg_entry, new String[]{"txt", "img"}, new int[]{R.id.spinner_txt, R.id.spinner_img}); |
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
92 |
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
|
93 |
for(Spinner spin : hogHat){ |
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
94 |
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
|
95 |
} |
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
96 |
|
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
97 |
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, FrontendDataUtils.getVoices(this)); |
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
98 |
voice.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
|
99 |
voiceButton.setOnClickListener(voiceClicker); |
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
100 |
|
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 |
adapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, FrontendDataUtils.getForts(this)); |
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
102 |
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
|
103 |
fort.setOnItemSelectedListener(fortSelector); |
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
104 |
|
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
105 |
|
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
106 |
Team t = this.getIntent().getParcelableExtra("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
|
107 |
if(t != 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
|
108 |
name.setText(t.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
|
109 |
int position = ((ArrayAdapter<String>)voice.getAdapter()).getPosition(t.voice); |
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
110 |
voice.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
|
111 |
position = ((ArrayAdapter<String>)fort.getAdapter()).getPosition(t.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
|
112 |
fort.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
|
113 |
|
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
114 |
position = 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
|
115 |
for(HashMap<String, ?> hashmap : typesData){ |
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
116 |
if(hashmap.get("txt").equals(t.levels[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
|
117 |
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
|
118 |
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
|
119 |
} |
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
120 |
} |
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
121 |
|
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
122 |
position = 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
|
123 |
for(HashMap<String, ?> hashmap : gravesData){ |
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
124 |
if(hashmap.get("txt").equals(t.grave)){ |
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
125 |
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
|
126 |
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
|
127 |
} |
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
128 |
} |
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
129 |
|
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
130 |
position = 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
|
131 |
for(HashMap<String, ?> hashmap : typesData){ |
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
132 |
if(hashmap.get("txt").equals(t.flag)){ |
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
133 |
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
|
134 |
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
|
135 |
} |
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 |
} |
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 |
for(int i = 0; i < Team.maxNumberOfHogs; 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
|
139 |
position = 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
|
140 |
for(HashMap<String, ?> hashmap : hatsData){ |
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 |
if(hashmap.get("txt").equals(t.hats[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
|
142 |
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
|
143 |
} |
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
144 |
} |
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
145 |
|
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
146 |
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
|
147 |
} |
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 |
} |
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
149 |
} |
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
150 |
|
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 |
public void onDestroy(){ |
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
152 |
super.onDestroy(); |
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 |
if(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
|
154 |
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
|
155 |
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
|
156 |
} |
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
157 |
} |
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
158 |
|
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
159 |
private OnClickListener saveClicker = new OnClickListener(){ |
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 |
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
|
161 |
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
|
162 |
team.name = name.getText().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
|
163 |
HashMap<String, Object> hashmap = (HashMap<String, Object>) flag.getSelectedItem(); |
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
164 |
|
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 |
team.flag = (String)hashmap.get("txt"); |
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 |
team.fort = fort.getSelectedItem().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
|
167 |
hashmap = (HashMap<String, Object>)grave.getSelectedItem(); |
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 |
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
|
169 |
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
|
170 |
team.voice = voice.getSelectedItem().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
|
171 |
|
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
172 |
hashmap = ((HashMap<String, Object>)difficulty.getSelectedItem()); |
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 |
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
|
174 |
int 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
|
175 |
if(levelString.equals(getString(R.string.human))){ |
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 |
levelInt = 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
|
177 |
}else if(levelString.equals(getString(R.string.bot5))){ |
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 |
levelInt = 1; |
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
179 |
}else if(levelString.equals(getString(R.string.bot4))){ |
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
180 |
levelInt = 2; |
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 |
}else if(levelString.equals(getString(R.string.bot3))){ |
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 |
levelInt = 3; |
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 |
}else if(levelString.equals(getString(R.string.bot2))){ |
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 |
levelInt = 4; |
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
185 |
}else { |
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
186 |
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
|
187 |
} |
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
188 |
|
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
189 |
for(int i = 0; i < hogName.size(); 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
|
190 |
team.hogNames[i] = hogName.get(i).getText().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
|
191 |
hashmap = (HashMap<String, Object>)hogHat.get(i).getSelectedItem(); |
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 |
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
|
193 |
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
|
194 |
} |
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 |
try { |
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 |
File teamsDir = new File(getFilesDir().getAbsolutePath() + '/' + Team.DIRECTORY_TEAMS); |
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 |
if(!teamsDir.exists()) teamsDir.mkdir(); |
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 |
FileOutputStream fos = new FileOutputStream(String.format("%s/%s.xml", teamsDir.getAbsolutePath(), team.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
|
199 |
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
|
200 |
} 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
|
201 |
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
|
202 |
} |
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 |
} |
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 |
}; |
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
206 |
|
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
207 |
private OnItemSelectedListener fortSelector = new 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
|
208 |
@SuppressWarnings("unchecked") |
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
209 |
public void onItemSelected(AdapterView<?> arg0, View arg1, int position, long arg3) { |
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
210 |
String fortName = (String) arg0.getAdapter().getItem(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
|
211 |
Drawable fortIconDrawable = Drawable.createFromPath(Utils.getDownloadPath(TeamCreatorActivity.this) + "Forts/" + fortName + "L.png"); |
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
212 |
imgFort.setImageDrawable(fortIconDrawable); |
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
213 |
scroller.fullScroll(ScrollView.FOCUS_DOWN);//Scroll the scrollview to the bottom, work around for scollview invalidation (scrolls back to top) |
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
214 |
} |
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
215 |
|
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
216 |
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
|
217 |
} |
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
218 |
|
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
219 |
}; |
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
220 |
|
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
221 |
private OnClickListener voiceClicker = new OnClickListener(){ |
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
222 |
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
|
223 |
try { |
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
224 |
File dir = new File(String.format("%sSounds/voices/%s", Utils.getDownloadPath(TeamCreatorActivity.this), voice.getSelectedItem())); |
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
225 |
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
|
226 |
File[] dirs = dir.listFiles(); |
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
227 |
File f = dirs[(int)Math.round(Math.random()*dirs.length)]; |
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
228 |
if(f.getName().endsWith(".ogg"))file = f.getAbsolutePath(); |
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
229 |
|
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
230 |
if(mp == null) mp = new 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
|
231 |
else mp.reset(); |
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
232 |
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
|
233 |
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
|
234 |
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
|
235 |
} 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
|
236 |
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
|
237 |
} 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
|
238 |
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
|
239 |
} 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
|
240 |
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
|
241 |
} |
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
242 |
} |
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
243 |
}; |
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
244 |
|
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 |
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
|
246 |
|
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 |
public boolean setViewValue(View view, Object data, String textRepresentation) { |
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 |
if(view instanceof ImageView && data instanceof 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
|
249 |
ImageView v = (ImageView)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
|
250 |
v.setImageBitmap((Bitmap)data); |
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
251 |
return true; |
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 |
}else{ |
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 |
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
|
254 |
} |
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 |
} |
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
256 |
}; |
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 |
|
88e25840f532
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
Xeli
parents:
diff
changeset
|
258 |
} |