Added quick search call on map activity start

This commit is contained in:
Alexey Kulish 2017-04-18 12:02:51 +03:00 committed by Victor Shcherb
parent 3a15e48750
commit 8e218323dc
3 changed files with 28 additions and 4 deletions

View file

@ -1644,6 +1644,17 @@ public class OsmandSettings {
private Object objectToShow;
private boolean editObjectToShow;
private String searchRequestToShow;
public void setSearchRequestToShow(String request) {
this.searchRequestToShow = request;
}
public String getAndClearSearchRequestToShow() {
String searchRequestToShow = this.searchRequestToShow;
this.searchRequestToShow = null;
return searchRequestToShow;
}
public Object getAndClearObjectToShow() {
Object objectToShow = this.objectToShow;

View file

@ -791,6 +791,7 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
Object toShow = settings.getAndClearObjectToShow();
boolean editToShow = settings.getAndClearEditObjectToShow();
int status = settings.isRouteToPointNavigateAndClear();
String searchRequestToShow = settings.getAndClearSearchRequestToShow();
if (status != 0) {
// always enable and follow and let calculate it (i.e.GPS is not accessible in a garage)
Location loc = new Location("map");
@ -801,6 +802,9 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
dashboardOnMap.hideDashboard();
}
}
if (searchRequestToShow != null) {
showQuickSearch(searchRequestToShow);
}
if (latLonToShow != null) {
if (dashboardOnMap.isVisible()) {
dashboardOnMap.hideDashboard();
@ -1509,6 +1513,17 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
QuickSearchType.REGULAR, QuickSearchTab.CATEGORIES, new LatLon(latitude, longitude));
}
public void showQuickSearch(String searchQuery) {
hideContextMenu();
QuickSearchDialogFragment fragment = getQuickSearchDialogFragment();
if (fragment != null) {
fragment.dismiss();
refreshMap();
}
QuickSearchDialogFragment.showInstance(this, searchQuery, null,
QuickSearchType.REGULAR, QuickSearchTab.CATEGORIES, null);
}
public void showQuickSearch(Object object) {
hideContextMenu();
QuickSearchDialogFragment fragment = getQuickSearchDialogFragment();

View file

@ -142,8 +142,8 @@ public class GeoIntentActivity extends OsmandListActivity {
@Override
protected void onPostExecute(GeoPointParserUtil.GeoParsedPoint p ) {
progress.dismiss();
OsmandSettings settings = getMyApplication().getSettings();
if (p != null && p.isGeoPoint()) {
OsmandSettings settings = getMyApplication().getSettings();
PointDescription pd = new PointDescription(p.getLatitude(), p.getLongitude());
if(!Algorithms.isEmpty(p.getLabel())) {
pd.setName(p.getLabel());
@ -154,10 +154,8 @@ public class GeoIntentActivity extends OsmandListActivity {
}
Uri uri = intent.getData();
String searchString = p != null && p.isGeoAddress() ? p.getLabel() : uri.toString();
// TODO
settings.setSearchRequestToShow(searchString);
MapActivity.launchMapActivityMoveToTop(GeoIntentActivity.this);
}
}