Created
February 6, 2017 07:06
-
-
Save jedsada-gh/98a9a49f215ed2f02981d2f19fb23c0b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Override | |
public void onViewAttachedToWindow(VH holder) { | |
super.onViewAttachedToWindow(holder); | |
int position; | |
if (holder.getItemViewType() == TYPE_ITEM) { | |
position = holder.getAdapterPosition(); | |
if (position > lastPosition) { | |
lastPosition = position; | |
holder.itemView.startAnimation(getAnim(holder.itemView.getContext())); | |
} | |
} | |
} | |
@Override | |
public void onAttachedToRecyclerView(RecyclerView recyclerView) { | |
super.onAttachedToRecyclerView(recyclerView); | |
} | |
@Override | |
public void onViewDetachedFromWindow(VH holder) { | |
super.onViewDetachedFromWindow(holder); | |
if (holder.getItemViewType() == TYPE_ITEM) | |
holder.itemView.clearAnimation(); | |
} | |
private Animation getAnim(@NotNull Context context) { | |
return AnimationUtils.loadAnimation(context, R.anim.up_from_bottom); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment