diff --git a/android/build.gradle b/android/build.gradle
index 7bb9ab68b1..d070416f5f 100644
--- a/android/build.gradle
+++ b/android/build.gradle
@@ -153,7 +153,7 @@ configurations.all {
force "androidx.annotation:annotation:1.1.0"
force "androidx.core:core:1.3.1"
force "androidx.versionedparcelable:versionedparcelable:1.1.0"
- force "androidx.recyclerview:recyclerview:1.1.0"
+ force "androidx.recyclerview:recyclerview:1.2.0-alpha02"
failOnVersionConflict();
}
diff --git a/android/res/layout/fragment_bookmark_list.xml b/android/res/layout/fragment_bookmark_list.xml
index f03dd0d196..21dc09056c 100644
--- a/android/res/layout/fragment_bookmark_list.xml
+++ b/android/res/layout/fragment_bookmark_list.xml
@@ -5,35 +5,17 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
-
-
+
-
-
-
-
-
+ android:background="?cardBackground" />
+
mClickListener;
@NonNull
@@ -209,6 +212,7 @@ public class BookmarkCollectionAdapter extends RecyclerView.Adapter
+{
+ @NonNull
+ private final BookmarkCategory mCategory;
+ private boolean mVisible;
+ @NonNull
+ private final View.OnClickListener mOnClickListener;
+
+ BookmarkDescriptionAdapter(@NonNull BookmarkCategory category,
+ @NonNull View.OnClickListener onClickListener)
+ {
+ mCategory = category;
+ mOnClickListener = onClickListener;
+ }
+
+ @NonNull
+ @Override
+ public Holders.BookmarkDescriptionHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType)
+ {
+ BookmarkHeaderView view = new BookmarkHeaderView(parent.getContext());
+ return new Holders.BookmarkDescriptionHolder(view);
+ }
+
+ @Override
+ public void onBindViewHolder(@NonNull Holders.BookmarkDescriptionHolder holder, int position)
+ {
+ holder.bind(mCategory);
+ View button = holder.itemView.findViewById(R.id.btn_description);
+ button.setOnClickListener(mOnClickListener);
+ UiUtils.showRecyclerItemView(mVisible, holder.itemView);
+ }
+
+ @Override
+ public int getItemCount()
+ {
+ return 1;
+ }
+
+ void show(boolean visible)
+ {
+ mVisible = visible;
+ notifyItemChanged(0);
+ }
+}
diff --git a/android/src/com/mapswithme/maps/bookmarks/BookmarkHeaderView.java b/android/src/com/mapswithme/maps/bookmarks/BookmarkHeaderView.java
index 618a096480..7b7bfc10e9 100644
--- a/android/src/com/mapswithme/maps/bookmarks/BookmarkHeaderView.java
+++ b/android/src/com/mapswithme/maps/bookmarks/BookmarkHeaderView.java
@@ -21,20 +21,26 @@ public class BookmarkHeaderView extends LinearLayout
public static final String AUTHOR_LONELY_PLANET_ID = "28035594-6457-466d-8f6f-8499607df570";
+ @SuppressWarnings("NotNullFieldNotInitialized")
@NonNull
private ImageView mImageView;
+ @SuppressWarnings("NotNullFieldNotInitialized")
@NonNull
private TextView mTitle;
+ @SuppressWarnings("NotNullFieldNotInitialized")
@NonNull
private TextView mDescriptionBtn;
+ @SuppressWarnings("NotNullFieldNotInitialized")
@NonNull
private ImageView mImageViewLogo;
+ @SuppressWarnings("NotNullFieldNotInitialized")
@NonNull
private TextView mAuthorTextView;
public BookmarkHeaderView(@NonNull Context context)
{
super(context);
+ init();
}
public BookmarkHeaderView(@NonNull Context context, @Nullable AttributeSet attrs)
@@ -58,12 +64,6 @@ public class BookmarkHeaderView extends LinearLayout
private void init() {
setOrientation(LinearLayout.VERTICAL);
View.inflate(getContext(), R.layout.item_guide_info, this);
- }
-
- @Override
- protected void onFinishInflate()
- {
- super.onFinishInflate();
mImageView = findViewById(R.id.guide_image);
mTitle = findViewById(R.id.guide_title);
mDescriptionBtn = findViewById(R.id.btn_description);
@@ -71,11 +71,12 @@ public class BookmarkHeaderView extends LinearLayout
mImageViewLogo = findViewById(R.id.logo);
}
- public void setCategory(@NonNull BookmarkCategory category) {
- Context context = getContext();
+ public void setCategory(@NonNull BookmarkCategory category)
+ {
if (!category.isMyCategory())
{
- String imageUrl = category.getImageUrl();
+ final Context context = getContext();
+ final String imageUrl = category.getImageUrl();
if (TextUtils.isEmpty(imageUrl) || !ConnectionState.isConnected())
{
UiUtils.hide(mImageView);
@@ -106,7 +107,7 @@ public class BookmarkHeaderView extends LinearLayout
}
else
{
- UiUtils.hide(findViewById(R.id.guide_info));
+ UiUtils.hide(this);
}
}
}
diff --git a/android/src/com/mapswithme/maps/bookmarks/BookmarksListFragment.java b/android/src/com/mapswithme/maps/bookmarks/BookmarksListFragment.java
index 1f397bb050..086b7af17b 100644
--- a/android/src/com/mapswithme/maps/bookmarks/BookmarksListFragment.java
+++ b/android/src/com/mapswithme/maps/bookmarks/BookmarksListFragment.java
@@ -11,15 +11,13 @@ import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
-import android.widget.TextView;
import androidx.annotation.CallSuper;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.ActionBar;
import androidx.appcompat.app.AppCompatActivity;
-import androidx.core.widget.NestedScrollView;
-import androidx.recyclerview.widget.LinearLayoutManager;
+import androidx.recyclerview.widget.MergeAdapter;
import androidx.recyclerview.widget.RecyclerView;
import androidx.recyclerview.widget.SimpleItemAnimator;
import com.cocosw.bottomsheet.BottomSheet;
@@ -56,7 +54,7 @@ import com.mapswithme.util.statistics.Statistics;
import java.util.List;
-public class BookmarksListFragment extends BaseMwmRecyclerFragment
+public class BookmarksListFragment extends BaseMwmRecyclerFragment
implements BookmarkManager.BookmarksSharingListener,
BookmarkManager.BookmarksSortingListener,
BookmarkManager.BookmarksLoadingListener,
@@ -66,27 +64,22 @@ public class BookmarksListFragment extends BaseMwmRecyclerFragment openDescriptionScreen();
@CallSuper
@Override
@@ -141,19 +129,23 @@ public class BookmarksListFragment extends BaseMwmRecyclerFragment initAndGetCollectionAdapter(long categoryId)
{
List mCategoryItems = BookmarkManager.INSTANCE.getChildrenCategories(categoryId);
List mCollectionItems = BookmarkManager.INSTANCE.getChildrenCollections(categoryId);
- mBookmarkCollectionAdapter = new BookmarkCollectionAdapter(getCategoryOrThrow(),
- mCategoryItems, mCollectionItems);
- mBookmarkCollectionAdapter.setOnClickListener((v, item) -> {
+ BookmarkCollectionAdapter adapter = new BookmarkCollectionAdapter(getCategoryOrThrow(),
+ mCategoryItems, mCollectionItems);
+ adapter.setOnClickListener((v, item) -> {
Intent intent = BookmarkListActivity.getStartIntent(requireContext(), item);
final boolean isCategory = BookmarkManager.INSTANCE.getCompilationType(item.getId()) ==
@@ -162,6 +154,8 @@ public class BookmarksListFragment extends BaseMwmRecyclerFragment {
- openDescriptionScreen();
- });
+ configureRecyclerAnimations();
+ configureRecyclerDividers();
updateLoadingPlaceholder(view, false);
}
@@ -245,7 +227,7 @@ public class BookmarksListFragment extends BaseMwmRecyclerFragment
{
@@ -295,21 +271,6 @@ public class BookmarksListFragment extends BaseMwmRecyclerFragment