diff --git a/android/AndroidManifest.xml b/android/AndroidManifest.xml index 9a87dce46b..23fee74851 100644 --- a/android/AndroidManifest.xml +++ b/android/AndroidManifest.xml @@ -676,7 +676,7 @@ diff --git a/android/src/app/organicmaps/bookmarks/BookmarkCategoriesAdapter.java b/android/src/app/organicmaps/bookmarks/BookmarkCategoriesAdapter.java index edc48b9507..70a5544840 100644 --- a/android/src/app/organicmaps/bookmarks/BookmarkCategoriesAdapter.java +++ b/android/src/app/organicmaps/bookmarks/BookmarkCategoriesAdapter.java @@ -122,9 +122,9 @@ public class BookmarkCategoriesAdapter extends BaseBookmarkCategoryAdapter 0 && tracksCount > 0) + { + final String bookmarks = getQuantified(resources, R.plurals.places, bookmarksCount); + final String tracks = getQuantified(resources, R.plurals.tracks, tracksCount); + final String template = resources.getString(R.string.comma_separated_pair); + return String.format(template, bookmarks, tracks); + } + + if (bookmarksCount > 0) + return getQuantified(resources, R.plurals.places, bookmarksCount); + + return getQuantified(resources, R.plurals.tracks, tracksCount); + } + + void setEntity(@NonNull BookmarkCategory entity) + { + mEntity = entity; + } + + @NonNull + public BookmarkCategory getEntity() + { + if (mEntity == null) + throw new AssertionError("BookmarkCategory is null"); + return mEntity; + } + + private String getQuantified(Resources resources, @PluralsRes int plural, int size) + { + return resources.getQuantityString(plural, size, size); + } + + } + static class CollectionViewHolder extends CategoryViewHolderBase { @NonNull private final View mView; @@ -169,10 +233,6 @@ public class Holders private final TextView mName; @NonNull private final CheckBox mVisibilityMarker; - @NonNull - private final TextView mSize; - @Nullable - private BookmarkCategory mEntity; CollectionViewHolder(@NonNull View root) { @@ -180,7 +240,6 @@ public class Holders mView = root; mName = root.findViewById(R.id.name); mVisibilityMarker = root.findViewById(R.id.checkbox); - mSize = root.findViewById(R.id.size); } void setOnClickListener(@Nullable OnItemClickListener listener) @@ -205,27 +264,9 @@ public class Holders { mName.setText(name); } - - void setSize(@PluralsRes int phrase, int size) - { - mSize.setText(mSize.getResources().getQuantityString(phrase, size, size)); - } - - void setEntity(@NonNull BookmarkCategory entity) - { - mEntity = entity; - } - - @NonNull - public BookmarkCategory getEntity() - { - if (mEntity == null) - throw new AssertionError("BookmarkCategory is null"); - return mEntity; - } } - static class CategoryViewHolder extends RecyclerView.ViewHolder + static class CategoryViewHolder extends CategoryViewHolderBase { @NonNull private final TextView mName; @@ -233,10 +274,6 @@ public class Holders CheckBox mVisibilityMarker; @NonNull ImageView mMoreButton; - @NonNull - TextView mSize; - @Nullable - private BookmarkCategory mEntity; CategoryViewHolder(@NonNull View root) { @@ -247,7 +284,6 @@ public class Holders int left = root.getResources().getDimensionPixelOffset(R.dimen.margin_half_plus); int right = root.getResources().getDimensionPixelOffset(R.dimen.margin_base_plus); UiUtils.expandTouchAreaForView(mVisibilityMarker, 0, left, 0, right); - mSize = root.findViewById(R.id.size); } void setVisibilityState(boolean visible) @@ -269,24 +305,6 @@ public class Holders { mName.setText(name); } - - void setSize(@PluralsRes int phrase, int size) - { - mSize.setText(mSize.getResources().getQuantityString(phrase, size, size)); - } - - void setCategory(@NonNull BookmarkCategory entity) - { - mEntity = entity; - } - - @NonNull - public BookmarkCategory getEntity() - { - if (mEntity == null) - throw new AssertionError("BookmarkCategory is null"); - return mEntity; - } } static abstract class BaseBookmarkHolder extends RecyclerView.ViewHolder diff --git a/android/src/app/organicmaps/bookmarks/data/BookmarkCategory.java b/android/src/app/organicmaps/bookmarks/data/BookmarkCategory.java index 33167bd933..9c7e5bdf0b 100644 --- a/android/src/app/organicmaps/bookmarks/data/BookmarkCategory.java +++ b/android/src/app/organicmaps/bookmarks/data/BookmarkCategory.java @@ -99,42 +99,6 @@ public class BookmarkCategory implements Parcelable return mDescription; } - @NonNull - public CountAndPlurals getPluralsCountTemplate() - { - if (size() == 0) - return new CountAndPlurals(0, R.plurals.objects); - - if (getBookmarksCount() == 0) - return new CountAndPlurals(getTracksCount(), R.plurals.tracks); - - if (getTracksCount() == 0) - return new CountAndPlurals(getBookmarksCount(), R.plurals.places); - - return new CountAndPlurals(size(), R.plurals.objects); - } - - public static class CountAndPlurals { - private final int mCount; - @PluralsRes - private final int mPlurals; - - public CountAndPlurals(int count, int plurals) - { - mCount = count; - mPlurals = plurals; - } - - public int getCount() - { - return mCount; - } - - public int getPlurals() - { - return mPlurals; - } - } @Override public String toString() { diff --git a/data/strings/strings.txt b/data/strings/strings.txt index ae593c4246..87105cbf54 100644 --- a/data/strings/strings.txt +++ b/data/strings/strings.txt @@ -1856,7 +1856,7 @@ zh-Hant = 收藏夾 [bookmarks] - comment = "Bookmarks" dialog title, please also edit it in iphone/plist.txt + comment = Should be used in the bookmarks-only context, see bookmarks_and_tracks if tracks are also implied. tags = android,ios en = Bookmarks ar = الإشارات المرجعية @@ -1897,6 +1897,47 @@ zh-Hans = 书签 zh-Hant = 書籤 + [bookmarks_and_tracks] + comment = "Bookmarks and Tracks" dialog title, also sync it with iphone/plist.txt + tags = android,ios + en = Bookmarks and Tracks + ar = الإشارات المرجعية والمسارات + be = Закладкі i cцежкі + bg = Отметки и пътеки + ca = Marcadors i traces + cs = Záložky a stopy + da = Bogmærker og ruter + de = Lesezeichen und Strecken + el = Αγαπημένα και διαδρομές + es = Marcadores y rutas + et = Järjehoidjad ja rajad + eu = Markagailuak eta ibilbideak + fa = نشانه‌ها و مسیر + fi = Kirjanmerkit ja reitit + fr = Signets et parcours + he = רשימות אתרים ונתיבים + hu = Könyvjelzők és nyomvonalak + id = Penanda dan jalur + it = Luoghi preferiti e percorsi + ja = ブックマークとトラック + ko = 북마크 및 트랙 + mr = खूणपत्रे आणि ट्रॅक + nb = Bokmerker og ruter + nl = Bladwijzers en tracks + pl = Zakładki i trasy + pt = Favoritos e trilhas + pt-BR = Favoritos e trilhas + ro = Locuri preferate și trasee + ru = Метки и треки + sk = Záložky a stopy + sv = Bokmärken och rutter + th = บุ๊กมาร์กและการติดตาม + tr = Yer İmleri ve kayıtlar + uk = Мітки та маршрути + vi = Đánh dấu và dấu vết + zh-Hans = 书签和轨迹 + zh-Hant = 書籤和軌跡 + [core_my_places] comment = Default bookmark list name tags = android,ios @@ -19902,7 +19943,7 @@ fa:one = %d رد fa:other = %d رد fi = %d radat - fr = pistes %d + fr = %d pistes hu = %d út id = trek %d it:one = %d percorso @@ -19911,7 +19952,7 @@ ko = %d 추적 mr = %d ट्रॅक nb = %d stier - nl = %d routes + nl = %d tracks pl = %d tras pt-BR:one = %d percurso pt-BR:other = %d percursos @@ -26271,3 +26312,8 @@ ru = https://wiki.openstreetmap.org/wiki/RU:О_проекте tr = https://wiki.openstreetmap.org/wiki/Tr:About uk = https://wiki.openstreetmap.org/wiki/Uk:Про_проект + + [comma_separated_pair] + comment = A number of bookmarks and a number of tracks, separated by comma, like: 1 bookmark, 5 tracks + tags = android + en = %s, %s diff --git a/iphone/Maps/Bookmarks/BookmarksCoordinator.swift b/iphone/Maps/Bookmarks/BookmarksCoordinator.swift index 8a2da88560..0b849e4a8b 100644 --- a/iphone/Maps/Bookmarks/BookmarksCoordinator.swift +++ b/iphone/Maps/Bookmarks/BookmarksCoordinator.swift @@ -47,7 +47,7 @@ import UIKit guard let bookmarksControllers = bookmarksControllers else { // Instead of BookmarksTabViewController let bookmarks = BMCViewController(coordinator: self) - bookmarks.title = L("bookmarks") + bookmarks.title = L("bookmarks_and_tracks") navigationController.pushViewController(bookmarks, animated: true) return } diff --git a/iphone/Maps/OMaps.plist b/iphone/Maps/OMaps.plist index fe4417967e..ee0c5202cf 100644 --- a/iphone/Maps/OMaps.plist +++ b/iphone/Maps/OMaps.plist @@ -131,7 +131,7 @@ UIApplicationShortcutItemIconFile ic_3dtouch_bookmarks UIApplicationShortcutItemTitle - bookmarks + bookmarks_and_tracks UIApplicationShortcutItemType app.organicmaps.3daction.bookmarks diff --git a/iphone/plist.txt b/iphone/plist.txt index 147b4d5ba9..8f083636fc 100644 --- a/iphone/plist.txt +++ b/iphone/plist.txt @@ -34,46 +34,46 @@ zh-Hans = 搜索 zh-Hant = 搜尋 - [bookmarks] + [bookmarks_and_tracks] tags = ios comment = Used in home screen quick actions. - en = Bookmarks - ar = الإشارات المرجعية - be = Закладкі - bg = Отметки - ca = Marcadors - cs = Záložky - da = Bogmærker - de = Lesezeichen - el = Αγαπημένα - es = Marcadores - et = Järjehoidjad - eu = Markagailuak - fa = نشانه ها - fi = Kirjanmerkit - fr = Signets - he = רשימות אתרים - hu = Könyvjelzők - id = Penanda - it = Luoghi preferiti - ja = ブックマーク - ko = 북마크 - mr = खूणपत्रे - nb = Bokmerker - nl = Bladwijzers - pl = Zakładki - pt = Favoritos - pt-BR = Favoritos - ro = Locuri preferate - ru = Метки - sk = Záložky - sv = Bokmärken - th = บุ๊กมาร์ก - tr = Yer İmleri - uk = Мітки - vi = Đánh dấu - zh-Hans = 书签 - zh-Hant = 書籤 + en = Bookmarks and Tracks + ar = الإشارات المرجعية والمسارات + be = Закладкі i cцежкі + bg = Отметки и пътеки + ca = Marcadors i traces + cs = Záložky a stopy + da = Bogmærker og ruter + de = Lesezeichen und Strecken + el = Αγαπημένα και διαδρομές + es = Marcadores y rutas + et = Järjehoidjad ja rajad + eu = Markagailuak eta ibilbideak + fa = نشانه‌ها و مسیر + fi = Kirjanmerkit ja reitit + fr = Signets et parcours + he = רשימות אתרים ונתיבים + hu = Könyvjelzők és nyomvonalak + id = Penanda dan jalur + it = Luoghi preferiti e percorsi + ja = ブックマークとトラック + ko = 북마크 및 트랙 + mr = खूणपत्रे आणि ट्रॅक + nb = Bokmerker og ruter + nl = Bladwijzers en tracks + pl = Zakładki i trasy + pt = Favoritos e trilhas + pt-BR = Favoritos e trilhas + ro = Locuri preferate și trasee + ru = Метки и треки + sk = Záložky a stopy + sv = Bokmärken och rutter + th = บุ๊กมาร์กและการติดตาม + tr = Yer İmleri ve kayıtlar + uk = Мітки та маршрути + vi = Đánh dấu và dấu vết + zh-Hans = 书签和轨迹 + zh-Hant = 書籤和軌跡 [route] tags = ios