Fix issue 488, search history for navigate to
This commit is contained in:
parent
796d4a27a6
commit
821e612722
7 changed files with 16 additions and 10 deletions
|
@ -779,8 +779,14 @@ public class OsmandSettings {
|
|||
return globalPreferences.edit().remove(POINT_NAVIGATE_LAT).remove(POINT_NAVIGATE_LON).commit();
|
||||
}
|
||||
|
||||
public boolean setPointToNavigate(double latitude, double longitude) {
|
||||
return globalPreferences.edit().putFloat(POINT_NAVIGATE_LAT, (float) latitude).putFloat(POINT_NAVIGATE_LON, (float) longitude).commit();
|
||||
public boolean setPointToNavigate(double latitude, double longitude, String historyDescription) {
|
||||
boolean add = globalPreferences.edit().putFloat(POINT_NAVIGATE_LAT, (float) latitude).putFloat(POINT_NAVIGATE_LON, (float) longitude).commit();
|
||||
if(add){
|
||||
if(historyDescription != null){
|
||||
SearchHistoryHelper.getInstance().addNewItemToHistory(latitude, longitude, historyDescription, ctx);
|
||||
}
|
||||
}
|
||||
return add;
|
||||
}
|
||||
|
||||
public static final String LAST_SEARCHED_REGION = "last_searched_region"; //$NON-NLS-1$
|
||||
|
|
|
@ -133,8 +133,7 @@ public class FavouritesActivity extends ListActivity {
|
|||
AdapterContextMenuInfo menuInfo = (AdapterContextMenuInfo) aItem.getMenuInfo();
|
||||
final FavouritePoint point = (FavouritePoint) favouritesAdapter.getItem(menuInfo.position);
|
||||
if (aItem.getItemId() == NAVIGATE_TO) {
|
||||
//OsmandSettings.setMapLocationToShow(this, point.getLatitude(), point.getLongitude(), getString(R.string.favorite)+" : " + point.getName()); //$NON-NLS-1$
|
||||
OsmandSettings.getOsmandSettings(this).setPointToNavigate(point.getLatitude(), point.getLongitude());
|
||||
OsmandSettings.getOsmandSettings(this).setPointToNavigate(point.getLatitude(), point.getLongitude(), getString(R.string.favorite)+" : " + point.getName());
|
||||
Intent newIntent = new Intent(FavouritesActivity.this, MapActivity.class);
|
||||
startActivity(newIntent);
|
||||
} else if (aItem.getItemId() == EDIT_ITEM) {
|
||||
|
|
|
@ -568,7 +568,7 @@ public class MapActivity extends Activity implements IMapLocationListener, Senso
|
|||
|
||||
public void navigateToPoint(LatLon point){
|
||||
if(point != null){
|
||||
settings.setPointToNavigate(point.getLatitude(), point.getLongitude());
|
||||
settings.setPointToNavigate(point.getLatitude(), point.getLongitude(), null);
|
||||
} else {
|
||||
settings.clearPointToNavigate();
|
||||
}
|
||||
|
@ -1228,7 +1228,7 @@ public class MapActivity extends Activity implements IMapLocationListener, Senso
|
|||
LatLon endPoint = endForRouting;
|
||||
if((endPoint == null || !props[1]) && !l.isEmpty()){
|
||||
LatLon point = new LatLon(l.get(l.size() - 1).getLatitude(), l.get(l.size() - 1).getLongitude());
|
||||
settings.setPointToNavigate(point.getLatitude(), point.getLongitude());
|
||||
settings.setPointToNavigate(point.getLatitude(), point.getLongitude(), null);
|
||||
endPoint = point;
|
||||
mapLayers.getNavigationLayer().setPointToNavigate(point);
|
||||
}
|
||||
|
|
|
@ -129,7 +129,7 @@ public class NavigatePointActivity extends Activity {
|
|||
double lon = convert(((TextView) findViewById(R.id.LongitudeEdit)).getText().toString());
|
||||
|
||||
if(navigate){
|
||||
OsmandSettings.getOsmandSettings(this).setPointToNavigate(lat, lon);
|
||||
OsmandSettings.getOsmandSettings(this).setPointToNavigate(lat, lon, MessageFormat.format(getString(R.string.search_history_navigate_to), lat, lon));
|
||||
} else {
|
||||
// in case when it is dialog
|
||||
if(activity != null) {
|
||||
|
|
|
@ -202,7 +202,7 @@ public class SearchAddressActivity extends Activity {
|
|||
}
|
||||
if (l != null) {
|
||||
if(navigateTo){
|
||||
osmandSettings.setPointToNavigate(l.getLatitude(), l.getLongitude());
|
||||
osmandSettings.setPointToNavigate(l.getLatitude(), l.getLongitude(), historyName);
|
||||
} else {
|
||||
osmandSettings.setMapLocationToShow(l.getLatitude(), l.getLongitude(), zoom, historyName);
|
||||
}
|
||||
|
|
|
@ -81,7 +81,7 @@ public class SearchHistoryActivity extends ListActivity {
|
|||
if (which == 0) {
|
||||
OsmandSettings.getOsmandSettings(SearchHistoryActivity.this).setMapLocationToShow(entry.getLat(), entry.getLon());
|
||||
} else if (which == 1) {
|
||||
OsmandSettings.getOsmandSettings(SearchHistoryActivity.this).setPointToNavigate(entry.getLat(), entry.getLon());
|
||||
OsmandSettings.getOsmandSettings(SearchHistoryActivity.this).setPointToNavigate(entry.getLat(), entry.getLon(), null);
|
||||
}
|
||||
|
||||
Intent newIntent = new Intent(SearchHistoryActivity.this, MapActivity.class);
|
||||
|
|
|
@ -234,7 +234,8 @@ public class SearchPOIActivity extends ListActivity implements SensorEventListen
|
|||
Math.max(16, z), getString(R.string.poi)+" : " + poiSimpleFormat); //$NON-NLS-1$
|
||||
} else if(which == 1){
|
||||
LatLon l = amenity.getLocation();
|
||||
settings.setPointToNavigate(l.getLatitude(), l.getLongitude());
|
||||
String poiSimpleFormat = OsmAndFormatter.getPoiSimpleFormat(amenity, SearchPOIActivity.this, settings.usingEnglishNames());
|
||||
settings.setPointToNavigate(l.getLatitude(), l.getLongitude(), getString(R.string.poi)+" : " + poiSimpleFormat);
|
||||
}
|
||||
if(filter != null){
|
||||
settings.setPoiFilterForMap(filter.getFilterId());
|
||||
|
|
Loading…
Reference in a new issue