Show the "is part of" in corresponding language in wikivoyage search list

This commit is contained in:
Alex Sytnyk 2018-04-18 22:50:32 +03:00
parent a9c4a74824
commit 4c7779c813
3 changed files with 8 additions and 7 deletions

View file

@ -184,7 +184,7 @@ public class TravelDbHelper {
rs.cityId = cursor.getLong(0);
rs.articleTitles.add(cursor.getString(1));
rs.langs.add(cursor.getString(2));
rs.isPartOf = cursor.getString(3);
rs.isPartOf.add(cursor.getString(3));
rs.imageTitle = cursor.getString(4);
res.add(rs);
} while (cursor.moveToNext());
@ -237,6 +237,7 @@ public class TravelDbHelper {
}
prev.articleTitles.add(insInd, rs.articleTitles.get(0));
prev.langs.add(insInd, rs.langs.get(0));
prev.isPartOf.add(insInd, rs.isPartOf.get(0));
} else {
wikivoyage.put(rs.cityId, rs);
}
@ -287,11 +288,11 @@ public class TravelDbHelper {
rs.cityId = cursor.getLong(0);
rs.articleTitles.add(cursor.getString(1));
rs.langs.add(cursor.getString(2));
rs.isPartOf = cursor.getString(3);
List<WikivoyageSearchResult> l = navMap.get(rs.isPartOf);
rs.isPartOf.add(cursor.getString(3));
List<WikivoyageSearchResult> l = navMap.get(rs.isPartOf.get(0));
if (l == null) {
l = new ArrayList<>();
navMap.put(rs.isPartOf, l);
navMap.put(rs.isPartOf.get(0), l);
}
l.add(rs);
} while (cursor.moveToNext());

View file

@ -12,7 +12,7 @@ public class WikivoyageSearchResult {
long cityId;
List<String> articleTitles = new ArrayList<>();
List<String> langs = new ArrayList<>();
String isPartOf;
List<String> isPartOf = new ArrayList<>();
String imageTitle;
public long getCityId() {
@ -27,7 +27,7 @@ public class WikivoyageSearchResult {
return langs;
}
public String getIsPartOf() {
public List<String> getIsPartOf() {
return isPartOf;
}

View file

@ -82,7 +82,7 @@ public class SearchRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerView
.placeholder(placeholder)
.into(holder.icon);
holder.title.setText(searchRes.getArticleTitles().get(0));
holder.leftDescr.setText(searchRes.getIsPartOf());
holder.leftDescr.setText(searchRes.getIsPartOf().get(0));
holder.rightDescr.setText(searchRes.getFirstLangsString());
} else {
WikivoyageSearchHistoryItem historyItem = (WikivoyageSearchHistoryItem) item;