-
Notifications
You must be signed in to change notification settings - Fork 182
Closed
Labels
Description
For animating items in ViewBinder method, I need to check if RecyclerView is scrolling up or down. In custom adapters, I usually add a global variable LASTPOSITION and compare it to current position for detecting up or down scroll for proper animation. How can we do so in RendererRecyclerViewAdapter? Also, how can access adapterPosition or position in ViewBinder?
FYI:
@Override
public void onBindViewHolder(final RecyclerView.ViewHolder viewHolder, int position) {
Animation animation = AnimationUtils.loadAnimation(mActivity, (position > lastPosition) ? R.anim.up_from_bottom : R.anim.down_from_top);
viewHolder.itemView.startAnimation(animation);
lastPosition = position;
}