From 194f926af2ead6ab864f5853de41d4bf67977e02 Mon Sep 17 00:00:00 2001 From: Alex Sytnyk Date: Mon, 2 Apr 2018 16:57:25 +0300 Subject: [PATCH] Rename fields in WikivoyageSearchResult --- .../WikivoyageArticleDialogFragment.java | 4 ++-- .../wikivoyage/data/WikivoyageDbHelper.java | 20 ++++++++--------- .../data/WikivoyageSearchResult.java | 22 +++++++++---------- .../search/SearchRecyclerViewAdapter.java | 4 ++-- 4 files changed, 25 insertions(+), 25 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/wikivoyage/WikivoyageArticleDialogFragment.java b/OsmAnd/src/net/osmand/plus/wikivoyage/WikivoyageArticleDialogFragment.java index 2288b4e6bf..43657aff6e 100644 --- a/OsmAnd/src/net/osmand/plus/wikivoyage/WikivoyageArticleDialogFragment.java +++ b/OsmAnd/src/net/osmand/plus/wikivoyage/WikivoyageArticleDialogFragment.java @@ -102,7 +102,7 @@ public class WikivoyageArticleDialogFragment extends WikivoyageBaseDialogFragmen } final PopupMenu popup = new PopupMenu(view.getContext(), view, Gravity.END); - for (final String lang : searchResult.getLang()) { + for (final String lang : searchResult.getLangs()) { MenuItem item = popup.getMenu().add(lang); item.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() { @Override @@ -130,7 +130,7 @@ public class WikivoyageArticleDialogFragment extends WikivoyageBaseDialogFragmen return; } if (selectedLang == null) { - selectedLang = searchResult.getLang().get(0); + selectedLang = searchResult.getLangs().get(0); } selectedLangTv.setText(selectedLang); diff --git a/OsmAnd/src/net/osmand/plus/wikivoyage/data/WikivoyageDbHelper.java b/OsmAnd/src/net/osmand/plus/wikivoyage/data/WikivoyageDbHelper.java index cf48103596..d2eba0e5cb 100644 --- a/OsmAnd/src/net/osmand/plus/wikivoyage/data/WikivoyageDbHelper.java +++ b/OsmAnd/src/net/osmand/plus/wikivoyage/data/WikivoyageDbHelper.java @@ -100,12 +100,12 @@ public class WikivoyageDbHelper { Collections.sort(list, new Comparator() { @Override public int compare(WikivoyageSearchResult o1, WikivoyageSearchResult o2) { - boolean c1 = CollatorStringMatcher.cmatches(collator, searchQuery, o1.articleTitle.get(0), + boolean c1 = CollatorStringMatcher.cmatches(collator, searchQuery, o1.articleTitles.get(0), StringMatcherMode.CHECK_ONLY_STARTS_WITH); - boolean c2 = CollatorStringMatcher.cmatches(collator, searchQuery, o2.articleTitle.get(0), + boolean c2 = CollatorStringMatcher.cmatches(collator, searchQuery, o2.articleTitles.get(0), StringMatcherMode.CHECK_ONLY_STARTS_WITH); if (c1 == c2) { - return collator.compare(o1.articleTitle.get(0), o2.articleTitle.get(0)); + return collator.compare(o1.articleTitles.get(0), o2.articleTitles.get(0)); } else if (c1) { return -1; } else if (c2) { @@ -125,18 +125,18 @@ public class WikivoyageDbHelper { WikivoyageSearchResult prev = wikivoyage.get(rs.cityId); if (prev != null) { int insInd = prev.langs.size(); - if (rs.getLang().get(0).equals(baseLng)) { + if (rs.langs.get(0).equals(baseLng)) { insInd = 0; - } else if (rs.getLang().get(0).equals("en")) { - if (!prev.getLang().get(0).equals(baseLng)) { + } else if (rs.langs.get(0).equals("en")) { + if (!prev.langs.get(0).equals(baseLng)) { insInd = 0; } else { insInd = 1; } } - prev.articleTitle.add(insInd, rs.articleTitle.get(0)); + prev.articleTitles.add(insInd, rs.articleTitles.get(0)); prev.langs.add(insInd, rs.langs.get(0)); - prev.searchTerm.add(insInd, rs.searchTerm.get(0)); + prev.searchTerms.add(insInd, rs.searchTerms.get(0)); } else { wikivoyage.put(rs.cityId, rs); } @@ -175,9 +175,9 @@ public class WikivoyageDbHelper { private WikivoyageSearchResult readSearchResult(SQLiteCursor cursor) { WikivoyageSearchResult res = new WikivoyageSearchResult(); - res.searchTerm.add(cursor.getString(0)); + res.searchTerms.add(cursor.getString(0)); res.cityId = cursor.getLong(1); - res.articleTitle.add(cursor.getString(2)); + res.articleTitles.add(cursor.getString(2)); res.langs.add(cursor.getString(3)); return res; diff --git a/OsmAnd/src/net/osmand/plus/wikivoyage/data/WikivoyageSearchResult.java b/OsmAnd/src/net/osmand/plus/wikivoyage/data/WikivoyageSearchResult.java index c4db8f3665..ecabd84876 100644 --- a/OsmAnd/src/net/osmand/plus/wikivoyage/data/WikivoyageSearchResult.java +++ b/OsmAnd/src/net/osmand/plus/wikivoyage/data/WikivoyageSearchResult.java @@ -8,9 +8,9 @@ import java.util.List; public class WikivoyageSearchResult implements Parcelable { - List searchTerm = new ArrayList<>(); + List searchTerms = new ArrayList<>(); long cityId; - List articleTitle = new ArrayList<>(); + List articleTitles = new ArrayList<>(); List langs = new ArrayList<>(); WikivoyageSearchResult() { @@ -18,25 +18,25 @@ public class WikivoyageSearchResult implements Parcelable { } private WikivoyageSearchResult(Parcel in) { - searchTerm = in.createStringArrayList(); + searchTerms = in.createStringArrayList(); cityId = in.readLong(); - articleTitle = in.createStringArrayList(); + articleTitles = in.createStringArrayList(); langs = in.createStringArrayList(); } - public List getSearchTerm() { - return searchTerm; + public List getSearchTerms() { + return searchTerms; } public long getCityId() { return cityId; } - public List getArticleTitle() { - return articleTitle; + public List getArticleTitles() { + return articleTitles; } - public List getLang() { + public List getLangs() { return langs; } @@ -47,9 +47,9 @@ public class WikivoyageSearchResult implements Parcelable { @Override public void writeToParcel(Parcel dest, int flags) { - dest.writeStringList(searchTerm); + dest.writeStringList(searchTerms); dest.writeLong(cityId); - dest.writeStringList(articleTitle); + dest.writeStringList(articleTitles); dest.writeStringList(langs); } diff --git a/OsmAnd/src/net/osmand/plus/wikivoyage/search/SearchRecyclerViewAdapter.java b/OsmAnd/src/net/osmand/plus/wikivoyage/search/SearchRecyclerViewAdapter.java index 7e55674049..4972ef35c8 100644 --- a/OsmAnd/src/net/osmand/plus/wikivoyage/search/SearchRecyclerViewAdapter.java +++ b/OsmAnd/src/net/osmand/plus/wikivoyage/search/SearchRecyclerViewAdapter.java @@ -63,8 +63,8 @@ public class SearchRecyclerViewAdapter extends RecyclerView.Adapter