add check for internet before opening dialog
This commit is contained in:
parent
2e0e53bee0
commit
c198c78b51
1 changed files with 14 additions and 7 deletions
|
@ -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();
|
||||
|
|
Loading…
Reference in a new issue