Added quick search call on map activity start
This commit is contained in:
parent
58c3e89efb
commit
653f8be03e
3 changed files with 28 additions and 4 deletions
|
@ -1644,6 +1644,17 @@ public class OsmandSettings {
|
||||||
|
|
||||||
private Object objectToShow;
|
private Object objectToShow;
|
||||||
private boolean editObjectToShow;
|
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() {
|
public Object getAndClearObjectToShow() {
|
||||||
Object objectToShow = this.objectToShow;
|
Object objectToShow = this.objectToShow;
|
||||||
|
|
|
@ -791,6 +791,7 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
|
||||||
Object toShow = settings.getAndClearObjectToShow();
|
Object toShow = settings.getAndClearObjectToShow();
|
||||||
boolean editToShow = settings.getAndClearEditObjectToShow();
|
boolean editToShow = settings.getAndClearEditObjectToShow();
|
||||||
int status = settings.isRouteToPointNavigateAndClear();
|
int status = settings.isRouteToPointNavigateAndClear();
|
||||||
|
String searchRequestToShow = settings.getAndClearSearchRequestToShow();
|
||||||
if (status != 0) {
|
if (status != 0) {
|
||||||
// always enable and follow and let calculate it (i.e.GPS is not accessible in a garage)
|
// always enable and follow and let calculate it (i.e.GPS is not accessible in a garage)
|
||||||
Location loc = new Location("map");
|
Location loc = new Location("map");
|
||||||
|
@ -801,6 +802,9 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
|
||||||
dashboardOnMap.hideDashboard();
|
dashboardOnMap.hideDashboard();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (searchRequestToShow != null) {
|
||||||
|
showQuickSearch(searchRequestToShow);
|
||||||
|
}
|
||||||
if (latLonToShow != null) {
|
if (latLonToShow != null) {
|
||||||
if (dashboardOnMap.isVisible()) {
|
if (dashboardOnMap.isVisible()) {
|
||||||
dashboardOnMap.hideDashboard();
|
dashboardOnMap.hideDashboard();
|
||||||
|
@ -1509,6 +1513,17 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
|
||||||
QuickSearchType.REGULAR, QuickSearchTab.CATEGORIES, new LatLon(latitude, longitude));
|
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) {
|
public void showQuickSearch(Object object) {
|
||||||
hideContextMenu();
|
hideContextMenu();
|
||||||
QuickSearchDialogFragment fragment = getQuickSearchDialogFragment();
|
QuickSearchDialogFragment fragment = getQuickSearchDialogFragment();
|
||||||
|
|
|
@ -142,8 +142,8 @@ public class GeoIntentActivity extends OsmandListActivity {
|
||||||
@Override
|
@Override
|
||||||
protected void onPostExecute(GeoPointParserUtil.GeoParsedPoint p ) {
|
protected void onPostExecute(GeoPointParserUtil.GeoParsedPoint p ) {
|
||||||
progress.dismiss();
|
progress.dismiss();
|
||||||
|
OsmandSettings settings = getMyApplication().getSettings();
|
||||||
if (p != null && p.isGeoPoint()) {
|
if (p != null && p.isGeoPoint()) {
|
||||||
OsmandSettings settings = getMyApplication().getSettings();
|
|
||||||
PointDescription pd = new PointDescription(p.getLatitude(), p.getLongitude());
|
PointDescription pd = new PointDescription(p.getLatitude(), p.getLongitude());
|
||||||
if(!Algorithms.isEmpty(p.getLabel())) {
|
if(!Algorithms.isEmpty(p.getLabel())) {
|
||||||
pd.setName(p.getLabel());
|
pd.setName(p.getLabel());
|
||||||
|
@ -154,10 +154,8 @@ public class GeoIntentActivity extends OsmandListActivity {
|
||||||
}
|
}
|
||||||
Uri uri = intent.getData();
|
Uri uri = intent.getData();
|
||||||
String searchString = p != null && p.isGeoAddress() ? p.getLabel() : uri.toString();
|
String searchString = p != null && p.isGeoAddress() ? p.getLabel() : uri.toString();
|
||||||
|
settings.setSearchRequestToShow(searchString);
|
||||||
// TODO
|
|
||||||
MapActivity.launchMapActivityMoveToTop(GeoIntentActivity.this);
|
MapActivity.launchMapActivityMoveToTop(GeoIntentActivity.this);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue