use of de.westnordost.streetcomplete.view.dialogs.AlertDialogBuilder in project StreetComplete by westnordost.
the class LocationRequestFragment method requestLocationSettingsToBeOn.
private void requestLocationSettingsToBeOn() {
if (LocationUtil.isLocationOn(getContext())) {
state = LocationState.ENABLED;
nextStep();
} else {
final AlertDialog dlg = new AlertDialogBuilder(getContext()).setMessage(R.string.turn_on_location_request).setPositiveButton(android.R.string.yes, (dialog, which) -> {
dialog.dismiss();
Intent viewIntent = new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS);
startActivityForResult(viewIntent, LOCATION_TURN_ON_REQUEST);
}).setNegativeButton(android.R.string.no, (dialog, which) -> cancelTurnLocationOnDialog()).setOnCancelListener(dialog -> cancelTurnLocationOnDialog()).create();
// the user may turn on location in the pull-down-overlay, without actually going into
// settings dialog
registerForLocationProviderChanges(dlg);
dlg.show();
}
}
use of de.westnordost.streetcomplete.view.dialogs.AlertDialogBuilder in project StreetComplete by westnordost.
the class FindQuestSourceComponent method findSource.
public void findSource(final long questId, final QuestGroup group, final Location[] locations, final Listener listener) {
Double distance = getDistanceToElementInMeters(questId, group, locations);
if (dontShowAgain || distance != null && distance < MAX_DISTANCE_TO_ELEMENT_FOR_SURVEY) {
listener.onFindQuestSourceResult(SURVEY);
} else {
View inner = LayoutInflater.from(activity).inflate(R.layout.quest_source_dialog_layout, null, false);
final CheckBox checkBox = inner.findViewById(R.id.checkBoxDontShowAgain);
AlertDialogBuilder alertDialogBuilder = new AlertDialogBuilder(activity);
alertDialogBuilder.setTitle(R.string.quest_source_dialog_title).setView(inner).setPositiveButton(R.string.quest_generic_confirmation_yes, (dialog, which) -> {
++timesShown;
dontShowAgain = checkBox.isChecked();
listener.onFindQuestSourceResult(SURVEY);
}).setNegativeButton(android.R.string.cancel, null);
checkBox.setVisibility(timesShown < 2 ? View.GONE : View.VISIBLE);
alertDialogBuilder.show();
}
}
use of de.westnordost.streetcomplete.view.dialogs.AlertDialogBuilder in project StreetComplete by westnordost.
the class AddCyclewayForm method showCyclewaySelectionDialog.
private void showCyclewaySelectionDialog(final boolean isRight) {
RecyclerView recyclerView = new RecyclerView(getActivity());
recyclerView.setLayoutParams(new RecyclerView.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
recyclerView.setLayoutManager(new GridLayoutManager(getActivity(), 2));
final AlertDialog alertDialog = new AlertDialogBuilder(getActivity()).setTitle(R.string.quest_select_hint).setView(recyclerView).create();
recyclerView.setAdapter(createAdapter(getCyclewayItems(isRight), cycleway -> {
alertDialog.dismiss();
int iconResId = cycleway.getIconResId(isLeftHandTraffic());
if (isRight) {
puzzle.replaceRightSideImageResource(iconResId);
rightSide = cycleway;
} else {
puzzle.replaceLeftSideImageResource(iconResId);
leftSide = cycleway;
}
}));
alertDialog.show();
}
use of de.westnordost.streetcomplete.view.dialogs.AlertDialogBuilder in project StreetComplete by westnordost.
the class AddBuildingLevelsForm method onCreateView.
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = super.onCreateView(inflater, container, savedInstanceState);
View contentView = setContentView(R.layout.quest_building_levels);
levelsInput = contentView.findViewById(R.id.levelsInput);
levelsInput.requestFocus();
roofLevelsInput = contentView.findViewById(R.id.roofLevelsInput);
addOtherAnswer(R.string.quest_buildingLevels_answer_multipleLevels, () -> {
new AlertDialogBuilder(getActivity()).setMessage(R.string.quest_buildingLevels_answer_description).setPositiveButton(android.R.string.ok, null).show();
});
return view;
}
use of de.westnordost.streetcomplete.view.dialogs.AlertDialogBuilder in project StreetComplete by westnordost.
the class AddHousenumberForm method addOtherAnswers.
private void addOtherAnswers() {
addOtherAnswer(R.string.quest_address_answer_house_name, () -> {
isHousename = true;
setLayout(R.layout.quest_housename);
});
addOtherAnswer(R.string.quest_housenumber_multiple_numbers, () -> {
new AlertDialogBuilder(getActivity()).setMessage(R.string.quest_housenumber_multiple_numbers_description).setPositiveButton(android.R.string.ok, null).show();
});
}
Aggregations