Fix:android:Minor cleanup
authorrikky <rikky@ffa7fe5e-494d-0410-b361-a75ebd5db220>
Mon, 28 Mar 2011 22:53:33 +0000 (22:53 +0000)
committerrikky <rikky@ffa7fe5e-494d-0410-b361-a75ebd5db220>
Mon, 28 Mar 2011 22:53:33 +0000 (22:53 +0000)
git-svn-id: https://navit.svn.sourceforge.net/svnroot/navit/trunk@4399 ffa7fe5e-494d-0410-b361-a75ebd5db220

navit/navit/android/src/org/navitproject/navit/NavitDownloadSelectMapActivity.java
navit/navit/android/src/org/navitproject/navit/NavitMapDownloader.java

index 3a2a31a..a10aa7d 100644 (file)
@@ -38,10 +38,9 @@ public class NavitDownloadSelectMapActivity extends ListActivity
        {\r
                super.onCreate(savedInstanceState);\r
 \r
-               NavitMapDownloader.init();\r
                ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,\r
                                android.R.layout.simple_list_item_1,\r
-                               NavitMapDownloader.OSM_MAP_NAME_LIST_inkl_SIZE_ESTIMATE);\r
+                               NavitMapDownloader.getMenu());\r
                setListAdapter(adapter);\r
        }\r
 \r
index c0d7e68..2b19525 100644 (file)
@@ -35,7 +35,7 @@ import android.util.Log;
 \r
 public class NavitMapDownloader extends Thread\r
 {\r
-       public static class osm_map_values\r
+       private static class osm_map_values\r
        {\r
                String  lon1;\r
                String  lat1;\r
@@ -152,26 +152,26 @@ public class NavitMapDownloader extends Thread
                new osm_map_values("Venezuela", "-73.6","0.4", "-59.7","12.8", 64838882L, 1)\r
        };\r
 \r
-       public static String[]                  OSM_MAP_NAME_LIST_inkl_SIZE_ESTIMATE    = null;\r
+       private static String[]              OSM_MAP_NAME_LIST_inkl_SIZE_ESTIMATE    = null;\r
 \r
-       public static int[]                             OSM_MAP_NAME_ORIG_ID_LIST                                       = null;\r
+       public static int[]                 OSM_MAP_NAME_ORIG_ID_LIST               = null;\r
 \r
-       public Boolean                                          stop_me                                                                                 = false;\r
-       static final int                                        SOCKET_CONNECT_TIMEOUT                                          = 25000;                                                        // 25 secs.\r
-       static final int                                        SOCKET_READ_TIMEOUT                                                     = 15000;                                                        // 15 secs.\r
-       static final int                                        MAP_WRITE_FILE_BUFFER                                           = 1024 * 64;\r
-       static final int                                        MAP_WRITE_MEM_BUFFER                                                    = 1024 * 64;\r
-       static final int                                        MAP_READ_FILE_BUFFER                                                    = 1024 * 64;\r
-       static final int                                        UPDATE_PROGRESS_EVERY_CYCLE                             = 20;\r
-       static final int                MAX_RETRIES                              = 5;\r
-       static final String                             MAP_FILENAME_PRI                                                                = "navitmap.bin";\r
-       static final String                             MAP_FILENAME_NUM                                                                = "navitmap_%03d.bin";\r
-       static final String                             MAP_FILENAME_PATH                                                               = Navit.MAP_FILENAME_PATH;\r
+       private Boolean                     stop_me                                 = false;\r
+       private static final int            SOCKET_CONNECT_TIMEOUT                  = 25000;                    // 25 secs.\r
+       private static final int            SOCKET_READ_TIMEOUT                     = 15000;                    // 15 secs.\r
+       private static final int            MAP_WRITE_FILE_BUFFER                   = 1024 * 64;\r
+       private static final int            MAP_WRITE_MEM_BUFFER                    = 1024 * 64;\r
+       private static final int            MAP_READ_FILE_BUFFER                    = 1024 * 64;\r
+       private static final int            UPDATE_PROGRESS_EVERY_CYCLE             = 20;\r
+       private static final int            MAX_RETRIES                             = 5;\r
+       private static final String         MAP_FILENAME_PRI                        = "navitmap.bin";\r
+       private static final String         MAP_FILENAME_NUM                        = "navitmap_%03d.bin";\r
+       private static final String         MAP_FILENAME_PATH                       = Navit.MAP_FILENAME_PATH;\r
 \r
-       Handler                 mHandler;\r
-       osm_map_values  map_values;\r
-       private int                             map_slot;\r
-       private int                             dialog_num;\r
+       private Handler                     mHandler;\r
+       private osm_map_values              map_values;\r
+       private int                         map_slot;\r
+       private int                         dialog_num;\r
 \r
        public void run()\r
        {\r
@@ -211,22 +211,21 @@ public class NavitMapDownloader extends Thread
                Log.d("NavitMapDownloader", "stop_me -> true");\r
        }\r
 \r
-       public Navit    navit_jmain     = null;\r
-\r
        public NavitMapDownloader(Navit main, Handler h, int map_id, int dialog_num, int map_slot)\r
        {\r
                this.mHandler = h;\r
                this.map_values = osm_maps[map_id];\r
                this.map_slot = map_slot;\r
-               this.navit_jmain = main;\r
-\r
        }\r
 \r
-       public static void init()\r
+       public static String[] getMenu()\r
        {\r
 \r
                // need only init once\r
-               if (OSM_MAP_NAME_LIST_inkl_SIZE_ESTIMATE != null) { return; }\r
+               if (OSM_MAP_NAME_LIST_inkl_SIZE_ESTIMATE != null) \r
+               { \r
+                       return OSM_MAP_NAME_LIST_inkl_SIZE_ESTIMATE;\r
+               }\r
                \r
                String menu_temp[] = new String[osm_maps.length*2];\r
                OSM_MAP_NAME_ORIG_ID_LIST = new int[osm_maps.length*2];\r
@@ -263,6 +262,7 @@ public class NavitMapDownloader extends Thread
                {\r
                        OSM_MAP_NAME_LIST_inkl_SIZE_ESTIMATE[i] = menu_temp[i];\r
                }\r
+               return OSM_MAP_NAME_LIST_inkl_SIZE_ESTIMATE;\r
        }\r
 \r
        public int download_osm_map(Handler handler, osm_map_values map_values, int map_number)\r
@@ -454,4 +454,5 @@ public class NavitMapDownloader extends Thread
                \r
                return exit_code;\r
        }\r
+\r
 }\r