use of com.waz.zclient.controllers.tracking.events.navigation.OpenedArchiveEvent in project wire-android by wireapp.
the class ConversationListFragment method onReleasedBottom.
@Override
public void onReleasedBottom() {
if (conversationsListAdapter.getArchivedState() != ConversationListAdapter.ArchivedState.GONE) {
return;
}
conversationsListAdapter.setArchivedState(ConversationListAdapter.ArchivedState.INVISIBLE, getResources().getInteger(R.integer.framework_animation_duration_medium));
final int smoothScrollPosition = conversationsListAdapter.getUnarchivedCount() - 1;
swipeListView.customSmoothScrollToPosition(smoothScrollPosition);
// The list view needs to be rearranged due to archive state
// we post it to the end of this rearrangement
new Handler().post(new Runnable() {
@Override
public void run() {
int offset = 0;
for (int i = 0; i < swipeListView.getChildCount(); i++) {
View view = swipeListView.getChildAt(i);
int id = view.getId();
if (id == smoothScrollPosition) {
offset = view.getTop() + view.getMeasuredHeight() + getResources().getDimensionPixelSize(R.dimen.list__archived_border_height) / 2;
}
}
getControllerFactory().getConversationListController().onReleasedPullDownFromBottom(offset);
}
});
// post to set archived to visible from invisible
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
if (conversationsListAdapter != null) {
conversationsListAdapter.setArchivedState(ConversationListAdapter.ArchivedState.VISIBLE, getResources().getInteger(R.integer.framework_animation_duration_medium));
if (getControllerFactory() == null || getControllerFactory().isTornDown()) {
return;
}
((BaseScalaActivity) getActivity()).injectJava(GlobalTrackingController.class).tagEvent(new OpenedArchiveEvent());
}
}
}, getResources().getInteger(R.integer.list__show_archived_delay));
}
Aggregations