diff --git a/OsmAnd/res/layout/wikivoyage_search_list_item.xml b/OsmAnd/res/layout/wikivoyage_search_list_item.xml index 24404975d3..45f73908ef 100644 --- a/OsmAnd/res/layout/wikivoyage_search_list_item.xml +++ b/OsmAnd/res/layout/wikivoyage_search_list_item.xml @@ -45,14 +45,33 @@ android:textAppearance="@style/TextAppearance.ListItemTitle" tools:text="Amsterdam"/> - + + + + + + + + diff --git a/OsmAnd/src/net/osmand/plus/wikivoyage/data/WikivoyageSearchResult.java b/OsmAnd/src/net/osmand/plus/wikivoyage/data/WikivoyageSearchResult.java index 8ac59c2e12..e295f9331f 100644 --- a/OsmAnd/src/net/osmand/plus/wikivoyage/data/WikivoyageSearchResult.java +++ b/OsmAnd/src/net/osmand/plus/wikivoyage/data/WikivoyageSearchResult.java @@ -3,11 +3,15 @@ package net.osmand.plus.wikivoyage.data; import android.os.Parcel; import android.os.Parcelable; +import net.osmand.util.Algorithms; + import java.util.ArrayList; import java.util.List; public class WikivoyageSearchResult implements Parcelable { + private static final int SHOW_LANGS = 3; + List searchTerms = new ArrayList<>(); long cityId; List articleTitles = new ArrayList<>(); @@ -46,6 +50,18 @@ public class WikivoyageSearchResult implements Parcelable { return isPartOf; } + public String getFirstLangsString() { + StringBuilder res = new StringBuilder(); + int limit = Math.min(SHOW_LANGS, langs.size()); + for (int i = 0; i < limit; i++) { + res.append(Algorithms.capitalizeFirstLetter(langs.get(i))); + if (i != limit - 1) { + res.append(", "); + } + } + return res.toString(); + } + @Override public int describeContents() { return 0; diff --git a/OsmAnd/src/net/osmand/plus/wikivoyage/search/SearchRecyclerViewAdapter.java b/OsmAnd/src/net/osmand/plus/wikivoyage/search/SearchRecyclerViewAdapter.java index df3299c8f9..0914cf2982 100644 --- a/OsmAnd/src/net/osmand/plus/wikivoyage/search/SearchRecyclerViewAdapter.java +++ b/OsmAnd/src/net/osmand/plus/wikivoyage/search/SearchRecyclerViewAdapter.java @@ -3,7 +3,6 @@ package net.osmand.plus.wikivoyage.search; import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.support.v7.widget.RecyclerView; -import android.text.TextUtils; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; @@ -14,7 +13,6 @@ import net.osmand.plus.IconsCache; import net.osmand.plus.OsmandApplication; import net.osmand.plus.R; import net.osmand.plus.wikivoyage.data.WikivoyageSearchResult; -import net.osmand.util.Algorithms; import java.util.ArrayList; import java.util.List; @@ -66,7 +64,8 @@ public class SearchRecyclerViewAdapter extends RecyclerView.Adapter