use of de.westnordost.streetcomplete.view.dialogs.AlertDialogBuilder in project StreetComplete by westnordost.
the class CrashReportExceptionHandler method askUserToSendErrorReport.
private void askUserToSendErrorReport(final Activity activityCtx, final int titleResourceId, String error) {
final String report = "Describe how to reproduce it here:\n\n\n\n" + getDeviceInformationString() + "\n" + error;
new Handler(Looper.getMainLooper()).post(() -> {
new AlertDialogBuilder(activityCtx).setTitle(titleResourceId).setMessage(R.string.crash_message).setPositiveButton(R.string.crash_compose_email, (dialog, which) -> sendEmail(activityCtx, report)).setNegativeButton(android.R.string.no, (dialog, which) -> Toast.makeText(activityCtx, "\uD83D\uDE22", Toast.LENGTH_SHORT).show()).setCancelable(false).show();
});
}
use of de.westnordost.streetcomplete.view.dialogs.AlertDialogBuilder in project StreetComplete by westnordost.
the class MainActivity method confirmUndo.
private void confirmUndo(final OsmQuest quest) {
Element element = questController.getOsmElement(quest);
View inner = LayoutInflater.from(this).inflate(R.layout.dialog_undo, null, false);
ImageView icon = inner.findViewById(R.id.icon);
icon.setImageResource(quest.getType().getIcon());
TextView text = inner.findViewById(R.id.text);
text.setText(QuestUtil.getHtmlTitle(getResources(), quest.getType(), element));
new AlertDialogBuilder(this).setTitle(R.string.undo_confirm_title).setView(inner).setPositiveButton(R.string.undo_confirm_positive, (dialog, which) -> {
questController.undoOsmQuest(quest);
unsyncedChangesCounter.decrement(quest.getChangesSource());
}).setNegativeButton(R.string.undo_confirm_negative, null).show();
}
use of de.westnordost.streetcomplete.view.dialogs.AlertDialogBuilder in project StreetComplete by westnordost.
the class MainActivity method downloadDisplayedArea.
@UiThread
private void downloadDisplayedArea() {
BoundingBox displayArea;
if ((displayArea = mapFragment.getDisplayedArea(new Rect())) == null) {
Toast.makeText(this, R.string.cannot_find_bbox_or_reduce_tilt, Toast.LENGTH_LONG).show();
} else {
final BoundingBox enclosingBBox = SlippyMapMath.asBoundingBoxOfEnclosingTiles(displayArea, ApplicationConstants.QUEST_TILE_ZOOM);
double areaInSqKm = SphericalEarthMath.enclosedArea(enclosingBBox) / 1000000;
if (areaInSqKm > ApplicationConstants.MAX_DOWNLOADABLE_AREA_IN_SQKM) {
Toast.makeText(this, R.string.download_area_too_big, Toast.LENGTH_LONG).show();
} else {
if (questController.isPriorityDownloadRunning()) {
new AlertDialogBuilder(this).setMessage(R.string.confirmation_cancel_prev_download_title).setPositiveButton(android.R.string.ok, (dialog, which) -> downloadAreaConfirmed(enclosingBBox)).setNegativeButton(android.R.string.cancel, null).show();
} else {
downloadAreaConfirmed(enclosingBBox);
}
}
}
}
use of de.westnordost.streetcomplete.view.dialogs.AlertDialogBuilder in project StreetComplete by westnordost.
the class MainActivity method requestOAuthorized.
@UiThread
private void requestOAuthorized() {
if (dontShowRequestAuthorizationAgain)
return;
View inner = LayoutInflater.from(this).inflate(R.layout.dialog_authorize_now, null, false);
final CheckBox checkBox = inner.findViewById(R.id.checkBoxDontShowAgain);
new AlertDialogBuilder(this).setView(inner).setPositiveButton(android.R.string.ok, (dialog, which) -> {
Intent intent = new Intent(MainActivity.this, SettingsActivity.class);
intent.putExtra(SettingsActivity.EXTRA_LAUNCH_AUTH, true);
startActivity(intent);
}).setNegativeButton(R.string.later, (dialog, which) -> {
dontShowRequestAuthorizationAgain = checkBox.isChecked();
}).show();
}
use of de.westnordost.streetcomplete.view.dialogs.AlertDialogBuilder in project StreetComplete by westnordost.
the class AddMaxSpeedForm method confirmNoSignSlowZone.
private void confirmNoSignSlowZone(final Runnable callback) {
View view = LayoutInflater.from(getActivity()).inflate(R.layout.quest_maxspeed_no_sign_no_slow_zone_confirmation, null, false);
ImageView imgSlowZone = view.findViewById(R.id.imgSlowZone);
ImageView mainLayoutImgSlowZone = getView() != null ? (ImageView) getView().findViewById(R.id.zoneImg) : null;
if (mainLayoutImgSlowZone != null) {
Drawable slowZoneDrawable = mainLayoutImgSlowZone.getDrawable();
imgSlowZone.setImageDrawable(slowZoneDrawable);
}
new AlertDialogBuilder(getActivity()).setView(view).setTitle(R.string.quest_maxspeed_answer_noSign_confirmation_title).setPositiveButton(R.string.quest_maxspeed_answer_noSign_confirmation_positive, (dialog, which) -> callback.run()).setNegativeButton(R.string.quest_generic_confirmation_no, null).show();
}
Aggregations