From d9633834f5aab8786f77f954fe4f9ba37d984084 Mon Sep 17 00:00:00 2001 From: Victor Shcherb Date: Thu, 15 Jul 2010 09:48:48 +0000 Subject: [PATCH] bugfix and voice information git-svn-id: https://osmand.googlecode.com/svn/trunk@343 e29c36b1-1cfa-d876-8d93-3434fc2bb7b8 --- .../src/com/osmand/ToDoConstants.java | 34 +++++++++---------- OsmAnd/res/menu/map_menu.xml | 1 + OsmAnd/res/values-ru/strings.xml | 2 ++ OsmAnd/res/values/strings.xml | 2 ++ .../osmand/BaseLocationIndexRepository.java | 8 ++--- OsmAnd/src/com/osmand/OsmandSettings.java | 14 ++++++++ .../com/osmand/activities/MapActivity.java | 14 ++++++++ OsmAnd/src/com/osmand/views/OsmBugsLayer.java | 8 ++--- 8 files changed, 58 insertions(+), 25 deletions(-) diff --git a/DataExtractionOSM/src/com/osmand/ToDoConstants.java b/DataExtractionOSM/src/com/osmand/ToDoConstants.java index 8ac9cc360f..2febd44285 100644 --- a/DataExtractionOSM/src/com/osmand/ToDoConstants.java +++ b/DataExtractionOSM/src/com/osmand/ToDoConstants.java @@ -16,28 +16,23 @@ public class ToDoConstants { // TODO ANDROID // for 0.3 - // 60. Audio guidance for routing ! // 68. Implement service to app work with screen offline - // (introduce special settings how often update location to monitoring & audio guidance) + // (introduce special settings how often update location to monitoring & audio guidance & add new item to status bar) // Improvement : Show stops in the transport route on the map // Improvement : redesign poi selecting (show on map ) /// Better : improve zooming (better zoom out) - // Add menu mute for voice - // BUG with search area for poi/transport bounds region - // BUG with foot navigation (unavailable for cloudmade) // BUG animated move more precise check final location - // BUG turn concatenation - /// BUG Settings for osm bug creator name (save) - // BUG 9 - - // 69. Add phone information to POI + // BUG 9! + // BUG delete file if download failed !!! (check it) + // BUG add button show my location + // TODO update site with voice information + // 43. Enable poi filter by name (find lake by name or shop) - case sensitive search DB - make only search filter (on UI)! + // Not clear if it is really needed - // 43. Enable poi filter by name (find lake by name or shop) - case sensitive search DB - make only search filter (on UI)! - // 45. Get clear settings. Move that setting on top settings screen. - // That setting should rule all activities that use internet. It should ask whenever internet is used - // (would you like to use internet for that operation - if using internet is not checked). - // Internet using now for : edit POI osm, show osm bugs layer, download tiles. + // 69. Add phone information to POI + // 70. Show building numbers over map + // Unscheduled (complex) // 66. Transport routing (show next stop, total distance, show stop get out) (?). @@ -59,12 +54,17 @@ public class ToDoConstants { // BUGS Swing // DONE ANDROID : + // 45. Get clear settings. Move that setting on top settings screen. + // That setting should rule all activities that use internet. It should ask whenever internet is used + // (would you like to use internet for that operation - if using internet is not checked). + // Internet using now for : edit POI osm, show osm bugs layer, download tiles - not needed. + // 58. Upload/Download zip-index from site & unzip them on phone + // 69. Multitouch zoom, animated zoom, animate map shift (when select some point to see)! + // 60. Audio guidance for routing ! // 61. Provide route information for YOURS (calclate turns/angle/expected time) // Fix some missing turns in CloudMade (for secondary roads wo name). Add them (if dist to prev/next turn > 150m) [dacha] ! // 33. Build transport locations. Create transport index (transport-stops) (investigate) // Not implemented : show key/transit stops on map, follow mode (show next stop) - // 58. Upload/Download zip-index from site & unzip them on phone - // 69. Multitouch zoom, animated zoom, animate map shift (when select some point to see)! // DONE SWING diff --git a/OsmAnd/res/menu/map_menu.xml b/OsmAnd/res/menu/map_menu.xml index f41957cb1d..93b81e92de 100644 --- a/OsmAnd/res/menu/map_menu.xml +++ b/OsmAnd/res/menu/map_menu.xml @@ -4,6 +4,7 @@ + diff --git a/OsmAnd/res/values-ru/strings.xml b/OsmAnd/res/values-ru/strings.xml index e4f0a0c5d8..8c40438cef 100644 --- a/OsmAnd/res/values-ru/strings.xml +++ b/OsmAnd/res/values-ru/strings.xml @@ -1,5 +1,7 @@ +Без звука + Звук Не использовать Выберите голос для маршрутизации Голосовые данные diff --git a/OsmAnd/res/values/strings.xml b/OsmAnd/res/values/strings.xml index fba6f048df..803994667a 100644 --- a/OsmAnd/res/values/strings.xml +++ b/OsmAnd/res/values/strings.xml @@ -1,5 +1,7 @@ + Mute off + Mute Not use Choose voice data for routing Voice data diff --git a/OsmAnd/src/com/osmand/BaseLocationIndexRepository.java b/OsmAnd/src/com/osmand/BaseLocationIndexRepository.java index 07131b5cc5..fd0d2e7dd2 100644 --- a/OsmAnd/src/com/osmand/BaseLocationIndexRepository.java +++ b/OsmAnd/src/com/osmand/BaseLocationIndexRepository.java @@ -57,10 +57,10 @@ public class BaseLocationIndexRepository { Cursor query = db.query(tableLocation, new String[]{"MAX(latitude)", "MAX(longitude)", "MIN(latitude)", "MIN(longitude)"}, null, null,null, null, null); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ if(query.moveToFirst()){ - dataTopLatitude = query.getDouble(0); - dataRightLongitude = query.getDouble(1); - dataBottomLatitude = query.getDouble(2); - dataLeftLongitude = query.getDouble(3); + dataTopLatitude = query.getDouble(0) + 2; + dataRightLongitude = query.getDouble(1) + 2.5; + dataBottomLatitude = query.getDouble(2) - 2; + dataLeftLongitude = query.getDouble(3) - 2.5; } query.close(); if (log.isDebugEnabled()) { diff --git a/OsmAnd/src/com/osmand/OsmandSettings.java b/OsmAnd/src/com/osmand/OsmandSettings.java index 6bbb5def34..c323cf316e 100644 --- a/OsmAnd/src/com/osmand/OsmandSettings.java +++ b/OsmAnd/src/com/osmand/OsmandSettings.java @@ -94,6 +94,20 @@ public class OsmandSettings { return prefs.edit().putString(USER_NAME, name).commit(); } + + // this value string is synchronized with settings_pref.xml preference name + public static final String USER_OSM_BUG_NAME = "user_osm_bug_name"; //$NON-NLS-1$ + + public static String getUserNameForOsmBug(Context ctx) { + SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE); + return prefs.getString(USER_OSM_BUG_NAME, "NoName"); //$NON-NLS-1$ + } + + public static boolean setUserNameForOsmBug(Context ctx, String name) { + SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE); + return prefs.edit().putString(USER_OSM_BUG_NAME, name).commit(); + } + public static final String USER_PASSWORD = "user_password"; //$NON-NLS-1$ public static String getUserPassword(Context ctx){ SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE); diff --git a/OsmAnd/src/com/osmand/activities/MapActivity.java b/OsmAnd/src/com/osmand/activities/MapActivity.java index 295257cd7c..d6615432e1 100644 --- a/OsmAnd/src/com/osmand/activities/MapActivity.java +++ b/OsmAnd/src/com/osmand/activities/MapActivity.java @@ -116,6 +116,7 @@ public class MapActivity extends Activity implements IMapLocationListener, Senso private boolean sensorRegistered = false; private MenuItem navigateToPointMenu; + private MenuItem muteMenu; private NotificationManager mNotificationManager; private Handler mapPositionHandler = null; private int APP_NOTIFICATION_ID; @@ -747,12 +748,21 @@ public class MapActivity extends Activity implements IMapLocationListener, Senso navigateToPointMenu.setVisible(false); } } + if(muteMenu != null){ + muteMenu.setTitle(routingHelper.getVoiceRouter().isMute() ? R.string.menu_mute_on : R.string.menu_mute_off); + if (routingHelper.getFinalLocation() != null && routingHelper.isFollowingMode()) { + muteMenu.setVisible(true); + } else { + muteMenu.setVisible(false); + } + } } public boolean onCreateOptionsMenu(Menu menu) { MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.map_menu, menu); navigateToPointMenu = menu.findItem(R.id.map_navigate_to_point); + muteMenu = menu.findItem(R.id.map_mute); updateNavigateToPointMenu(); return true; } @@ -785,6 +795,10 @@ public class MapActivity extends Activity implements IMapLocationListener, Senso } else if (item.getItemId() == R.id.map_specify_point) { openChangeLocationDialog(); return true; + } else if (item.getItemId() == R.id.map_mute) { + routingHelper.getVoiceRouter().setMute(!routingHelper.getVoiceRouter().isMute()); + updateNavigateToPointMenu(); + return true; } else if (item.getItemId() == R.id.map_navigate_to_point) { if(navigationLayer.getPointToNavigate() != null){ if(routingHelper.getFinalLocation() != null){ diff --git a/OsmAnd/src/com/osmand/views/OsmBugsLayer.java b/OsmAnd/src/com/osmand/views/OsmBugsLayer.java index 97e6384f97..99874a11af 100644 --- a/OsmAnd/src/com/osmand/views/OsmBugsLayer.java +++ b/OsmAnd/src/com/osmand/views/OsmBugsLayer.java @@ -347,7 +347,7 @@ public class OsmBugsLayer implements OsmandMapLayer { builder.setTitle(R.string.osb_add_dialog_title); final View view = layoutInflater.inflate(R.layout.open_bug, null); builder.setView(view); - ((EditText)view.findViewById(R.id.AuthorName)).setText(OsmandSettings.getUserName(ctx)); + ((EditText)view.findViewById(R.id.AuthorName)).setText(OsmandSettings.getUserNameForOsmBug(ctx)); builder.setNegativeButton(R.string.default_buttons_cancel, null); builder.setPositiveButton(R.string.default_buttons_add, new DialogInterface.OnClickListener() { @Override @@ -355,7 +355,7 @@ public class OsmBugsLayer implements OsmandMapLayer { String text = ((EditText)view.findViewById(R.id.BugMessage)).getText().toString(); String author = ((EditText)view.findViewById(R.id.AuthorName)).getText().toString(); // do not set name as author it is ridiculous in that case -// OsmandSettings.setUserName(ctx, author); + OsmandSettings.setUserNameForOsmBug(ctx, author); boolean bug = createNewBug(latitude, longitude, text, author); if (bug) { @@ -377,14 +377,14 @@ public class OsmBugsLayer implements OsmandMapLayer { builder.setTitle(R.string.osb_comment_dialog_title); final View view = layoutInflater.inflate(R.layout.open_bug, null); builder.setView(view); - ((EditText)view.findViewById(R.id.AuthorName)).setText(OsmandSettings.getUserName(ctx)); + ((EditText)view.findViewById(R.id.AuthorName)).setText(OsmandSettings.getUserNameForOsmBug(ctx)); builder.setNegativeButton(R.string.default_buttons_cancel, null); builder.setPositiveButton(R.string.osb_comment_dialog_add_button, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { String text = ((EditText)view.findViewById(R.id.BugMessage)).getText().toString(); String author = ((EditText)view.findViewById(R.id.AuthorName)).getText().toString(); -// OsmandSettings.setUserName(ctx, author); + OsmandSettings.setUserNameForOsmBug(ctx, author); boolean added = addingComment(bug.getId(), text, author); if (added) { Toast.makeText(ctx, ctx.getResources().getString(R.string.osb_comment_dialog_success), Toast.LENGTH_LONG).show();