use of com.haarman.listviewanimations.itemmanipulation.OnDismissCallback in project Klyph by jonathangerbaud.
the class Notifications method onActivityCreated.
/*
* @Override
* protected KlyphPullToRefreshListView onCreatePullToRefreshListView(LayoutInflater inflater, Bundle savedInstanceState)
* {
* return (KlyphPullToRefreshListView) inflater.inflate(R.layout.list_notifications, null);
* }
*/
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
NotificationSwipeDismissAdapter swAdapter = new NotificationSwipeDismissAdapter(new MultiObjectAdapter(getListView()), new OnDismissCallback() {
@Override
public void onDismiss(AbsListView arg0, int[] positions) {
for (int i : positions) {
if (getAdapter().getItem(i) instanceof Notification) {
Notification notification = (Notification) getAdapter().getItem(i);
setNotificationRead(notification);
}
}
List<GraphObject> list = new ArrayList<GraphObject>();
for (GraphObject o : getAdapter().getItems()) {
if (!(o instanceof Header)) {
list.add(o);
}
}
populate(list);
}
});
swAdapter.setAbsListView(getListView());
setListAdapter(swAdapter);
// setListAdapter(new MultiObjectAdapter(getListView()));
defineEmptyText(R.string.empty_list_no_notification);
setListVisible(false);
setRequestType(Query.NOTIFICATIONS);
loggedIn = true;
new Handler().postDelayed(new Runnable() {
public void run() {
loadNotifications();
}
}, 2000);
}
Aggregations