diff --git a/OsmAnd/res/layout/search_dialog_fragment.xml b/OsmAnd/res/layout/search_dialog_fragment.xml index eaeb68b1d6..52de3ba07e 100644 --- a/OsmAnd/res/layout/search_dialog_fragment.xml +++ b/OsmAnd/res/layout/search_dialog_fragment.xml @@ -237,7 +237,7 @@ android:paddingLeft="@dimen/bottom_sheet_content_margin" android:paddingRight="@dimen/bottom_sheet_content_margin" android:paddingTop="@dimen/context_menu_padding_margin_tiny" - android:text="@string/search_no_results_description" + android:text="@string/search_no_results_feedback" android:textSize="@dimen/default_desc_text_size" osmand:typeface="@string/font_roboto_medium" /> diff --git a/OsmAnd/res/values/strings.xml b/OsmAnd/res/values/strings.xml index d906c22a7e..a2171c264a 100644 --- a/OsmAnd/res/values/strings.xml +++ b/OsmAnd/res/values/strings.xml @@ -11,6 +11,9 @@ Thx - Hardy --> + Thank you for feedback + Node or way cannot be found. + No search results?\nGive us feedback • Navigation: Fix progress bar, fast swapping of the start and end point of the route\n\n • Map markers: fix turn on/off groups, ability to hide markers from the map\n\n @@ -23,7 +26,6 @@ Increase search radius to %1$s \"%1$s\", as well as your location.

We do not collect personal information, we only need search data to improve the search algorithm.
]]>
- No results?\nTell us about this. Send search query? World Point %1$s deleted @@ -2673,7 +2675,6 @@ Favorite point {0} deleted. Edit POI Create POI - Node cannot be found, or amenity consists of several nodes, which is not yet supported. Delete {0} (comment)? Delete POI POI deleted diff --git a/OsmAnd/src/net/osmand/plus/osmedit/EditPoiDialogFragment.java b/OsmAnd/src/net/osmand/plus/osmedit/EditPoiDialogFragment.java index 6b98ab2495..b0c4877c23 100644 --- a/OsmAnd/src/net/osmand/plus/osmedit/EditPoiDialogFragment.java +++ b/OsmAnd/src/net/osmand/plus/osmedit/EditPoiDialogFragment.java @@ -707,7 +707,7 @@ public class EditPoiDialogFragment extends BaseOsmAndDialogFragment { fragment.show(activity.getSupportFragmentManager(), TAG); } else { Toast.makeText(activity, - activity.getString(R.string.poi_error_poi_not_found), + activity.getString(R.string.poi_cannot_be_found), Toast.LENGTH_LONG).show(); } } @@ -777,7 +777,7 @@ public class EditPoiDialogFragment extends BaseOsmAndDialogFragment { public void deletePoiWithDialog(final Entity entity) { if (entity == null) { - Toast.makeText(activity, activity.getResources().getString(R.string.poi_error_poi_not_found), Toast.LENGTH_LONG).show(); + Toast.makeText(activity, activity.getResources().getString(R.string.poi_cannot_be_found), Toast.LENGTH_LONG).show(); return; } AlertDialog.Builder builder = new AlertDialog.Builder(activity); diff --git a/OsmAnd/src/net/osmand/plus/search/QuickSearchDialogFragment.java b/OsmAnd/src/net/osmand/plus/search/QuickSearchDialogFragment.java index 11ea4bd863..5855b02251 100644 --- a/OsmAnd/src/net/osmand/plus/search/QuickSearchDialogFragment.java +++ b/OsmAnd/src/net/osmand/plus/search/QuickSearchDialogFragment.java @@ -645,10 +645,10 @@ public class QuickSearchDialogFragment extends DialogFragment implements OsmAndC if (!app.getSettings().isInternetConnectionAvailable()) { Toast.makeText(app, R.string.internet_not_available, Toast.LENGTH_LONG).show(); } else { - if (location != null && searchQuery != null) { + if (searchQuery != null) { Bundle args = new Bundle(); SendSearchQueryBottomSheet fragment = new SendSearchQueryBottomSheet(); - args.putString(MISSING_SEARCH_LOCATION_KEY, location.toString()); + args.putString(MISSING_SEARCH_LOCATION_KEY, String.valueOf(location)); args.putString(MISSING_SEARCH_QUERY_KEY, searchQuery); fragment.setArguments(args); fragment.show(mapActivity.getSupportFragmentManager(), SendSearchQueryBottomSheet.TAG); diff --git a/OsmAnd/src/net/osmand/plus/search/SendSearchQueryBottomSheet.java b/OsmAnd/src/net/osmand/plus/search/SendSearchQueryBottomSheet.java index 936f73e0d7..bfb171ecce 100644 --- a/OsmAnd/src/net/osmand/plus/search/SendSearchQueryBottomSheet.java +++ b/OsmAnd/src/net/osmand/plus/search/SendSearchQueryBottomSheet.java @@ -17,6 +17,10 @@ import net.osmand.plus.base.bottomsheetmenu.SimpleBottomSheetItem; import net.osmand.plus.base.bottomsheetmenu.simpleitems.TitleItem; import net.osmand.util.Algorithms; +import org.json.JSONException; +import org.json.JSONObject; + +import java.text.MessageFormat; import java.util.HashMap; import java.util.Map; @@ -37,7 +41,7 @@ public class SendSearchQueryBottomSheet extends MenuBottomSheetDialogFragment { } String searchQuery = args.getString(MISSING_SEARCH_QUERY_KEY); String searchLocation = args.getString(MISSING_SEARCH_LOCATION_KEY); - if (Algorithms.isEmpty(searchQuery) || Algorithms.isEmpty(searchLocation)) { + if (Algorithms.isEmpty(searchQuery)) { return; } params.put(searchQuery, searchLocation); @@ -63,15 +67,32 @@ public class SendSearchQueryBottomSheet extends MenuBottomSheetDialogFragment { @Override protected void onRightBottomButtonClick() { - OsmandApplication app = getMyApplication(); + final OsmandApplication app = getMyApplication(); if (app != null) { if (!app.getSettings().isInternetConnectionAvailable()) { Toast.makeText(app, R.string.internet_not_available, Toast.LENGTH_LONG).show(); + dismiss(); } else { AndroidNetworkUtils.sendRequestAsync(app, "http://osmand.net/api/missing_search", params, - null, true, true, null); + null, true, true, new AndroidNetworkUtils.OnRequestResultListener() { + @Override + public void onResult(String result) { + if (result != null && isAdded()) { + try { + JSONObject obj = new JSONObject(result); + if (!obj.has("error")) { + Toast.makeText(app, getString(R.string.thank_you_for_feedback), Toast.LENGTH_SHORT).show(); + } else { + Toast.makeText(app, MessageFormat.format(getString(R.string.error_message_pattern), obj.getString("error")), Toast.LENGTH_SHORT).show(); + } + } catch (JSONException e) { + + } + } + dismiss(); + } + }); } } - dismiss(); } }