Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added animation for Recycler View. #834

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;

import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.bumptech.glide.Glide;
Expand Down Expand Up @@ -57,6 +60,7 @@ public class NoteAdapter extends RecyclerView.Adapter<NoteViewHolder> {
private final boolean expandedView;
private long closestNoteReminder = Long.parseLong(TIMESTAMP_UNIX_EPOCH_FAR);
private int closestNotePosition;
private int lastPos = -1;


public NoteAdapter(Activity activity, boolean expandedView, List<Note> notes) {
Expand Down Expand Up @@ -133,6 +137,13 @@ private void initIcons(Note note, NoteViewHolder holder) {
}
}

private void initAnimation(View itemView, int position) {
if (position > lastPos) {
Animation animation = AnimationUtils.loadAnimation(mActivity.getApplicationContext(), android.R.anim.slide_in_left);
itemView.setAnimation(animation);
lastPos = position;
}
}

private void initText(Note note, NoteViewHolder holder) {
try {
Expand Down Expand Up @@ -319,6 +330,7 @@ public void onBindViewHolder(@NonNull NoteViewHolder holder, int position) {
initIcons(note, holder);
initDates(note, holder);
initThumbnail(note, holder);
initAnimation(holder.itemView,position);
manageSelectionColor(position, note, holder);
}

Expand Down