forked from organicmaps/organicmaps
[android] Fixed collection recycler animation.
This commit is contained in:
parent
aff4aa575b
commit
3fc748d792
3 changed files with 13 additions and 2 deletions
|
@ -24,6 +24,7 @@
|
|||
android:id="@+id/collections_recycler"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:overScrollMode="never"
|
||||
android:background="?cardBackground"/>
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/recycler"
|
||||
|
|
|
@ -62,8 +62,6 @@ public class BookmarkCollectionAdapter extends RecyclerView.Adapter<RecyclerView
|
|||
BookmarkCategory category = mHolder.getEntity();
|
||||
BookmarkManager.INSTANCE.toggleCategoryVisibility(category);
|
||||
category.invertVisibility();
|
||||
notifyItemChanged(mHolder.getAdapterPosition());
|
||||
notifyItemChanged(SectionPosition.INVALID_POSITION);
|
||||
|
||||
int type = BookmarkManager.INSTANCE.getCompilationType(category.getId());
|
||||
String compilationTypeString = type == BookmarkManager.CATEGORY ?
|
||||
|
@ -72,6 +70,13 @@ public class BookmarkCollectionAdapter extends RecyclerView.Adapter<RecyclerView
|
|||
Statistics.INSTANCE.trackGuideVisibilityChange(
|
||||
category.isVisible() ? Statistics.ParamValue.SHOW : Statistics.ParamValue.HIDE,
|
||||
category.getServerId(), compilationTypeString);
|
||||
|
||||
if (type == BookmarkManager.COLLECTION)
|
||||
notifyItemChanged(0);
|
||||
else if (mItemsCollection.size() > 0)
|
||||
notifyItemChanged(mItemsCollection.size() + 1);
|
||||
else
|
||||
notifyItemChanged(0);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -20,6 +20,7 @@ import androidx.appcompat.app.ActionBar;
|
|||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import androidx.recyclerview.widget.SimpleItemAnimator;
|
||||
import com.cocosw.bottomsheet.BottomSheet;
|
||||
import com.google.android.material.floatingactionbutton.FloatingActionButton;
|
||||
import com.mapswithme.maps.MwmActivity;
|
||||
|
@ -271,6 +272,10 @@ public class BookmarksListFragment extends BaseMwmRecyclerFragment<BookmarkListA
|
|||
manager.setSmoothScrollbarEnabled(true);
|
||||
mCollectionRecyclerView.setLayoutManager(manager);
|
||||
|
||||
RecyclerView.ItemAnimator itemAnimator = mCollectionRecyclerView.getItemAnimator();
|
||||
if (itemAnimator != null)
|
||||
((SimpleItemAnimator) itemAnimator).setSupportsChangeAnimations(false);
|
||||
|
||||
mCollectionRecyclerView.setAdapter(mBookmarkCollectionAdapter);
|
||||
configureRecyclerDividers(mCollectionRecyclerView);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue