Search in sources :

Example 1 with OpenedArchiveEvent

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));
}
Also used : BaseScalaActivity(com.waz.zclient.BaseScalaActivity) OpenedArchiveEvent(com.waz.zclient.controllers.tracking.events.navigation.OpenedArchiveEvent) Handler(android.os.Handler) ExceptionHandler(net.hockeyapp.android.ExceptionHandler) TypefaceTextView(com.waz.zclient.ui.text.TypefaceTextView) View(android.view.View) AdapterView(android.widget.AdapterView) SwipeListView(com.waz.zclient.pages.main.conversationlist.views.listview.SwipeListView) ListActionsView(com.waz.zclient.pages.main.conversationlist.views.ListActionsView) AbsListView(android.widget.AbsListView) RightIndicatorView(com.waz.zclient.pages.main.conversationlist.views.row.RightIndicatorView) SuppressLint(android.annotation.SuppressLint)

Aggregations

SuppressLint (android.annotation.SuppressLint)1 Handler (android.os.Handler)1 View (android.view.View)1 AbsListView (android.widget.AbsListView)1 AdapterView (android.widget.AdapterView)1 BaseScalaActivity (com.waz.zclient.BaseScalaActivity)1 OpenedArchiveEvent (com.waz.zclient.controllers.tracking.events.navigation.OpenedArchiveEvent)1 ListActionsView (com.waz.zclient.pages.main.conversationlist.views.ListActionsView)1 SwipeListView (com.waz.zclient.pages.main.conversationlist.views.listview.SwipeListView)1 RightIndicatorView (com.waz.zclient.pages.main.conversationlist.views.row.RightIndicatorView)1 TypefaceTextView (com.waz.zclient.ui.text.TypefaceTextView)1 ExceptionHandler (net.hockeyapp.android.ExceptionHandler)1