From c1d66edd208d381d08b1c6fbcca497f1ce2642f0 Mon Sep 17 00:00:00 2001 From: Victor Shcherb Date: Wed, 2 Jun 2010 18:27:14 +0000 Subject: [PATCH] fix small issues git-svn-id: https://osmand.googlecode.com/svn/trunk@121 e29c36b1-1cfa-d876-8d93-3434fc2bb7b8 --- .../src/com/osmand/ToDoConstants.java | 16 ++++++-------- OsmAnd/res/values/strings.xml | 2 +- .../osmand/activities/MainMenuActivity.java | 21 +++++++++++++++---- .../search/SearchAddressActivity.java | 2 +- .../activities/search/SearchPOIActivity.java | 14 ++++++------- .../search/SearchPOIListActivity.java | 6 +++--- 6 files changed, 35 insertions(+), 26 deletions(-) diff --git a/DataExtractionOSM/src/com/osmand/ToDoConstants.java b/DataExtractionOSM/src/com/osmand/ToDoConstants.java index 8fc6a1b373..96adabb91f 100644 --- a/DataExtractionOSM/src/com/osmand/ToDoConstants.java +++ b/DataExtractionOSM/src/com/osmand/ToDoConstants.java @@ -13,7 +13,6 @@ public class ToDoConstants { // TODO ANDROID in release 0.1 -// 29. Show opened/closed amenities (in search poi). // 13. Save point as favorite & introduce favorite points dialog // 3. Revise osmand UI. Preparing new icons (revise UI 18, 2, ). Main application icon, back to location icon. // 14. Show zoom level on map @@ -23,23 +22,20 @@ public class ToDoConstants { // 16. Support open street bugs api. // 20. Implement save track/route to gpx (?) // 26. Show the whole street on map (when it is chosen in search activity). Possibly extend that story to show layer with streets. -// 30. Performance issue : introduce one place where refreshMap will be called using postMessage mechanism (delay more than > 50 ? ms). +// 30. Performance issue with map drawing : +// introduce one place where refreshMap will be called using postMessage mechanism (delay more than > 50 ? ms). +// Introducing cache of file names that are on disk (creating new File() consumes a lot of memory) // FIXME Bugs Android : - // 6. Understand concept of application where to save/restore global setting. - // (for example reset navigate to point, reset link map with location). It should be reset after user call exit. - // Call ResourceManager.close when it is needed (+) - // 10. Notification is gone after clear all notifications - // Performance improvements Android : - // 2. Introducing cache of file names that are on disk (creating new File() consumes a lot of memory) (+) - + // 10. Notification is gone after clear all notifications (TODO test) // TODO swing NOT in release 0.1 // 1. Download tiles without using dir tiles // DONE ANDROID : - +// 29. Show opened/closed amenities (in search poi). + // DONE SWING } diff --git a/OsmAnd/res/values/strings.xml b/OsmAnd/res/values/strings.xml index 0254615109..fc85a84917 100644 --- a/OsmAnd/res/values/strings.xml +++ b/OsmAnd/res/values/strings.xml @@ -49,5 +49,5 @@ Search building incrementally Choose region Choose intersected street -Closest Anemities +Closest amenities diff --git a/OsmAnd/src/com/osmand/activities/MainMenuActivity.java b/OsmAnd/src/com/osmand/activities/MainMenuActivity.java index 36e368ae5d..8b4c56cca0 100644 --- a/OsmAnd/src/com/osmand/activities/MainMenuActivity.java +++ b/OsmAnd/src/com/osmand/activities/MainMenuActivity.java @@ -132,19 +132,32 @@ public class MainMenuActivity extends Activity { startActivity(search); } }); -/* + + /* exitButton = (Button) findViewById(R.id.ExitButton); exitButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { - mNotificationManager.cancel(APP_NOTIFICATION_ID); - MainMenuActivity.this.finish(); + finishApplication(); } - });*/ + }); */ startApplication(); } + protected void finishApplication(){ + mNotificationManager.cancel(APP_NOTIFICATION_ID); + boolean force = false; + ResourceManager.getResourceManager().close(); + applicationAlreadyStarted = false; + if (force) { + int pid = android.os.Process.myPid(); + android.os.Process.killProcess(pid); + } else { + MainMenuActivity.this.finish(); + } + } + @Override public boolean onKeyDown(int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_SEARCH diff --git a/OsmAnd/src/com/osmand/activities/search/SearchAddressActivity.java b/OsmAnd/src/com/osmand/activities/search/SearchAddressActivity.java index 61317702f0..c95023ccb9 100644 --- a/OsmAnd/src/com/osmand/activities/search/SearchAddressActivity.java +++ b/OsmAnd/src/com/osmand/activities/search/SearchAddressActivity.java @@ -286,7 +286,7 @@ public class SearchAddressActivity extends Activity { Long cityId = OsmandSettings.getLastSearchedCity(this); if (!region.areCitiesPreloaded()) { progressMsg = "Loading cities..."; - } else if (cityId != -1 && region.getCityById(cityId).isEmptyWithStreets()) { + } else if (cityId != -1 && region.getCityById(cityId) != null && region.getCityById(cityId).isEmptyWithStreets()) { progressMsg = "Loading streets/buildings..."; } else if (OsmandSettings.usingEnglishNames(this) != region.useEnglishNames()) { progressMsg = "Converting native/english names..."; diff --git a/OsmAnd/src/com/osmand/activities/search/SearchPOIActivity.java b/OsmAnd/src/com/osmand/activities/search/SearchPOIActivity.java index 1b2a75f8d9..65c48b46a2 100644 --- a/OsmAnd/src/com/osmand/activities/search/SearchPOIActivity.java +++ b/OsmAnd/src/com/osmand/activities/search/SearchPOIActivity.java @@ -37,7 +37,7 @@ import com.osmand.osm.MapUtils; */ public class SearchPOIActivity extends ListActivity { - public static final String ANENITY_TYPE = "amenity_type"; + public static final String AMENITY_TYPE = "amenity_type"; private List amenityList; @@ -76,7 +76,7 @@ public class SearchPOIActivity extends ListActivity { }); Bundle bundle = this.getIntent().getExtras(); - String anemity = bundle.getString(ANENITY_TYPE); + String anemity = bundle.getString(AMENITY_TYPE); if (anemity != null) { ResourceManager resourceManager = ResourceManager.getResourceManager(); lastKnownMapLocation = OsmandSettings.getLastKnownMapLocation(this); @@ -86,7 +86,7 @@ public class SearchPOIActivity extends ListActivity { .getLongitude(), zoom, maxCount); } else { amenityList = resourceManager.searchAmenities(amenityType, lastKnownMapLocation.getLatitude(), lastKnownMapLocation - .getLongitude(), zoom, 15); + .getLongitude(), zoom, 30); } if (amenityList != null) { @@ -104,10 +104,10 @@ public class SearchPOIActivity extends ListActivity { public boolean onItemLongClick(AdapterView av, View v, int pos, long id) { Amenity amenity = amenityList.get(pos); String format = amenity.getSimpleFormat(OsmandSettings.usingEnglishNames(v.getContext())); - if(amenity.getOpeningHours() != null){ - format += "\n Opening hours : " + amenity.getOpeningHours(); - } - Toast.makeText(v.getContext(), format, Toast.LENGTH_SHORT).show(); + if (amenity.getOpeningHours() != null) { + format += "\nOpening hours : " + amenity.getOpeningHours(); + } + Toast.makeText(v.getContext(), format, Toast.LENGTH_LONG).show(); return true; } }); diff --git a/OsmAnd/src/com/osmand/activities/search/SearchPOIListActivity.java b/OsmAnd/src/com/osmand/activities/search/SearchPOIListActivity.java index 76fd6082e7..42265f994a 100644 --- a/OsmAnd/src/com/osmand/activities/search/SearchPOIListActivity.java +++ b/OsmAnd/src/com/osmand/activities/search/SearchPOIListActivity.java @@ -39,7 +39,7 @@ public class SearchPOIListActivity extends ListActivity { } private void createAmenityTypeList() { - amenityList.add(getResources().getString(R.string.Closest_Anemities)); + amenityList.add(getResources().getString(R.string.Closest_Amenities)); for (AmenityType type : AmenityType.values()) { amenityList.add(Algoritms.capitalizeFirstLetterAndLowercase(type.toString())); } @@ -52,9 +52,9 @@ public class SearchPOIListActivity extends ListActivity { Intent newIntent = new Intent(SearchPOIListActivity.this, SearchPOIActivity.class); // folder selected if (amenityType != null) { - bundle.putString(SearchPOIActivity.ANENITY_TYPE, amenityList.get(position)); + bundle.putString(SearchPOIActivity.AMENITY_TYPE, amenityList.get(position)); } else { - bundle.putString(SearchPOIActivity.ANENITY_TYPE, "Closest_Anenities"); + bundle.putString(SearchPOIActivity.AMENITY_TYPE, "Closest_Amenities"); } newIntent.putExtras(bundle); startActivityForResult(newIntent, 0);