Search in sources :

Example 1 with ListActionsView

use of com.waz.zclient.pages.main.conversationlist.views.ListActionsView in project wire-android by wireapp.

the class ConversationListFragment method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup c, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_conversation_list, c, false);
    layoutNoConversations = ViewUtils.getView(view, R.id.ll__conversation_list__no_contacts);
    layoutNoConversations.setVisibility(View.GONE);
    conversationsListAdapter = new ConversationListAdapter(conversationCallback, getActivity());
    conversationsListAdapter.setConversationListMode(mode);
    swipeListView = new SwipeListView(getActivity());
    FrameLayout.LayoutParams paramsSticky = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    paramsSticky.topMargin = getResources().getDimensionPixelSize(R.dimen.conversation_list__sticky_view__top_margin);
    pullForActionContainer = ViewUtils.getView(view, R.id.pfac__conversation_list);
    swipeListView.setAllowSwipeAway(true);
    swipeListView.setAdapter(conversationsListAdapter);
    swipeListView.setOnItemClickListener(this);
    swipeListView.setDivider(null);
    swipeListView.setVerticalScrollBarEnabled(false);
    swipeListView.setSelector(R.drawable.empty_list_view_selector);
    swipeListView.setScrollingCacheEnabled(false);
    swipeListView.setAnimationCacheEnabled(false);
    conversationsListAdapter.setListView(swipeListView);
    archiveBox = ViewUtils.getView(view, R.id.ll__archiving_container);
    archiveBox.setVisibility(View.INVISIBLE);
    swipeListView.post(new Runnable() {

        @Override
        public void run() {
            if (swipeListView != null) {
                swipeListView.setOffsetRight(swipeListView.getMeasuredWidth() - // right side offset
                getResources().getDimensionPixelOffset(R.dimen.list_menu_distance_threshold));
            }
        }
    });
    swipeListView.setOnScrollListener(new ConversationListViewOnScrollListener());
    maxSwipeAlpha = ResourceUtils.getResourceFloat(getResources(), R.dimen.list__swipe_max_alpha);
    conversationsListAdapter.setMaxAlpha(maxSwipeAlpha);
    pullForActionContainer.setPullForActionView(swipeListView, PullForActionContainer.FillType.WRAP);
    pullForActionContainer.setPullToActionListener(this);
    pullForActionContainer.setPullForActionMode(PullForActionMode.BOTTOM);
    pebbleViewX = getResources().getDimensionPixelSize(R.dimen.framework__general__left_padding);
    if (mode != Mode.SHARING) {
        pebbleViewX += getResources().getDimensionPixelSize(R.dimen.list_extra_padding_when_unread);
    }
    hintContainer = ViewUtils.getView(view, R.id.ll__conversation_list__hint_container);
    hintHeader = ViewUtils.getView(view, R.id.chttv__conversation_list__hint_header);
    listActionsView = ViewUtils.getView(view, R.id.lav__conversation_list_actions);
    if (mode == Mode.SHARING) {
        listActionsView.setVisibility(View.GONE);
    } else {
        listActionsView.setCallback(new ListActionsView.Callback() {

            @Override
            public void onAvatarPress() {
                getControllerFactory().getPickUserController().showPickUser(IPickUserController.Destination.CONVERSATION_LIST, null);
                boolean hintVisible = hintContainer != null && hintContainer.getVisibility() == View.VISIBLE;
                ((BaseScalaActivity) getActivity()).injectJava(GlobalTrackingController.class).tagEvent(new OpenedContactsEvent(hintVisible));
                getControllerFactory().getOnboardingController().hideConversationListHint();
            }

            @Override
            public void onSettingsPress() {
                startActivity(ZetaPreferencesActivity.getDefaultIntent(getContext()));
            }
        });
    }
    return view;
}
Also used : BaseScalaActivity(com.waz.zclient.BaseScalaActivity) 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) SwipeListView(com.waz.zclient.pages.main.conversationlist.views.listview.SwipeListView) ListActionsView(com.waz.zclient.pages.main.conversationlist.views.ListActionsView) FrameLayout(android.widget.FrameLayout) OpenedContactsEvent(com.waz.zclient.controllers.tracking.events.navigation.OpenedContactsEvent)

Aggregations

View (android.view.View)1 AbsListView (android.widget.AbsListView)1 AdapterView (android.widget.AdapterView)1 FrameLayout (android.widget.FrameLayout)1 BaseScalaActivity (com.waz.zclient.BaseScalaActivity)1 OpenedContactsEvent (com.waz.zclient.controllers.tracking.events.navigation.OpenedContactsEvent)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