From fe8a0e6a57a26678b24a016c5b2b927a04654beb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D0=BB=D0=B5=D0=BA=D1=81=D0=B0=D0=BD=D0=B4=D1=80=20?= =?UTF-8?q?=D0=97=D0=B0=D1=86=D0=B5=D0=BF=D0=B8=D0=BD?= Date: Mon, 18 May 2020 17:34:04 +0300 Subject: [PATCH] [android] Added checking on last owned category in bookmark list before allowing deletion --- .../mapswithme/maps/bookmarks/BookmarksListFragment.java | 8 ++++++++ .../maps/bookmarks/data/AbstractCategoriesSnapshot.java | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/android/src/com/mapswithme/maps/bookmarks/BookmarksListFragment.java b/android/src/com/mapswithme/maps/bookmarks/BookmarksListFragment.java index 7d7a156b1f..5c787ad60e 100644 --- a/android/src/com/mapswithme/maps/bookmarks/BookmarksListFragment.java +++ b/android/src/com/mapswithme/maps/bookmarks/BookmarksListFragment.java @@ -24,6 +24,7 @@ import com.google.android.material.floatingactionbutton.FloatingActionButton; import com.mapswithme.maps.MwmActivity; import com.mapswithme.maps.R; import com.mapswithme.maps.base.BaseMwmRecyclerFragment; +import com.mapswithme.maps.bookmarks.data.AbstractCategoriesSnapshot; import com.mapswithme.maps.bookmarks.data.BookmarkCategory; import com.mapswithme.maps.bookmarks.data.BookmarkInfo; import com.mapswithme.maps.bookmarks.data.BookmarkManager; @@ -490,6 +491,12 @@ public class BookmarksListFragment extends BaseMwmRecyclerFragment 0); + bs.getMenu().findItem(R.id.delete_category).setVisible(!isLastOwnedCategory()); BottomSheetHelper.tint(bs); bs.show(); diff --git a/android/src/com/mapswithme/maps/bookmarks/data/AbstractCategoriesSnapshot.java b/android/src/com/mapswithme/maps/bookmarks/data/AbstractCategoriesSnapshot.java index a34c2f18a6..129a26ccb7 100644 --- a/android/src/com/mapswithme/maps/bookmarks/data/AbstractCategoriesSnapshot.java +++ b/android/src/com/mapswithme/maps/bookmarks/data/AbstractCategoriesSnapshot.java @@ -17,7 +17,7 @@ public abstract class AbstractCategoriesSnapshot } @NonNull - protected List getItems() + public List getItems() { return mSnapshot; }