\r
package org.navitproject.navit;\r
\r
-import java.util.ArrayList;\r
import java.util.HashMap;\r
-import java.util.List;\r
\r
import android.app.Activity;\r
import android.app.AlertDialog;\r
import android.os.Bundle;\r
import android.os.Message;\r
import android.util.Log;\r
-import android.util.Pair;\r
import android.view.View;\r
import android.widget.ExpandableListView;\r
import android.widget.RelativeLayout;\r
\r
public class NavitDownloadSelectMapActivity extends ExpandableListActivity {\r
\r
- private static Pair<List<HashMap<String, String>>, ArrayList<ArrayList<HashMap<String, String>>> >\r
- mapMenu = null;\r
-\r
+ private NavitMapDownloader.MapMenu mapMenu = null;\r
\r
@Override\r
public void onCreate(Bundle savedInstanceState) {\r
\r
SimpleExpandableListAdapter adapter =\r
new SimpleExpandableListAdapter(this,\r
- mapMenu.first,\r
- android.R.layout.simple_expandable_list_item_1, // Group itemlayout XML.\r
- new String[] { "category_name" }, // the key of group item.\r
- new int[] { android.R.id.text1 }, // ID of each group\r
- // item.-Data under the key\r
- // goes into this\r
- mapMenu.second, // childData describes second-level\r
- // entries.\r
- android.R.layout.simple_expandable_list_item_1, // Layout for sub-level\r
- // entries(second level).\r
- new String[] { "map_name" }, // Keys in childData maps\r
- // to display.\r
- new int[] { android.R.id.text1 } // Data under the keys\r
- // above go into these\r
- // TextViews.\r
+ mapMenu.groupList,\r
+ android.R.layout.simple_expandable_list_item_1,\r
+ new String[] { "category_name" },\r
+ new int[] { android.R.id.text1 },\r
+ mapMenu.childList,\r
+ android.R.layout.simple_expandable_list_item_1, \r
+ new String[] { "map_name" },\r
+ new int[] { android.R.id.text1 }\r
);\r
setListAdapter(adapter);\r
setTitle(String.valueOf(NavitMapDownloader.getFreeSpace()/1024/1024) + "MB available");\r
public boolean onChildClick(ExpandableListView parent, View v, int groupPosition, int childPosition, long id) {\r
super.onChildClick(parent, v, groupPosition, childPosition, id);\r
Log.d("Navit", "p:" + groupPosition + ", child_pos:" + childPosition);\r
- HashMap<String, String> map = mapMenu.second.get(groupPosition).get(childPosition);\r
- \r
+ HashMap<String, String> map = mapMenu.childList.get(groupPosition).get(childPosition);\r
+\r
String map_index = map.get("map_index");\r
if (map_index != null) {\r
Intent resultIntent = new Intent();\r
\r
import android.os.StatFs;\r
import android.util.Log;\r
-import android.util.Pair;\r
\r
public class NavitMapDownloader extends Thread\r
{\r
this.level = level;\r
}\r
}\r
+ \r
+ public static class MapMenu {\r
+ List<HashMap<String, String>> groupList;\r
+ ArrayList<ArrayList<HashMap<String, String>>> childList;\r
+\r
+ MapMenu(List<HashMap<String, String>> groups, ArrayList<ArrayList<HashMap<String, String>>> childs) {\r
+ groupList = groups;\r
+ childList = childs;\r
+ }\r
+ }\r
+\r
//\r
// define the maps here\r
//\r
this.map_values = osm_maps[map_id];\r
}\r
\r
- public static Pair<List<HashMap<String, String>>, ArrayList<ArrayList<HashMap<String, String>>>> getMenu() {\r
+ public static MapMenu getMenu() {\r
ArrayList<HashMap<String, String>> resultGroups = new ArrayList<HashMap<String, String>>();\r
ArrayList<ArrayList<HashMap<String, String>>> resultChilds =\r
new ArrayList<ArrayList<HashMap<String, String>>>();\r
}\r
resultChilds.add(secList);\r
\r
- return new Pair<List<HashMap<String, String>>, ArrayList<ArrayList<HashMap<String, String>>>>(resultGroups,\r
- resultChilds);\r
+ return new MapMenu(resultGroups, resultChilds);\r
}\r
\r
public int download_osm_map(osm_map_values map_values)\r