swipe to dismiss: animate item undo
This commit is contained in:
parent
7d59182a9b
commit
b5398ea340
@ -368,7 +368,8 @@ public class HeadlinesFragment extends Fragment {
|
|||||||
@Override
|
@Override
|
||||||
public void onSwiped(RecyclerView.ViewHolder viewHolder, int direction) {
|
public void onSwiped(RecyclerView.ViewHolder viewHolder, int direction) {
|
||||||
|
|
||||||
final int position = viewHolder.getAdapterPosition() - m_adapter.getHeaderCount();
|
final int adapterPosition = viewHolder.getAdapterPosition();
|
||||||
|
final int position = adapterPosition - m_adapter.getHeaderCount();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
final Article article = getArticleAtPosition(position);
|
final Article article = getArticleAtPosition(position);
|
||||||
@ -398,7 +399,8 @@ public class HeadlinesFragment extends Fragment {
|
|||||||
}
|
}
|
||||||
|
|
||||||
m_articles.add(position, article);
|
m_articles.add(position, article);
|
||||||
m_adapter.notifyDataSetChanged();
|
m_adapter.notifyItemInserted(adapterPosition);
|
||||||
|
m_adapter.notifyItemRangeChanged(adapterPosition, 1);
|
||||||
}
|
}
|
||||||
}).show();
|
}).show();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user