From 0ba811ad7c2920cbe432d1a10d235db114e10b67 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: Tue, 20 Mar 2018 18:33:41 +0300 Subject: [PATCH] [android] Implemented more button for category item in the list --- .../bookmarks/BookmarkCategoriesAdapter.java | 20 +++++++++++-------- .../bookmarks/BookmarkCategoriesFragment.java | 15 ++++++++++++-- 2 files changed, 25 insertions(+), 10 deletions(-) diff --git a/android/src/com/mapswithme/maps/bookmarks/BookmarkCategoriesAdapter.java b/android/src/com/mapswithme/maps/bookmarks/BookmarkCategoriesAdapter.java index a244515165..2b8711cb5f 100644 --- a/android/src/com/mapswithme/maps/bookmarks/BookmarkCategoriesAdapter.java +++ b/android/src/com/mapswithme/maps/bookmarks/BookmarkCategoriesAdapter.java @@ -26,7 +26,7 @@ public class BookmarkCategoriesAdapter extends BaseBookmarkCategoryAdapter { - if (mOnAddCategoryListener != null) - mOnAddCategoryListener.onAddCategory(); + if (mCategoryListInterface != null) + mCategoryListInterface.onAddCategory(); }); return new Holders.GeneralViewHolder(createListView); } @@ -105,7 +105,9 @@ public class BookmarkCategoriesAdapter extends BaseBookmarkCategoryAdapter { - Toast.makeText(getContext(), "Coming soon", Toast.LENGTH_SHORT).show(); + if (mCategoryListInterface != null) + mCategoryListInterface.onMoreOperationClick(categoryPosition); }); } @@ -141,8 +144,9 @@ public class BookmarkCategoriesAdapter extends BaseBookmarkCategoryAdapter 0 ? count + 2 /* header + add category btn */ : 0; } - interface OnAddCategoryListener + interface CategoryListInterface { void onAddCategory(); + void onMoreOperationClick(int position); } } diff --git a/android/src/com/mapswithme/maps/bookmarks/BookmarkCategoriesFragment.java b/android/src/com/mapswithme/maps/bookmarks/BookmarkCategoriesFragment.java index 3085c501ac..20c178d484 100644 --- a/android/src/com/mapswithme/maps/bookmarks/BookmarkCategoriesFragment.java +++ b/android/src/com/mapswithme/maps/bookmarks/BookmarkCategoriesFragment.java @@ -31,7 +31,7 @@ public class BookmarkCategoriesFragment extends BaseMwmRecyclerFragment RecyclerClickListener, RecyclerLongClickListener, BookmarkManager.BookmarksLoadingListener, - BookmarkCategoriesAdapter.OnAddCategoryListener + BookmarkCategoriesAdapter.CategoryListInterface { private long mSelectedCatId; @Nullable @@ -73,7 +73,7 @@ public class BookmarkCategoriesFragment extends BaseMwmRecyclerFragment { getAdapter().setOnClickListener(this); getAdapter().setOnLongClickListener(this); - getAdapter().setOnAddCategoryListener(this); + getAdapter().setCategoryListInterface(this); getAdapter().registerAdapterDataObserver(new RecyclerView.AdapterDataObserver() { @Override @@ -188,6 +188,11 @@ public class BookmarkCategoriesFragment extends BaseMwmRecyclerFragment @Override public void onLongItemClick(View v, int position) + { + showBottomMenu(position); + } + + private void showBottomMenu(int position) { final BookmarkManager bmManager = BookmarkManager.INSTANCE; mSelectedCatId = bmManager.getCategoryIdByPosition(position); @@ -205,6 +210,12 @@ public class BookmarkCategoriesFragment extends BaseMwmRecyclerFragment bs.tint().show(); } + @Override + public void onMoreOperationClick(int position) + { + showBottomMenu(position); + } + @Override public void onItemClick(View v, int position) {