Search in sources :

Example 1 with Abbreviations

use of de.westnordost.streetcomplete.data.meta.Abbreviations in project StreetComplete by westnordost.

the class AddRoadNameForm method onClickOk.

@Override
protected void onClickOk() {
    LinkedList<String> possibleAbbreviations = new LinkedList<>();
    for (RoadName roadName : adapter.getData()) {
        String name = roadName.name;
        if (name.trim().isEmpty()) {
            Toast.makeText(getActivity(), R.string.quest_generic_error_a_field_empty, Toast.LENGTH_LONG).show();
            return;
        }
        Abbreviations abbr = abbreviationsByLocale.get(new Locale(roadName.languageCode));
        boolean containsAbbreviations = abbr != null && abbr.containsAbbreviations(name);
        if (name.contains(".") || containsAbbreviations) {
            possibleAbbreviations.add(name);
        }
    }
    confirmPossibleAbbreviationsIfAny(possibleAbbreviations, this::applyNameAnswer);
}
Also used : AbbreviationsByLocale(de.westnordost.streetcomplete.data.meta.AbbreviationsByLocale) Locale(java.util.Locale) Abbreviations(de.westnordost.streetcomplete.data.meta.Abbreviations) LinkedList(java.util.LinkedList)

Aggregations

Abbreviations (de.westnordost.streetcomplete.data.meta.Abbreviations)1 AbbreviationsByLocale (de.westnordost.streetcomplete.data.meta.AbbreviationsByLocale)1 LinkedList (java.util.LinkedList)1 Locale (java.util.Locale)1