add check for internet before opening dialog

This commit is contained in:
Chumva 2018-07-23 17:00:31 +03:00
parent 2e0e53bee0
commit c198c78b51

View file

@ -640,14 +640,21 @@ public class QuickSearchDialogFragment extends DialogFragment implements OsmAndC
sendEmptySearchButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
Bundle args = new Bundle();
SendSearchQueryBottomSheet fragment = new SendSearchQueryBottomSheet();
args.putString(MISSING_SEARCH_QUERY_KEY, searchQuery);
if (location != null) {
args.putString(MISSING_SEARCH_LOCATION_KEY, location.toString());
OsmandApplication app = getMyApplication();
if (app != null) {
if (!app.getSettings().isInternetConnectionAvailable()) {
Toast.makeText(app, R.string.internet_not_available, Toast.LENGTH_LONG).show();
} else {
if (location != null && searchQuery != null) {
Bundle args = new Bundle();
SendSearchQueryBottomSheet fragment = new SendSearchQueryBottomSheet();
args.putString(MISSING_SEARCH_LOCATION_KEY, location.toString());
args.putString(MISSING_SEARCH_QUERY_KEY, searchQuery);
fragment.setArguments(args);
fragment.show(mapActivity.getSupportFragmentManager(), SendSearchQueryBottomSheet.TAG);
}
}
}
fragment.setArguments(args);
fragment.show(mapActivity.getSupportFragmentManager(), SendSearchQueryBottomSheet.TAG);
}
});
updateFab();