Search in sources :

Example 16 with AlertDialogBuilder

use of de.westnordost.streetcomplete.view.dialogs.AlertDialogBuilder in project StreetComplete by westnordost.

the class AddOpeningHoursAdapter method openSetWeekdaysDialog.

private void openSetWeekdaysDialog(final Weekdays weekdays, final WeekdaysPickedListener callback) {
    final boolean[] selection = weekdays.getSelection();
    AlertDialog dlg = new AlertDialogBuilder(context).setTitle(R.string.quest_openingHours_chooseWeekdaysTitle).setMultiChoiceItems(Weekdays.getNames(context.getResources()), selection, (dialog, which, isChecked) -> updateDialogOkButtonEnablement((AlertDialog) dialog, selection)).setNegativeButton(android.R.string.cancel, null).setPositiveButton(android.R.string.ok, (dialog, which) -> callback.onWeekdaysPicked(new Weekdays(selection))).show();
    updateDialogOkButtonEnablement(dlg, selection);
}
Also used : AlertDialog(android.support.v7.app.AlertDialog) Context(android.content.Context) LinearLayout(android.widget.LinearLayout) AlertDialogBuilder(de.westnordost.streetcomplete.view.dialogs.AlertDialogBuilder) LayoutInflater(android.view.LayoutInflater) TextUtils(android.text.TextUtils) NonNull(android.support.annotation.NonNull) RangePickerDialog(de.westnordost.streetcomplete.view.dialogs.RangePickerDialog) ViewGroup(android.view.ViewGroup) ArrayList(java.util.ArrayList) RecyclerView(android.support.v7.widget.RecyclerView) List(java.util.List) R(de.westnordost.streetcomplete.R) AlertDialog(android.support.v7.app.AlertDialog) TextView(android.widget.TextView) DateFormatSymbols(java.text.DateFormatSymbols) CountryInfo(de.westnordost.streetcomplete.data.meta.CountryInfo) View(android.view.View) DialogInterface(android.content.DialogInterface) AlertDialogBuilder(de.westnordost.streetcomplete.view.dialogs.AlertDialogBuilder)

Example 17 with AlertDialogBuilder

use of de.westnordost.streetcomplete.view.dialogs.AlertDialogBuilder in project StreetComplete by westnordost.

the class AddOpeningHoursForm method showInputCommentDialog.

private void showInputCommentDialog() {
    View view = LayoutInflater.from(getActivity()).inflate(R.layout.quest_opening_hours_comment, null);
    final EditText editText = view.findViewById(R.id.commentInput);
    new AlertDialogBuilder(getContext()).setTitle(R.string.quest_openingHours_comment_title).setView(view).setPositiveButton(android.R.string.ok, (dialog, which) -> {
        String txt = editText.getText().toString().replaceAll("\"", "").trim();
        if (txt.isEmpty()) {
            new AlertDialogBuilder(getContext()).setMessage(R.string.quest_openingHours_emptyAnswer).setPositiveButton(R.string.ok, null).show();
            return;
        }
        Bundle answer = new Bundle();
        answer.putString(OPENING_HOURS, "\"" + txt + "\"");
        applyImmediateAnswer(answer);
    }).setNegativeButton(android.R.string.cancel, null).show();
}
Also used : EditText(android.widget.EditText) AlertDialogBuilder(de.westnordost.streetcomplete.view.dialogs.AlertDialogBuilder) Bundle(android.os.Bundle) RecyclerView(android.support.v7.widget.RecyclerView) View(android.view.View)

Example 18 with AlertDialogBuilder

use of de.westnordost.streetcomplete.view.dialogs.AlertDialogBuilder in project StreetComplete by westnordost.

the class AddOpeningHoursForm method showConfirm24_7Dialog.

private void showConfirm24_7Dialog() {
    new AlertDialogBuilder(getActivity()).setMessage(R.string.quest_openingHours_24_7_confirmation).setPositiveButton(android.R.string.yes, (dialog, which) -> {
        Bundle answer = new Bundle();
        answer.putString(OPENING_HOURS, "24/7");
        applyImmediateAnswer(answer);
    }).setNegativeButton(android.R.string.no, null).show();
}
Also used : AlertDialogBuilder(de.westnordost.streetcomplete.view.dialogs.AlertDialogBuilder) Bundle(android.os.Bundle)

Example 19 with AlertDialogBuilder

use of de.westnordost.streetcomplete.view.dialogs.AlertDialogBuilder in project StreetComplete by westnordost.

the class AddRoadNameForm method confirmNoStreetName.

private void confirmNoStreetName() {
    new AlertDialogBuilder(getActivity()).setTitle(R.string.quest_name_answer_noName_confirmation_title).setMessage(R.string.quest_streetName_answer_noName_confirmation_description).setPositiveButton(R.string.quest_name_noName_confirmation_positive, (dialog, which) -> {
        Bundle data = new Bundle();
        data.putBoolean(NO_NAME, true);
        applyImmediateAnswer(data);
    }).setNegativeButton(R.string.quest_generic_confirmation_no, null).show();
}
Also used : AlertDialogBuilder(de.westnordost.streetcomplete.view.dialogs.AlertDialogBuilder) Bundle(android.os.Bundle)

Example 20 with AlertDialogBuilder

use of de.westnordost.streetcomplete.view.dialogs.AlertDialogBuilder in project StreetComplete by westnordost.

the class AddRoadNameForm method showKeyboardInfo.

private void showKeyboardInfo() {
    new AlertDialogBuilder(getActivity()).setTitle(R.string.quest_streetName_cantType_title).setMessage(R.string.quest_streetName_cantType_description).setPositiveButton(R.string.quest_streetName_cantType_open_settings, (dialog, which) -> startActivity(new Intent(Settings.ACTION_SETTINGS))).setNeutralButton(R.string.quest_streetName_cantType_open_store, (dialog, which) -> {
        Intent intent = new Intent(Intent.ACTION_MAIN);
        intent.addCategory(Intent.CATEGORY_APP_MARKET);
        startActivity(intent);
    }).setNegativeButton(android.R.string.cancel, null).show();
}
Also used : Arrays(java.util.Arrays) Bundle(android.os.Bundle) Spanned(android.text.Spanned) RoadNameSuggestionsDao(de.westnordost.streetcomplete.quests.road_name.data.RoadNameSuggestionsDao) LatLon(de.westnordost.osmapi.map.data.LatLon) Intent(android.content.Intent) AbbreviationsByLocale(de.westnordost.streetcomplete.data.meta.AbbreviationsByLocale) ArrayList(java.util.ArrayList) Inject(javax.inject.Inject) R(de.westnordost.streetcomplete.R) Injector(de.westnordost.streetcomplete.Injector) Locale(java.util.Locale) Toast(android.widget.Toast) Map(java.util.Map) View(android.view.View) Button(android.widget.Button) Settings(android.provider.Settings) LinkedList(java.util.LinkedList) Abbreviations(de.westnordost.streetcomplete.data.meta.Abbreviations) LinkedHashSet(java.util.LinkedHashSet) Serializer(de.westnordost.streetcomplete.util.Serializer) DialogInterface(android.content.DialogInterface) ElementGeometry(de.westnordost.streetcomplete.data.osm.ElementGeometry) AlertDialogBuilder(de.westnordost.streetcomplete.view.dialogs.AlertDialogBuilder) LayoutInflater(android.view.LayoutInflater) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) ViewGroup(android.view.ViewGroup) RecyclerView(android.support.v7.widget.RecyclerView) List(java.util.List) AlertDialog(android.support.v7.app.AlertDialog) Html(android.text.Html) AbstractQuestFormAnswerFragment(de.westnordost.streetcomplete.quests.AbstractQuestFormAnswerFragment) Queue(java.util.Queue) AlertDialogBuilder(de.westnordost.streetcomplete.view.dialogs.AlertDialogBuilder) Intent(android.content.Intent)

Aggregations

AlertDialogBuilder (de.westnordost.streetcomplete.view.dialogs.AlertDialogBuilder)21 Bundle (android.os.Bundle)11 View (android.view.View)11 R (de.westnordost.streetcomplete.R)8 AlertDialog (android.support.v7.app.AlertDialog)6 LayoutInflater (android.view.LayoutInflater)6 ArrayList (java.util.ArrayList)6 Intent (android.content.Intent)5 RecyclerView (android.support.v7.widget.RecyclerView)5 ImageView (android.widget.ImageView)5 Inject (javax.inject.Inject)5 Context (android.content.Context)4 Toast (android.widget.Toast)4 Arrays (java.util.Arrays)4 List (java.util.List)4 DialogInterface (android.content.DialogInterface)3 ViewGroup (android.view.ViewGroup)3 TextView (android.widget.TextView)3 Activity (android.app.Activity)2 BroadcastReceiver (android.content.BroadcastReceiver)2