Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values hedgeroid
authorXeli
Thu, 04 Aug 2011 17:34:21 +0200
branchhedgeroid
changeset 5467 88e25840f532
parent 5465 b7e009722465
child 5469 2ad2a4261b56
Main activities for starting up the game, changing gameconfig, selecting and creating teams with their respective layouts and values
project_files/Android-build/SDL-android-project/res/layout/backbutton.xml
project_files/Android-build/SDL-android-project/res/layout/background.xml
project_files/Android-build/SDL-android-project/res/layout/main.xml
project_files/Android-build/SDL-android-project/res/layout/savebutton.xml
project_files/Android-build/SDL-android-project/res/layout/spinner_textimg_entry.xml
project_files/Android-build/SDL-android-project/res/layout/starting_game.xml
project_files/Android-build/SDL-android-project/res/layout/team_creation.xml
project_files/Android-build/SDL-android-project/res/layout/team_creation_entry.xml
project_files/Android-build/SDL-android-project/res/layout/team_selection_dialog.xml
project_files/Android-build/SDL-android-project/res/layout/team_selection_entry.xml
project_files/Android-build/SDL-android-project/res/layout/team_selector.xml
project_files/Android-build/SDL-android-project/res/raw/basicflags.xml
project_files/Android-build/SDL-android-project/res/values/frontend_data_pointers.xml
project_files/Android-build/SDL-android-project/res/values/strings.xml
project_files/Android-build/SDL-android-project/src/org/hedgewars/mobile/EngineProtocol/FrontendDataUtils.java
project_files/Android-build/SDL-android-project/src/org/hedgewars/mobile/TeamCreatorActivity.java
project_files/Android-build/SDL-android-project/src/org/hedgewars/mobile/TeamSelectionActivity.java
project_files/Android-build/SDL-android-project/src/org/hedgewars/mobile/TextImageAdapter.java
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/project_files/Android-build/SDL-android-project/res/layout/backbutton.xml	Thu Aug 04 17:34:21 2011 +0200
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<merge xmlns:android="http://schemas.android.com/apk/res/android">
+    <ImageButton
+    	android:id="@+id/btnBack"
+    	android:layout_width="wrap_content"
+    	android:layout_height="50dip"
+    	android:layout_alignParentBottom="true"
+    	android:layout_alignParentLeft="true"
+    	android:adjustViewBounds="true"
+    	android:scaleType="centerInside"
+    	android:background="@android:color/transparent"
+    	android:src="@drawable/backbutton"/>
+</merge>
\ No newline at end of file
--- a/project_files/Android-build/SDL-android-project/res/layout/background.xml	Thu Aug 04 17:28:11 2011 +0200
+++ b/project_files/Android-build/SDL-android-project/res/layout/background.xml	Thu Aug 04 17:34:21 2011 +0200
@@ -1,8 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
 <merge xmlns:android="http://schemas.android.com/apk/res/android">
 <ImageView
 	android:layout_width="fill_parent"
 	android:layout_height="fill_parent"
 	android:scaleType="center"
 	android:src="@drawable/background"/>
-
 </merge>
\ No newline at end of file
--- a/project_files/Android-build/SDL-android-project/res/layout/main.xml	Thu Aug 04 17:28:11 2011 +0200
+++ b/project_files/Android-build/SDL-android-project/res/layout/main.xml	Thu Aug 04 17:34:21 2011 +0200
@@ -7,7 +7,7 @@
 <TextView  
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
-    android:text="Hello World, SDLActivity"
+    android:text="Press download on first every launch, then startGame"
     />
     
     <Button
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/project_files/Android-build/SDL-android-project/res/layout/savebutton.xml	Thu Aug 04 17:34:21 2011 +0200
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<merge xmlns:android="http://schemas.android.com/apk/res/android">
+    <ImageButton
+    	android:id="@+id/btnSave"
+    	android:layout_width="wrap_content"
+    	android:layout_height="50dip"
+    	android:layout_alignParentBottom="true"
+    	android:layout_alignParentRight="true"
+    	android:adjustViewBounds="true"
+    	android:scaleType="centerInside"
+    	android:background="@android:color/transparent"
+    	android:src="@drawable/savebutton"/>
+</merge>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/project_files/Android-build/SDL-android-project/res/layout/spinner_textimg_entry.xml	Thu Aug 04 17:34:21 2011 +0200
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+	android:layout_width="wrap_content"
+	android:layout_height="wrap_content"
+	android:gravity="center_horizontal">
+	<ImageView
+		android:id="@+id/spinner_img"
+		android:layout_width="wrap_content"
+		android:layout_height="wrap_content"
+		android:layout_gravity="center"
+		android:adjustViewBounds="true"
+		android:scaleType="centerInside"
+		android:layout_marginRight="5dip"
+		/>
+	<TextView
+		android:id="@+id/spinner_txt"
+		android:layout_width="wrap_content"
+		android:layout_height="wrap_content"
+		android:textSize="14dip"
+		android:textColor="#000"
+		android:gravity="center"/>
+</LinearLayout>
\ No newline at end of file
--- a/project_files/Android-build/SDL-android-project/res/layout/starting_game.xml	Thu Aug 04 17:28:11 2011 +0200
+++ b/project_files/Android-build/SDL-android-project/res/layout/starting_game.xml	Thu Aug 04 17:34:21 2011 +0200
@@ -11,7 +11,7 @@
     	android:layout_height="128dip"
     	android:layout_margin="5dip"
     	android:scaleType="fitXY"
-    	android:background="@android:color/transparent"
+    	android:background="@drawable/box"
     	android:src="@drawable/backbutton"/>
     
     <Spinner 
@@ -116,21 +116,18 @@
         android:layout_height="wrap_content"
         android:layout_width="wrap_content" 
         android:layout_toRightOf="@+id/imgTheme"
-        android:layout_alignParentRight="true" 
-        android:layout_above="@+id/btnStart"
+        android:layout_alignParentRight="true"
        	android:layout_below="@id/gameOptions"/>
         
+	<include layout="@layout/backbutton"/>
     <ImageButton
-    	android:id="@+id/btnBack"
+    	android:id="@+id/btnTeams"
     	android:layout_width="wrap_content"
     	android:layout_height="50dip"
     	android:layout_alignParentBottom="true"
-    	android:layout_alignParentLeft="true"
+    	android:layout_centerHorizontal="true"
     	android:adjustViewBounds="true"
-    	android:scaleType="centerInside"
-    	android:background="@android:color/transparent"
-    	android:src="@drawable/backbutton"/>
-    	
+    	android:scaleType="centerInside"/>
     <ImageButton
     	android:id="@+id/btnStart"
     	android:layout_width="wrap_content"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/project_files/Android-build/SDL-android-project/res/layout/team_creation.xml	Thu Aug 04 17:34:21 2011 +0200
@@ -0,0 +1,179 @@
+<?xml version="1.0" encoding="utf-8"?>
+<FrameLayout
+	xmlns:android="http://schemas.android.com/apk/res/android"
+  	android:layout_width="fill_parent"
+	android:layout_height="fill_parent">
+	<include layout="@layout/background"/>
+	<LinearLayout
+	  xmlns:android="http://schemas.android.com/apk/res/android"
+	  android:orientation="horizontal"
+	  android:layout_width="fill_parent"
+	  android:layout_height="fill_parent"
+	  android:padding="3dp">
+	  
+	  <RelativeLayout
+	  	android:layout_width="fill_parent"
+	  	android:layout_height="fill_parent"
+	  	android:layout_weight="1">
+	  	<include layout="@layout/backbutton"/>
+	  	<include layout="@layout/savebutton"/>
+	  	<ScrollView
+		  	android:layout_width="fill_parent"
+		  	android:layout_height="fill_parent"
+		  	android:layout_above="@+id/btnBack"
+		  	android:background="@drawable/box"
+		  	android:scrollbarFadeDuration="0">
+		  	<TableLayout
+		  		android:layout_width="fill_parent"
+		  		android:layout_height="fill_parent"
+		  		android:stretchColumns="1"
+		  		android:layout_marginRight="4dip">
+		  		<TableRow android:padding="2dip">
+			  		<TextView
+			  			android:id="@+id/nameTag"
+			  			android:layout_width="wrap_content"
+			  			android:layout_height="wrap_content"
+			  			android:text="@string/name"/>
+			  		<EditText
+			  			android:id="@+id/txtName"
+			  			android:layout_width="fill_parent"
+			  			android:layout_height="wrap_content"
+			  			android:layout_margin="3dip"
+			  			android:background="@drawable/box"
+			  			android:text="@string/name_default"
+			  			android:textColor="#FFF"/>
+		  		</TableRow>
+		  		<TableRow android:padding="2dip">
+			  		<TextView
+			  			android:id="@+id/typeTag"
+			  			android:layout_width="wrap_content"
+			  			android:layout_height="fill_parent"
+			  			android:layout_alignTop="@+id/spinType"
+			  			android:layout_alignBottom="@id/spinType"
+			  			android:gravity="center"
+			  			android:text="@string/type"/>
+			  		<Spinner
+			  			android:id="@id/spinType"
+			  			android:layout_width="fill_parent"
+			  			android:layout_height="wrap_content"
+			  			android:layout_marginLeft="3dip"/>
+		  		</TableRow>
+		  		<TableRow android:padding="2dip">
+		  			<TextView
+			  			android:id="@+id/graveTag"
+			  			android:layout_width="wrap_content"
+			  			android:layout_height="fill_parent"
+			  			android:layout_alignTop="@+id/spinGrave"
+			  			android:layout_alignBottom="@id/spinGrave"
+			  			android:gravity="center"
+			  			android:text="@string/grave"/>
+			  		<Spinner
+			  			android:id="@id/spinGrave"
+			  			android:layout_width="fill_parent"
+			  			android:layout_height="wrap_content"
+			  			android:layout_marginLeft="3dip"/>
+		  		</TableRow>
+		  		<TableRow android:padding="2dip">
+		   			<TextView
+			  			android:id="@+id/FlagTag"
+			  			android:layout_width="wrap_content"
+			  			android:layout_height="fill_parent"
+			  			android:layout_alignTop="@+id/spinFlag"
+			  			android:layout_alignBottom="@id/spinFlag"
+			  			android:gravity="center"
+			  			android:text="@string/flag"/>
+			  		<Spinner
+			  			android:id="@id/spinFlag"
+			  			android:layout_width="fill_parent"
+			  			android:layout_height="wrap_content"
+			  			android:layout_marginLeft="3dip"/>
+		  		</TableRow>
+		  		<TableRow android:padding="2dip">
+		  		  	<TextView
+			  			android:id="@+id/voiceTag"
+			  			android:layout_width="wrap_content"
+			  			android:layout_height="fill_parent"
+			  			android:layout_alignTop="@+id/spinVoice"
+			  			android:layout_alignBottom="@id/spinVoice"
+			  			android:gravity="center"
+			  			android:text="@string/voice"/>
+			  		<RelativeLayout
+			  			android:layout_width="fill_parent"
+			  			android:layout_height="wrap_content"
+			  			android:layout_marginLeft="3dip">
+			  			<ImageButton
+			  				android:id="@+id/btnPlay"
+			  				android:layout_width="wrap_content"
+			  				android:layout_height="wrap_content"
+			  				android:layout_alignParentRight="true"
+			  				android:adjustViewBounds="true"
+			  				android:scaleType="centerInside"
+			  				android:src="@drawable/playsound"
+			  				android:background="@android:color/transparent"/>
+			  			<Spinner
+			  				android:id="@+id/spinVoice"
+			  				android:layout_width="fill_parent"
+			  				android:layout_height="fill_parent"
+			  				android:layout_centerVertical="true"
+			  				android:layout_alignParentLeft="true"
+			  				android:layout_toLeftOf="@id/btnPlay"/>
+			  		</RelativeLayout>
+		  		</TableRow>
+		  		<TableRow android:padding="2dip">
+		  			<TextView
+			  			android:id="@+id/fortTag"
+			  			android:layout_width="wrap_content"
+			  			android:layout_height="wrap_content"
+			  			android:layout_marginTop="2dip"
+			  			android:gravity="top"
+			  			android:text="@string/fort"/>
+		  			<RelativeLayout
+			  			android:layout_width="fill_parent"
+			  			android:layout_height="wrap_content"
+			  			android:layout_marginLeft="3dip">
+			  			<Spinner
+			  				android:id="@+id/spinFort"
+			  				android:layout_width="fill_parent"
+			  				android:layout_height="wrap_content"
+			  				android:layout_centerHorizontal="true"/>
+			  			<ImageView
+			  				android:id="@+id/imgFort"
+			  				android:layout_width="128dip"
+			  				android:layout_height="128dip"
+			  				android:layout_centerHorizontal="true"
+			  				android:layout_below="@id/spinFort"
+			  				android:adjustViewBounds="true"
+			  				android:scaleType="centerInside"
+			  				android:background="@android:color/transparent"
+			  				android:src="@drawable/fort"/>
+			  			
+			  		</RelativeLayout>
+		  		</TableRow>
+		  	</TableLayout>
+		  </ScrollView>
+	  </RelativeLayout>
+	  
+	  <ScrollView
+	  	android:id="@+id/scroller"
+	  	android:layout_width="fill_parent"
+	  	android:layout_height="fill_parent"
+	  	android:layout_weight="1"
+	  	android:background="@drawable/box"
+	  	android:scrollbarFadeDuration="0">
+	  	<LinearLayout
+	  		android:id="@+id/HogsContainer"
+	  		android:orientation="vertical"
+	  		android:layout_width="fill_parent"
+	  		android:layout_height="fill_parent">
+	  		<include layout="@layout/team_creation_entry"/>
+	  		<include layout="@layout/team_creation_entry"/>
+	  		<include layout="@layout/team_creation_entry"/>
+	  		<include layout="@layout/team_creation_entry"/>
+	  		<include layout="@layout/team_creation_entry"/>
+	  		<include layout="@layout/team_creation_entry"/>
+	  		<include layout="@layout/team_creation_entry"/>
+	  		<include layout="@layout/team_creation_entry"/>
+	  	</LinearLayout>
+	  </ScrollView>
+	</LinearLayout>
+</FrameLayout>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/project_files/Android-build/SDL-android-project/res/layout/team_creation_entry.xml	Thu Aug 04 17:34:21 2011 +0200
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="utf-8"?>
+<merge xmlns:android="http://schemas.android.com/apk/res/android">
+  <RelativeLayout
+  		android:layout_width="fill_parent"
+  		android:layout_height="wrap_content"
+  		android:background="@drawable/box"
+  		android:layout_margin="3dp">
+  		<Spinner
+  			android:id="@+id/spinTeam1"
+  			android:layout_width="wrap_content"
+  			android:layout_height="wrap_content"
+  			android:layout_alignParentRight="true"
+  			android:layout_toRightOf="@+id/btnTeam1"/>
+  		<EditText
+  			android:id="@+id/txtTeam1"
+  			android:layout_width="fill_parent"
+  			android:layout_height="wrap_content"
+  			android:layout_below="@id/spinTeam1"
+  			android:background="@drawable/box"
+  			android:gravity="center"
+  			android:textColor="#FFF"
+  			android:text="Arnold"/>
+  		<ImageButton
+  			android:id="@id/btnTeam1"
+  			android:layout_height="wrap_content"
+  			android:layout_width="wrap_content"
+  			android:layout_alignLeft="@id/txtTeam1"
+  			android:layout_above="@id/txtTeam1"
+  			android:layout_alignTop="@id/spinTeam1"
+  			android:adjustViewBounds="true"
+  			android:scaleType="centerInside"
+  			android:background="@android:color/transparent"
+  			android:src="@drawable/dice"/>
+  </RelativeLayout>
+</merge>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/project_files/Android-build/SDL-android-project/res/layout/team_selection_dialog.xml	Thu Aug 04 17:34:21 2011 +0200
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout
+  xmlns:android="http://schemas.android.com/apk/res/android"
+  android:orientation="vertical"
+  android:layout_width="wrap_content"
+  android:layout_height="wrap_content">
+  <TextView
+  	android:id="@+id/team_selection_dialog_select"
+  	android:layout_width="wrap_content"
+  	android:layout_height="wrap_content"
+  	android:text="@string/select"/>
+  <TextView
+  	android:id="@+id/team_selection_dialog_edit"
+  	android:layout_width="wrap_content"
+  	android:layout_height="wrap_content"
+  	android:text="@string/edit"/>
+  <TextView
+  	android:id="@+id/team_selection_dialog_delete"
+  	android:layout_width="wrap_content"
+  	android:layout_height="wrap_content"
+  	android:text="@string/delete"/>
+</LinearLayout>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/project_files/Android-build/SDL-android-project/res/layout/team_selection_entry.xml	Thu Aug 04 17:34:21 2011 +0200
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout
+  xmlns:android="http://schemas.android.com/apk/res/android"
+  android:orientation="horizontal"
+  android:layout_width="match_parent"
+  android:layout_height="match_parent"
+  android:background="#8FFF">
+  
+  <ImageView
+  	android:id="@+id/imgDifficulty"
+  	android:layout_height="fill_parent"
+  	android:layout_width="wrap_content"
+  	android:adjustViewBounds="true"
+  	android:scaleType="centerInside"/>
+  <TextView
+  	android:id="@+id/txtName"
+  	android:layout_height="fill_parent"
+  	android:layout_width="fill_parent"
+  	android:textColor="#FFF"/>
+</LinearLayout>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/project_files/Android-build/SDL-android-project/res/layout/team_selector.xml	Thu Aug 04 17:34:21 2011 +0200
@@ -0,0 +1,59 @@
+<?xml version="1.0" encoding="utf-8"?>
+<RelativeLayout
+  xmlns:android="http://schemas.android.com/apk/res/android"
+  android:layout_width="fill_parent"
+  android:layout_height="fill_parent">
+  
+  <include layout="@layout/background"/>
+ 
+  <include layout="@layout/backbutton"/>
+
+  <ImageButton
+   	android:id="@+id/btnAdd"
+   	android:layout_width="wrap_content"
+   	android:layout_height="50dip"
+   	android:layout_alignParentBottom="true"
+   	android:layout_alignParentRight="true"
+   	android:adjustViewBounds="true"
+   	android:scaleType="centerInside"
+   	android:background="@android:color/transparent"
+   	android:src="@drawable/settings"/>
+ <TextView
+  	android:id="@+id/txtInfo"
+  	android:layout_height="wrap_content"
+  	android:layout_width="fill_parent"
+  	android:layout_alignParentBottom="true"
+  	android:layout_toRightOf="@id/btnBack"
+  	android:layout_toLeftOf="@id/btnAdd"
+  	android:layout_alignTop="@id/btnBack"
+  	android:layout_margin="3dp"
+  	android:gravity="center"
+  	android:background="@drawable/box"
+  	android:text="bla"/>
+  	
+  
+
+  <LinearLayout
+  	android:orientation="horizontal"
+  	android:layout_width="fill_parent"
+  	android:layout_height="fill_parent"
+  	android:layout_above="@id/txtInfo"
+  	android:layout_margin="3dp">
+  	
+	  <ListView
+	  	android:id="@+id/selectedTeams"
+	  	android:layout_height="fill_parent"
+	  	android:layout_width="wrap_content"
+	  	android:layout_margin="3dp"
+	  	android:background="@drawable/box"
+	  	android:layout_weight="1"/>
+	  	
+	  <ListView
+	  	android:id="@+id/availableTeams"
+	  	android:layout_height="fill_parent"
+	  	android:layout_width="wrap_content"
+	  	android:layout_margin="3dp"
+	  	android:background="@drawable/box"
+	  	android:layout_weight="1"/>
+  </LinearLayout>
+</RelativeLayout>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/project_files/Android-build/SDL-android-project/res/raw/basicflags.xml	Thu Aug 04 17:34:21 2011 +0200
@@ -0,0 +1,384 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<basicflags>
+    <tflag>
+        <default>
+            <integer>100</integer>
+        </default>
+        <image>
+            <string>Health</string>
+        </image>
+        <max>
+            <integer>200</integer>
+        </max>
+        <min>
+            <integer>50</integer>
+        </min>
+        <title>
+            <string>Initial Health</string>
+        </title>
+    </tflag>
+    <flag>
+        <checkOverMax>
+            <boolean>false</boolean>
+        </checkOverMax>
+        <times1000>
+            <boolean>false</boolean>
+        </times1000>
+        <command>
+            <string>e$damagepct</string>
+        </command>
+        <default>
+            <integer>100</integer>
+        </default>
+        <image>
+            <string>Damage</string>
+        </image>
+        <max>
+            <integer>300</integer>
+        </max>
+        <min>
+            <integer>10</integer>
+        </min>
+        <title>
+            <string>Damage Modifier</string>
+        </title>
+    </flag>
+    <flag>
+        <checkOverMax>
+            <boolean>true</boolean>
+        </checkOverMax>
+        <times1000>
+            <boolean>true</boolean>
+        </times1000>
+        <command>
+            <string>e$turntime</string>
+        </command>
+        <default>
+            <integer>45</integer>
+        </default>
+        <image>
+            <string>Time</string>
+        </image>
+        <max>
+            <integer>100</integer>
+        </max>
+        <min>
+            <integer>1</integer>
+        </min>
+        <title>
+            <string>Turn Time</string>
+        </title>
+    </flag>
+    <flag>
+        <checkOverMax>
+            <boolean>true</boolean>
+        </checkOverMax>
+        <times1000>
+            <boolean>false</boolean>
+        </times1000>
+        <command>
+            <string>e$sd_turns</string>
+        </command>
+        <default>
+            <integer>15</integer>
+        </default>
+        <image>
+            <string>SuddenDeath</string>
+        </image>
+        <max>
+            <integer>50</integer>
+        </max>
+        <min>
+            <integer>0</integer>
+        </min>
+        <title>
+            <string>Sudden Death Timeout</string>
+        </title>
+    </flag>
+    <flag>
+        <checkOverMax>
+            <boolean>false</boolean>
+        </checkOverMax>
+        <times1000>
+            <boolean>false</boolean>
+        </times1000>
+        <command>
+            <string>e$waterrise</string>
+        </command>
+        <default>
+            <integer>47</integer>
+        </default>
+        <image>
+            <string>SuddenDeath</string>
+        </image>
+        <max>
+            <integer>100</integer>
+        </max>
+        <min>
+            <integer>0</integer>
+        </min>
+        <title>
+            <string>Water Rise Amount</string>
+        </title>
+    </flag>
+    <flag>
+        <checkOverMax>
+            <boolean>false</boolean>
+        </checkOverMax>
+        <times1000>
+            <boolean>false</boolean>
+        </times1000>
+        <command>
+            <string>e$healthdec</string>
+        </command>
+        <default>
+            <integer>5</integer>
+        </default>
+        <image>
+            <string>SuddenDeath</string>
+        </image>
+        <max>
+            <integer>100</integer>
+        </max>
+        <min>
+            <integer>0</integer>
+        </min>
+        <title>
+            <string>Health Decrease</string>
+        </title>
+    </flag>
+    <flag>
+        <checkOverMax>
+            <boolean>false</boolean>
+        </checkOverMax>
+        <times1000>
+            <boolean>false</boolean>
+        </times1000>
+        <command>
+            <string>e$ropepct</string>
+        </command>
+        <default>
+            <integer>100</integer>
+        </default>
+        <image>
+            <string>Rope</string>
+        </image>
+        <max>
+            <integer>999</integer>
+        </max>
+        <min>
+            <integer>25</integer>
+        </min>
+        <title>
+            <string>Rope Length (%)</string>
+        </title>
+    </flag>
+    <flag>
+        <checkOverMax>
+            <boolean>false</boolean>
+        </checkOverMax>
+        <times1000>
+            <boolean>false</boolean>
+        </times1000>
+        <command>
+            <string>e$casefreq</string>
+        </command>
+        <default>
+            <integer>5</integer>
+        </default>
+        <image>
+            <string>Box</string>
+        </image>
+        <max>
+            <integer>9</integer>
+        </max>
+        <min>
+            <integer>0</integer>
+        </min>
+        <title>
+            <string>Crate Drop Turns</string>
+        </title>
+    </flag>
+    <flag>
+        <checkOverMax>
+            <boolean>false</boolean>
+        </checkOverMax>
+        <times1000>
+            <boolean>false</boolean>
+        </times1000>
+        <command>
+            <string>e$healthprob</string>
+        </command>
+        <default>
+            <integer>35</integer>
+        </default>
+        <image>
+            <string>Health</string>
+        </image>
+        <max>
+            <integer>100</integer>
+        </max>
+        <min>
+            <integer>0</integer>
+        </min>
+        <title>
+            <string>Health Kit Probability (%)</string>
+        </title>
+    </flag>
+    <flag>
+        <checkOverMax>
+            <boolean>false</boolean>
+        </checkOverMax>
+        <times1000>
+            <boolean>false</boolean>
+        </times1000>
+        <command>
+            <string>e$hcaseamount</string>
+        </command>
+        <default>
+            <integer>25</integer>
+        </default>
+        <image>
+            <string>Health</string>
+        </image>
+        <max>
+            <integer>200</integer>
+        </max>
+        <min>
+            <integer>0</integer>
+        </min>
+        <title>
+            <string>Health Amount in Kit</string>
+        </title>
+    </flag>
+    <flag>
+        <checkOverMax>
+            <boolean>false</boolean>
+        </checkOverMax>
+        <times1000>
+            <boolean>true</boolean>
+        </times1000>
+        <command>
+            <string>e$minestime</string>
+        </command>
+        <default>
+            <integer>3</integer>
+        </default>
+        <image>
+            <string>Time</string>
+        </image>
+        <max>
+            <integer>5</integer>
+        </max>
+        <min>
+            <integer>-1</integer>
+        </min>
+        <title>
+            <string>Mines Time</string>
+        </title>
+    </flag>
+    <flag>
+        <checkOverMax>
+            <boolean>false</boolean>
+        </checkOverMax>
+        <times1000>
+            <boolean>false</boolean>
+        </times1000>
+        <command>
+            <string>e$minesnum</string>
+        </command>
+        <default>
+            <integer>4</integer>
+        </default>
+        <image>
+            <string>Mine</string>
+        </image>
+        <max>
+            <integer>80</integer>
+        </max>
+        <min>
+            <integer>0</integer>
+        </min>
+        <title>
+            <string>Mines Number</string>
+        </title>
+    </flag>
+    <flag>
+        <checkOverMax>
+            <boolean>false</boolean>
+        </checkOverMax>
+        <times1000>
+            <boolean>false</boolean>
+        </times1000>
+        <command>
+            <string>e$minedudpct</string>
+        </command>
+        <default>
+            <integer>0</integer>
+        </default>
+        <image>
+            <string>Dud</string>
+        </image>
+        <max>
+            <integer>100</integer>
+        </max>
+        <min>
+            <integer>0</integer>
+        </min>
+        <title>
+            <string>Dud Mines Probability (%)</string>
+        </title>
+    </flag>
+    <flag>
+        <checkOverMax>
+            <boolean>false</boolean>
+        </checkOverMax>
+        <times1000>
+            <boolean>false</boolean>
+        </times1000>
+        <command>
+            <string>e$explosives</string>
+        </command>
+        <default>
+            <integer>2</integer>
+        </default>
+        <image>
+            <string>Damage</string>
+        </image>
+        <max>
+            <integer>40</integer>
+        </max>
+        <min>
+            <integer>0</integer>
+        </min>
+        <title>
+            <string>Explosives</string>
+        </title>
+    </flag>
+    <flag>
+        <checkOverMax>
+            <boolean>false</boolean>
+        </checkOverMax>
+        <times1000>
+            <boolean>false</boolean>
+        </times1000>
+        <command>
+            <string>e$getawaytime</string>
+        </command>
+        <default>
+            <integer>100</integer>
+        </default>
+        <image>
+            <string>Time</string>
+        </image>
+        <max>
+            <integer>999</integer>
+        </max>
+        <min>
+            <integer>0</integer>
+        </min>
+        <title>
+            <string>Get Away Time (%)</string>
+        </title>
+    </flag>
+</basicflags>
--- a/project_files/Android-build/SDL-android-project/res/values/frontend_data_pointers.xml	Thu Aug 04 17:28:11 2011 +0200
+++ b/project_files/Android-build/SDL-android-project/res/values/frontend_data_pointers.xml	Thu Aug 04 17:34:21 2011 +0200
@@ -2,6 +2,7 @@
 <resources>
 
 <array name="schemes">
+	<item>@raw/basicflags</item>
 	<item>@raw/scheme_default_scheme</item>
 	<item>@raw/scheme_barrelmayhem</item>
 	<item>@raw/scheme_cleanslate</item>
--- a/project_files/Android-build/SDL-android-project/res/values/strings.xml	Thu Aug 04 17:28:11 2011 +0200
+++ b/project_files/Android-build/SDL-android-project/res/values/strings.xml	Thu Aug 04 17:34:21 2011 +0200
@@ -2,6 +2,10 @@
 <resources>
     <string name="app_name">Hedgewars</string>
     
+    <string name="select">Select</string>
+    <string name="edit">Edit</string>
+    <string name="delete">Delete</string>
+    
     <!-- SDCARD -->
     <string name="sdcard_not_mounted">There\'s been an error when accessing the sdcard, is it connected to another computer?</string>
         
@@ -24,4 +28,21 @@
     <string name="start_filter">Filter</string>
     <string name="start_themes">Themes</string>
     
+    <!-- Settings -->
+    <string name="name">Name</string>
+    <string name="name_default">Unnamed</string>
+    <string name="type">Type</string>
+    <string name="grave">Grave</string>
+    <string name="flag">Flag</string>
+    <string name="voice">Voice</string>
+    <string name="fort">Fort</string>
+    
+    <!-- Difficulty levels -->
+    <string name="human">Human</string>
+    <string name="bot5">Level 5</string>
+    <string name="bot4">Level 4</string>
+    <string name="bot3">Level 3</string>
+    <string name="bot2">Level 2</string>
+    <string name="bot1">Level 1</string>
+    
 </resources>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/project_files/Android-build/SDL-android-project/src/org/hedgewars/mobile/EngineProtocol/FrontendDataUtils.java	Thu Aug 04 17:34:21 2011 +0200
@@ -0,0 +1,193 @@
+package org.hedgewars.mobile.EngineProtocol;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashMap;
+
+import org.hedgewars.mobile.R;
+import org.hedgewars.mobile.Utils;
+import org.hedgewars.mobile.EngineProtocol.Map.MapType;
+
+import android.content.Context;
+import android.graphics.Bitmap;
+import android.graphics.BitmapFactory;
+
+public class FrontendDataUtils {
+
+
+	public static ArrayList<Map> getMaps(Context c){
+		File[] files = Utils.getFilesFromRelativeDir(c,"Maps");
+		ArrayList<Map> ret = new ArrayList<Map>();
+
+		for(File f : files){
+			if(Utils.hasFileWithSuffix(f, ".lua")){
+				ret.add(new Map(f,MapType.TYPE_MISSION, c));
+			}else{
+				ret.add(new Map(f, MapType.TYPE_DEFAULT,c));
+			}
+		}
+		Collections.sort(ret);
+
+		return ret;
+	}
+
+	public static String[] getGameplay(Context c){
+		String[] files = Utils.getFileNamesFromRelativeDir(c, "Scripts/Multiplayer");
+		int retCounter = 0;
+
+		for(int i = 0; i < files.length; i++){
+			if(files[i].endsWith(".lua")){
+				files[i] = files[i].replace('_', ' ').substring(0, files[i].length()-4); //replace _ by a space and removed the last four characters (.lua)
+				retCounter++;
+			}else files[i] = null;
+		}
+		String[] ret = new String[retCounter];
+		retCounter = 0;
+		for(String s : files){
+			if(s != null) ret[retCounter++] = s;
+		}
+		Arrays.sort(ret);
+
+		return ret;	
+	}
+
+	public static String[] getThemes(Context c){
+		return Utils.getDirsWithFileSuffix(c, "Themes", "icon.png");
+	}
+
+	public static ArrayList<Scheme> getSchemes(Context c){
+		return Scheme.getSchemes(c);
+	}
+
+	public static ArrayList<Weapon> getWeapons(Context c){
+		return Weapon.getWeapons(c);
+	}
+
+	public static ArrayList<HashMap<String, ?>> getGraves(Context c){
+		String pathPrefix = Utils.getDownloadPath(c) + "Graphics/Graves/";
+		ArrayList<String> names = Utils.getFilesFromDirWithSuffix(c, "Graphics/Graves", ".png", true);
+		ArrayList<HashMap<String, ?>> data = new ArrayList<HashMap<String, ?>>(names.size());
+
+		for(String s : names){
+			HashMap<String, Object> map = new HashMap<String, Object>();
+			map.put("txt", s);
+			Bitmap b = BitmapFactory.decodeFile(pathPrefix + s + ".png");//create a full path - decode to to a bitmap
+			int width = b.getWidth();
+			if(b.getHeight() > width){//some pictures contain more 'frames' underneath each other, if so we only use the first frame
+				Bitmap tmp = Bitmap.createBitmap(b, 0, 0, width, width);
+				b.recycle();
+				b = tmp;
+			}
+			map.put("img", b);
+			data.add(map);
+		}
+		return data;
+	}
+
+	public static ArrayList<HashMap<String, ?>> getFlags(Context c){
+		String pathPrefix = Utils.getDownloadPath(c) + "Graphics/Flags/";
+		ArrayList<String> names = Utils.getFilesFromDirWithSuffix(c, "Graphics/Flags", ".png", true);
+		ArrayList<HashMap<String, ?>> data = new ArrayList<HashMap<String, ?>>(names.size());
+
+		for(String s : names){
+			HashMap<String, Object> map = new HashMap<String, Object>();
+			map.put("txt", s);
+			Bitmap b = BitmapFactory.decodeFile(pathPrefix + s + ".png");//create a full path - decode to to a bitmap
+			map.put("img", b);
+			data.add(map);
+		}
+		return data;
+	}
+
+	public static ArrayList<String> getVoices(Context c){
+		File[] files = Utils.getFilesFromRelativeDir(c, "Sounds/voices");
+		ArrayList<String> ret = new ArrayList<String>();
+
+		for(File f : files){
+			if(f.isDirectory()) ret.add(f.getName());
+		}
+		return ret;
+	}
+
+	public static ArrayList<String> getForts(Context c){
+		return Utils.getFilesFromDirWithSuffix(c, "Forts", "L.png", true);
+	}
+	public static ArrayList<HashMap<String, ?>> getTypes(Context c){
+		ArrayList<HashMap<String, ?>> data = new ArrayList<HashMap<String, ?>>(6);
+		String[] levels = {c.getString(R.string.human), c.getString(R.string.bot5), c.getString(R.string.bot4), c.getString(R.string.bot3), c.getString(R.string.bot2), c.getString(R.string.bot1)};
+		int[] images = {R.drawable.human, R.drawable.bot5, R.drawable.bot4, R.drawable.bot3, R.drawable.bot2, R.drawable.bot1};
+		
+		for(int i = 0; i < levels.length; i++){
+			HashMap<String, Object> map = new HashMap<String, Object>();
+			map.put("txt", levels[i]);
+			map.put("img", images[i]);
+			data.add(map);
+		}
+		
+		return data;
+	}
+	
+	public static ArrayList<HashMap<String, ?>> getHats(Context c){
+		ArrayList<String> files = Utils.getFilesFromDirWithSuffix(c, "Graphics/Hats", ".png", true);
+		String pathPrefix = Utils.getDownloadPath(c) + "Graphics/Hats/";
+		int size = files.size();
+		ArrayList<HashMap<String, ?>> data = new ArrayList<HashMap<String, ?>>(size);
+		
+		HashMap<String, Object> hashmap; 
+		for(String s : files){
+			hashmap = new HashMap<String, Object>();
+			hashmap.put("txt", s);
+			Bitmap b = BitmapFactory.decodeFile(pathPrefix + s + ".png");//create a full path - decode to to a bitmap
+			b = Bitmap.createBitmap(b, 0,0,b.getWidth()/2, b.getWidth()/2);
+			hashmap.put("img", b);
+			data.add(hashmap);
+		}
+		
+		return data;
+	}
+	
+	public static ArrayList<HashMap<String, ?>> getTeams(Context c){
+		ArrayList<HashMap<String, ?>> ret = new ArrayList<HashMap<String, ?>>();
+		
+		File teamsDir = new File(c.getFilesDir().getAbsolutePath() + '/' + Team.DIRECTORY_TEAMS);
+		File[] teamFileNames = teamsDir.listFiles();
+		
+		for(File s : teamFileNames){
+			Team t = Team.getTeamFromXml(s.getAbsolutePath());
+			if(t != null){
+				ret.add(teamToHashMap(t));
+			}
+		}
+		return ret;
+	}
+	
+	public static HashMap<String, Object> teamToHashMap(Team t){
+		HashMap<String, Object> hashmap = new HashMap<String, Object>();
+		hashmap.put("team", t);
+		hashmap.put("txt", t.name);
+		switch(t.levels[0]){
+		case 0:
+			hashmap.put("img", R.drawable.human);
+			break;
+		case 1:
+			hashmap.put("img", R.drawable.bot5);
+			break;
+		case 2:
+			hashmap.put("img", R.drawable.bot4);
+			break;
+		case 3:
+			hashmap.put("img", R.drawable.bot3);
+			break;
+		case 4:
+			hashmap.put("img", R.drawable.bot2);
+			break;
+		default:
+		case 5:
+			hashmap.put("img", R.drawable.bot1);
+			break;
+		}
+		return hashmap;
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/project_files/Android-build/SDL-android-project/src/org/hedgewars/mobile/TeamCreatorActivity.java	Thu Aug 04 17:34:21 2011 +0200
@@ -0,0 +1,258 @@
+package org.hedgewars.mobile;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
+
+import org.hedgewars.mobile.EngineProtocol.FrontendDataUtils;
+import org.hedgewars.mobile.EngineProtocol.Team;
+
+import android.app.Activity;
+import android.graphics.Bitmap;
+import android.graphics.drawable.Drawable;
+import android.media.MediaPlayer;
+import android.os.Bundle;
+import android.view.View;
+import android.view.View.OnClickListener;
+import android.widget.AdapterView;
+import android.widget.AdapterView.OnItemSelectedListener;
+import android.widget.ArrayAdapter;
+import android.widget.EditText;
+import android.widget.ImageButton;
+import android.widget.ImageView;
+import android.widget.LinearLayout;
+import android.widget.RelativeLayout;
+import android.widget.ScrollView;
+import android.widget.SimpleAdapter;
+import android.widget.Spinner;
+import android.widget.TextView;
+
+public class TeamCreatorActivity extends Activity {
+
+	private TextView name;
+	private Spinner difficulty, grave, flag, voice, fort;
+	private ImageView imgFort;
+	private ArrayList<ImageButton> hogDice = new ArrayList<ImageButton>();
+	private ArrayList<Spinner> hogHat = new ArrayList<Spinner>();
+	private ArrayList<EditText> hogName = new ArrayList<EditText>();
+	private ImageButton back, save, voiceButton;
+	private ScrollView scroller;
+	private MediaPlayer mp = null;
+	private ArrayList<RelativeLayout> hogs;
+
+	public void onCreate(Bundle savedInstanceState){
+		super.onCreate(savedInstanceState);
+		setContentView(R.layout.team_creation);
+
+		name = (TextView) findViewById(R.id.txtName);
+		difficulty = (Spinner) findViewById(R.id.spinType);
+		grave = (Spinner) findViewById(R.id.spinGrave);
+		flag = (Spinner) findViewById(R.id.spinFlag);
+		voice = (Spinner) findViewById(R.id.spinVoice);
+		fort = (Spinner) findViewById(R.id.spinFort);
+
+		imgFort = (ImageView) findViewById(R.id.imgFort);
+
+		back = (ImageButton) findViewById(R.id.btnBack);
+		save = (ImageButton) findViewById(R.id.btnSave);
+		voiceButton = (ImageButton) findViewById(R.id.btnPlay);
+		
+		scroller = (ScrollView) findViewById(R.id.scroller);
+
+		save.setOnClickListener(saveClicker);
+		
+		LinearLayout ll = (LinearLayout) findViewById(R.id.HogsContainer);
+		hogs = new ArrayList<RelativeLayout>(ll.getChildCount());
+		for(int i = 0; i < ll.getChildCount(); i++){
+			RelativeLayout team_creation_entry = (RelativeLayout) ll.getChildAt(i);
+			
+			hogHat.add((Spinner)team_creation_entry.findViewById(R.id.spinTeam1));
+			hogDice.add((ImageButton)team_creation_entry.findViewById(R.id.btnTeam1));
+			hogName.add((EditText)team_creation_entry.findViewById(R.id.txtTeam1));
+		}
+		ArrayList<HashMap<String, ?>> gravesData = FrontendDataUtils.getGraves(this);
+		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});
+		sa.setViewBinder(viewBinder);
+		grave.setAdapter(sa);
+
+		ArrayList<HashMap<String, ?>> flagsData = FrontendDataUtils.getFlags(this);
+		sa = new SimpleAdapter(this, flagsData, R.layout.spinner_textimg_entry, new String[]{"txt", "img"}, new int[]{R.id.spinner_txt, R.id.spinner_img});
+		sa.setViewBinder(viewBinder);
+		flag.setAdapter(sa);
+		
+		ArrayList<HashMap<String, ?>> typesData = FrontendDataUtils.getTypes(this);
+		sa = new SimpleAdapter(this, typesData, R.layout.spinner_textimg_entry, new String[]{"txt", "img"}, new int[]{R.id.spinner_txt, R.id.spinner_img});
+		difficulty.setAdapter(sa);
+		
+		ArrayList<HashMap<String, ?>> hatsData = FrontendDataUtils.getHats(this);
+		sa = new SimpleAdapter(this, hatsData, R.layout.spinner_textimg_entry, new String[]{"txt", "img"}, new int[]{R.id.spinner_txt, R.id.spinner_img});
+		sa.setViewBinder(viewBinder);
+		for(Spinner spin : hogHat){
+			spin.setAdapter(sa);
+		}
+
+		ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, FrontendDataUtils.getVoices(this));
+		voice.setAdapter(adapter);
+		voiceButton.setOnClickListener(voiceClicker);
+		
+		adapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, FrontendDataUtils.getForts(this));
+		fort.setAdapter(adapter);
+		fort.setOnItemSelectedListener(fortSelector);
+		
+		
+		Team t = this.getIntent().getParcelableExtra("team");
+		if(t != null){
+			name.setText(t.name);
+			int position = ((ArrayAdapter<String>)voice.getAdapter()).getPosition(t.voice);
+			voice.setSelection(position);
+			position = ((ArrayAdapter<String>)fort.getAdapter()).getPosition(t.fort);
+			fort.setSelection(position);
+			
+			position = 0;
+			for(HashMap<String, ?> hashmap : typesData){
+				if(hashmap.get("txt").equals(t.levels[0])){
+					difficulty.setSelection(position);
+					break;
+				}
+			}
+			
+			position = 0;
+			for(HashMap<String, ?> hashmap : gravesData){
+				if(hashmap.get("txt").equals(t.grave)){
+					grave.setSelection(position);
+					break;
+				}
+			}
+			
+			position = 0;
+			for(HashMap<String, ?> hashmap : typesData){
+				if(hashmap.get("txt").equals(t.flag)){
+					flag.setSelection(position);
+					break;
+				}
+			}
+			
+			for(int i = 0; i < Team.maxNumberOfHogs; i++){
+				position = 0;
+				for(HashMap<String, ?> hashmap : hatsData){
+					if(hashmap.get("txt").equals(t.hats[i])){
+						hogHat.get(i).setSelection(position);
+					}
+				}
+				
+				hogName.get(i).setText(t.hogNames[i]);
+			}
+		}
+	}
+
+	public void onDestroy(){
+		super.onDestroy();
+		if(mp != null){
+			mp.release();
+			mp = null;
+		}
+	}
+	
+	private OnClickListener saveClicker = new OnClickListener(){
+		public void onClick(View v) {
+			Team team = new Team();
+			team.name = name.getText().toString();
+			HashMap<String, Object> hashmap = (HashMap<String, Object>) flag.getSelectedItem();
+			
+			team.flag = (String)hashmap.get("txt");
+			team.fort = fort.getSelectedItem().toString();
+			hashmap = (HashMap<String, Object>)grave.getSelectedItem();
+			team.grave = hashmap.get("txt").toString();
+			team.hash = "0";
+			team.voice = voice.getSelectedItem().toString();
+			
+			hashmap =  ((HashMap<String, Object>)difficulty.getSelectedItem());
+			String levelString = hashmap.get("txt").toString();
+			int levelInt;
+			if(levelString.equals(getString(R.string.human))){
+				levelInt = 0;
+			}else if(levelString.equals(getString(R.string.bot5))){
+				levelInt = 1;
+			}else if(levelString.equals(getString(R.string.bot4))){
+				levelInt = 2;
+			}else if(levelString.equals(getString(R.string.bot3))){
+				levelInt = 3;
+			}else if(levelString.equals(getString(R.string.bot2))){
+				levelInt = 4;
+			}else {
+				levelInt = 5;
+			}
+			
+			for(int i = 0; i < hogName.size(); i++){
+				team.hogNames[i] = hogName.get(i).getText().toString();
+				hashmap = (HashMap<String, Object>)hogHat.get(i).getSelectedItem();
+				team.hats[i] = hashmap.get("txt").toString();
+				team.levels[i] = levelInt;
+			}
+			try {
+				File teamsDir = new File(getFilesDir().getAbsolutePath() + '/' + Team.DIRECTORY_TEAMS);
+				if(!teamsDir.exists()) teamsDir.mkdir();
+				FileOutputStream fos = new FileOutputStream(String.format("%s/%s.xml", teamsDir.getAbsolutePath(), team.name));
+				team.writeToXml(fos);
+			} catch (FileNotFoundException e) {
+				e.printStackTrace();
+			}
+		}
+		
+	};
+	
+	private OnItemSelectedListener fortSelector = new OnItemSelectedListener(){
+		@SuppressWarnings("unchecked")
+		public void onItemSelected(AdapterView<?> arg0, View arg1, int position, long arg3) {
+			String fortName = (String) arg0.getAdapter().getItem(position);
+			Drawable fortIconDrawable = Drawable.createFromPath(Utils.getDownloadPath(TeamCreatorActivity.this) + "Forts/" + fortName + "L.png");
+			imgFort.setImageDrawable(fortIconDrawable);
+			scroller.fullScroll(ScrollView.FOCUS_DOWN);//Scroll the scrollview to the bottom, work around for scollview invalidation (scrolls back to top)
+		}
+
+		public void onNothingSelected(AdapterView<?> arg0) {
+		}
+
+	};
+
+	private OnClickListener voiceClicker = new OnClickListener(){
+		public void onClick(View v) {
+			try {
+				File dir = new File(String.format("%sSounds/voices/%s", Utils.getDownloadPath(TeamCreatorActivity.this), voice.getSelectedItem()));
+				String file = "";
+				File[] dirs = dir.listFiles();
+				File f = dirs[(int)Math.round(Math.random()*dirs.length)];
+				if(f.getName().endsWith(".ogg"))file = f.getAbsolutePath();
+				
+				if(mp == null) mp = new MediaPlayer();
+				else mp.reset();
+				mp.setDataSource(file);
+				mp.prepare();
+				mp.start();
+			} catch (IllegalArgumentException e) {
+				e.printStackTrace();
+			} catch (IllegalStateException e) {
+				e.printStackTrace();
+			} catch (IOException e) {
+				e.printStackTrace();
+			}
+		}
+	};
+
+	private SimpleAdapter.ViewBinder viewBinder = new SimpleAdapter.ViewBinder() {
+
+		public boolean setViewValue(View view, Object data,	String textRepresentation) {
+			if(view instanceof ImageView && data instanceof Bitmap){
+				ImageView v = (ImageView)view;
+				v.setImageBitmap((Bitmap)data);
+				return true;
+			}else{
+				return false;
+			}
+		}
+	};
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/project_files/Android-build/SDL-android-project/src/org/hedgewars/mobile/TeamSelectionActivity.java	Thu Aug 04 17:34:21 2011 +0200
@@ -0,0 +1,157 @@
+package org.hedgewars.mobile;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.HashMap;
+
+import org.hedgewars.mobile.EngineProtocol.FrontendDataUtils;
+import org.hedgewars.mobile.EngineProtocol.Team;
+
+import android.app.Activity;
+import android.content.Intent;
+import android.os.Bundle;
+import android.os.Parcelable;
+import android.view.ContextMenu;
+import android.view.MenuItem;
+import android.view.View;
+import android.view.View.OnClickListener;
+import android.widget.AdapterView;
+import android.widget.AdapterView.AdapterContextMenuInfo;
+import android.widget.AdapterView.OnItemClickListener;
+import android.widget.ImageButton;
+import android.widget.ListView;
+import android.widget.SimpleAdapter;
+
+public class TeamSelectionActivity extends Activity{
+
+	private ImageButton addTeam, back;
+	private ListView availableTeams, selectedTeams;
+	private ArrayList<HashMap<String, ?>> availableTeamsList, selectedTeamsList;
+	private int minTeams = 2;
+
+	public void onCreate(Bundle savedInstanceState){
+		super.onCreate(savedInstanceState);
+
+		setContentView(R.layout.team_selector);
+
+		addTeam = (ImageButton) findViewById(R.id.btnAdd);
+		back = (ImageButton) findViewById(R.id.btnBack);
+		
+		addTeam.setOnClickListener(addTeamClicker);
+		back.setOnClickListener(backClicker);
+
+		availableTeams = (ListView) findViewById(R.id.availableTeams);
+		availableTeamsList = FrontendDataUtils.getTeams(this);
+		SimpleAdapter adapter = new SimpleAdapter(this, availableTeamsList, R.layout.team_selection_entry, new String[]{"txt", "img"}, new int[]{R.id.txtName, R.id.imgDifficulty});
+		availableTeams.setAdapter(adapter);
+		registerForContextMenu(availableTeams);
+		availableTeams.setOnItemClickListener(availableClicker);
+		
+		selectedTeams = (ListView) findViewById(R.id.selectedTeams);
+		selectedTeamsList = new ArrayList<HashMap<String, ?>>();
+		ArrayList<HashMap<String, ?>> toBeRemoved = new ArrayList<HashMap<String, ?>>();
+		ArrayList<Team> teamsStartGame = getIntent().getParcelableArrayListExtra("teams");
+		for(HashMap<String, ?> hashmap : availableTeamsList){
+			for(Team t : teamsStartGame){
+				if(((Team)hashmap.get("team")).equals(t)){
+					toBeRemoved.add(hashmap);
+					selectedTeamsList.add(hashmap);
+				}
+			}
+		}
+		for(HashMap<String, ?> hashmap : toBeRemoved) availableTeamsList.remove(hashmap);
+		
+		adapter = new SimpleAdapter(this, selectedTeamsList, R.layout.team_selection_entry, new String[]{"txt", "img"}, new int[]{R.id.txtName, R.id.imgDifficulty});
+		selectedTeams.setAdapter(adapter);
+		selectedTeams.setOnItemClickListener(selectedClicker);
+		
+		
+		
+		
+	}
+	
+	public void onBackPressed(){
+		returnTeams();
+		super.onBackPressed();
+	}
+	
+	private OnClickListener addTeamClicker = new OnClickListener(){
+		public void onClick(View v) {
+			startActivity(new Intent(TeamSelectionActivity.this, TeamCreatorActivity.class));
+			
+		}
+	};
+	
+	private OnClickListener backClicker = new OnClickListener(){
+		public void onClick(View v){
+			returnTeams();
+			finish();
+		}
+	};
+
+	private OnItemClickListener availableClicker = new OnItemClickListener(){
+		public void onItemClick(AdapterView<?> arg0, View arg1, int position,long arg3) {
+			selectAvailableTeamsItem(position);
+		}
+	};
+	private OnItemClickListener selectedClicker = new OnItemClickListener(){
+		public void onItemClick(AdapterView<?> arg0, View arg1, int position,long arg3) {
+			availableTeamsList.add((HashMap<String, ?>) selectedTeamsList.get(position));
+			selectedTeamsList.remove(position);
+			((SimpleAdapter)availableTeams.getAdapter()).notifyDataSetChanged();
+			((SimpleAdapter)selectedTeams.getAdapter()).notifyDataSetChanged();
+		}
+
+	};
+
+	public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuinfo){
+		menu.add(ContextMenu.NONE, 0, ContextMenu.NONE, R.string.select);
+		menu.add(ContextMenu.NONE, 2, ContextMenu.NONE, R.string.edit);
+		menu.add(ContextMenu.NONE, 1, ContextMenu.NONE, R.string.delete);
+		
+	}
+	public boolean onContextItemSelected(MenuItem item){
+		AdapterView.AdapterContextMenuInfo menuInfo = (AdapterContextMenuInfo) item.getMenuInfo();
+		int position = menuInfo.position;
+		switch(item.getItemId()){
+		case 0://select
+			selectAvailableTeamsItem(position);
+			return true;
+		case 1://delete
+			availableTeamsList.remove(position);
+			((SimpleAdapter)availableTeams.getAdapter()).notifyDataSetChanged();
+			File f = new File(String.format("%s/%s/%s.xml", TeamSelectionActivity.this.getFilesDir(), Team.DIRECTORY_TEAMS, availableTeamsList.get(position).get("txt")));
+			f.delete();
+			return true;
+		case 2://edit
+			Intent i = new Intent(TeamSelectionActivity.this, TeamCreatorActivity.class);
+			Team t = (Team)availableTeamsList.get(position).get("team");
+			i.putExtra("team", t);
+			startActivity(i);
+			return true;
+		}
+		return false;
+	}
+
+	private void selectAvailableTeamsItem(int position){
+		selectedTeamsList.add((HashMap<String, ?>) availableTeamsList.get(position));
+		availableTeamsList.remove(position);
+		((SimpleAdapter)availableTeams.getAdapter()).notifyDataSetChanged();
+		((SimpleAdapter)selectedTeams.getAdapter()).notifyDataSetChanged();
+	}
+
+	private void returnTeams(){
+		int teamsCount = selectedTeamsList.size();
+		if(teamsCount >= minTeams){
+			Intent i = new Intent();
+			Parcelable[] teams = new Parcelable[teamsCount];
+			for(int x = 0 ; x < teamsCount; x++){
+				teams[x] = (Team)selectedTeamsList.get(x).get("team");
+			}
+			i.putExtra("teams", teams);
+			setResult(Activity.RESULT_OK, i);
+		}else{
+			setResult(Activity.RESULT_CANCELED);
+		}
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/project_files/Android-build/SDL-android-project/src/org/hedgewars/mobile/TextImageAdapter.java	Thu Aug 04 17:34:21 2011 +0200
@@ -0,0 +1,57 @@
+package org.hedgewars.mobile;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.hedgewars.mobile.R;
+
+import android.content.Context;
+import android.graphics.Bitmap;
+import android.graphics.BitmapFactory;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.ImageView;
+import android.widget.SimpleAdapter;
+import android.widget.TextView;
+
+
+public class TextImageAdapter extends SimpleAdapter {
+
+	private Context context;
+	private ArrayList<Map<String, ?>> data;
+	
+	public TextImageAdapter(Context _context, ArrayList<Map<String, ?>> _data, int resource, String[] from, int[] to) {
+		super(_context, _data, resource, from, to);
+		context = _context;
+		data = _data;
+	}
+	
+	public static TextImageAdapter createAdapter(Context c, String[] txt, String[] img, String[] from, int[] to){
+		if(txt.length != img.length) throw new IllegalArgumentException("txt and img parameters not equal");
+		
+		ArrayList<Map<String, ?>> data = new ArrayList<Map<String, ?>>(txt.length);
+		
+		for(int i = 0; i < txt.length; i++){
+			HashMap<String, Object> map = new HashMap<String, Object>();
+			map.put("txt", txt[i]);
+			map.put("img", BitmapFactory.decodeFile(img[i]));
+			data.add(map);
+		}
+		return new TextImageAdapter(c, data, R.layout.spinner_textimg_entry, from, to);
+	}
+
+	public View getView(int position, View convertView, ViewGroup parent){
+		if(convertView == null){
+			LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
+			convertView = inflater.inflate(R.layout.spinner_textimg_entry, parent);
+		}
+		TextView tv = (TextView) convertView.findViewById(R.id.spinner_txt);
+		ImageView img = (ImageView) convertView.findViewById(R.id.spinner_img);
+		
+		tv.setText((String)data.get(position).get("txt"));
+		img.setImageBitmap((Bitmap)data.get(position).get("img"));
+		
+		return convertView;
+	}
+}