From 6e638c661b7cb92bec656ece1c0cc50617415c9b Mon Sep 17 00:00:00 2001 From: Alexey Kulish Date: Tue, 2 Aug 2016 17:05:41 +0300 Subject: [PATCH] [Quick search] fix search near --- OsmAnd/res/layout/search_dialog_fragment.xml | 1 + .../osmand/plus/activities/MapActivity.java | 16 +++-- .../plus/activities/MapActivityActions.java | 6 +- .../search/QuickSearchDialogFragment.java | 67 ++++++++++++++----- 4 files changed, 65 insertions(+), 25 deletions(-) diff --git a/OsmAnd/res/layout/search_dialog_fragment.xml b/OsmAnd/res/layout/search_dialog_fragment.xml index a786f8ba17..3c84ff74d4 100644 --- a/OsmAnd/res/layout/search_dialog_fragment.xml +++ b/OsmAnd/res/layout/search_dialog_fragment.xml @@ -24,6 +24,7 @@ android:layout_width="match_parent" android:layout_height="56dp" android:gravity="center_vertical" + android:focusableInTouchMode="true" android:orientation="horizontal"> 0 || useMapCenter ? View.VISIBLE : View.GONE); + clearButton.setVisibility(searchEditText.length() > 0 || (useMapCenter && location != null) ? View.VISIBLE : View.GONE); } else { clearButton.setVisibility(View.GONE); } @@ -846,7 +876,8 @@ public class QuickSearchDialogFragment extends DialogFragment implements OsmAndC } } - public static boolean showInstance(final MapActivity mapActivity, final String searchQuery) { + public static boolean showInstance(final MapActivity mapActivity, final String searchQuery, + final LatLon latLon) { try { if (mapActivity.isActivityDestroyed()) { @@ -855,6 +886,10 @@ public class QuickSearchDialogFragment extends DialogFragment implements OsmAndC Bundle bundle = new Bundle(); bundle.putString(QUICK_SEARCH_QUERY_KEY, searchQuery); + if (latLon != null) { + bundle.putDouble(QUICK_SEARCH_LAT_KEY, latLon.getLatitude()); + bundle.putDouble(QUICK_SEARCH_LON_KEY, latLon.getLongitude()); + } QuickSearchDialogFragment fragment = new QuickSearchDialogFragment(); fragment.setArguments(bundle); fragment.show(mapActivity.getSupportFragmentManager(), TAG);