Search in sources :

Example 1 with EditActionSupport

use of com.waz.zclient.messages.controllers.EditActionSupport in project wire-android by wireapp.

the class ConversationFragment method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup viewGroup, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_conversation, viewGroup, false);
    extendedCursorContainer = ViewUtils.getView(view, R.id.ecc__conversation);
    containerPreview = ViewUtils.getView(view, R.id.fl__conversation_overlay);
    cursorLayout = ViewUtils.getView(view, R.id.cl__cursor);
    // TODO: remove that once cursorLayout is reimplemented in scala
    new EditActionSupport((WireContext) getActivity(), cursorLayout);
    audioMessageRecordingView = ViewUtils.getView(view, R.id.amrv_audio_message_recording);
    toolbar = ViewUtils.getView(view, R.id.t_conversation_toolbar);
    leftMenu = ViewUtils.getView(view, R.id.conversation_left_menu);
    toolbarTitle = ViewUtils.getView(toolbar, R.id.tv__conversation_toolbar__title);
    shieldView = ViewUtils.getView(view, R.id.sv__conversation_toolbar__verified_shield);
    shieldView.setVisibility(View.GONE);
    typingIndicatorView = ViewUtils.getView(view, R.id.tiv_typing_indicator_view);
    typingIndicatorView.setCallback(this);
    listView = ViewUtils.getView(view, R.id.messages_list_view);
    toolbar.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            getControllerFactory().getConversationScreenController().showParticipants(toolbar, false);
        }
    });
    toolbar.setOnMenuItemClickListener(new Toolbar.OnMenuItemClickListener() {

        @Override
        public boolean onMenuItemClick(MenuItem item) {
            switch(item.getItemId()) {
                case R.id.action_audio_call:
                    getControllerFactory().getCallingController().startCall(false);
                    cursorLayout.closeEditMessage(false);
                    return true;
                case R.id.action_video_call:
                    getControllerFactory().getCallingController().startCall(true);
                    cursorLayout.closeEditMessage(false);
                    return true;
            }
            return false;
        }
    });
    toolbar.setNavigationOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            if (LayoutSpec.isTablet(getContext()) && ViewUtils.isInLandscape(getContext())) {
                return;
            }
            cursorLayout.closeEditMessage(false);
            getActivity().onBackPressed();
            KeyboardUtils.closeKeyboardIfShown(getActivity());
        }
    });
    leftMenu.setOnMenuItemClickListener(new ActionMenuView.OnMenuItemClickListener() {

        @Override
        public boolean onMenuItemClick(MenuItem item) {
            switch(item.getItemId()) {
                case R.id.action_collection:
                    getCollectionController().openCollection();
                    return true;
            }
            return false;
        }
    });
    if (LayoutSpec.isTablet(getContext()) && ViewUtils.isInLandscape(getContext())) {
        toolbar.setNavigationIcon(null);
    }
    conversationLoadingIndicatorViewView = ViewUtils.getView(view, R.id.lbv__conversation__loading_indicator);
    if (BuildConfig.SHOW_MENTIONING) {
        getChildFragmentManager().beginTransaction().add(R.id.fl__conversation_overlay, MentioningFragment.getInstance(), MentioningFragment.TAG).commit();
    }
    // invisible footer to scroll over inputfield
    invisibleFooter = new FrameLayout(getActivity());
    AbsListView.LayoutParams params = new AbsListView.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, getResources().getDimensionPixelSize(R.dimen.cursor__list_view_footer__height));
    invisibleFooter.setLayoutParams(params);
    cursorLayout.showSendButton(false);
    // Recording audio messages
    audioMessageRecordingView.setCallback(this);
    if (LayoutSpec.isTablet(getActivity())) {
        view.setBackgroundColor(Color.WHITE);
    }
    if (savedInstanceState != null) {
        isPreviewShown = savedInstanceState.getBoolean(SAVED_STATE_PREVIEW, false);
    }
    return view;
}
Also used : AbsListView(android.widget.AbsListView) CursorMenuItem(com.waz.zclient.ui.cursor.CursorMenuItem) MenuItem(android.view.MenuItem) ShieldView(com.waz.zclient.ui.views.e2ee.ShieldView) AudioMessageRecordingView(com.waz.zclient.ui.audiomessage.AudioMessageRecordingView) LoadingIndicatorView(com.waz.zclient.views.LoadingIndicatorView) MessagesListView(com.waz.zclient.messages.MessagesListView) View(android.view.View) TextView(android.widget.TextView) TypingIndicatorView(com.waz.zclient.pages.main.conversation.views.TypingIndicatorView) AbsListView(android.widget.AbsListView) ActionMenuView(android.support.v7.widget.ActionMenuView) FrameLayout(android.widget.FrameLayout) ActionMenuView(android.support.v7.widget.ActionMenuView) EditActionSupport(com.waz.zclient.messages.controllers.EditActionSupport) Toolbar(android.support.v7.widget.Toolbar)

Aggregations

ActionMenuView (android.support.v7.widget.ActionMenuView)1 Toolbar (android.support.v7.widget.Toolbar)1 MenuItem (android.view.MenuItem)1 View (android.view.View)1 AbsListView (android.widget.AbsListView)1 FrameLayout (android.widget.FrameLayout)1 TextView (android.widget.TextView)1 MessagesListView (com.waz.zclient.messages.MessagesListView)1 EditActionSupport (com.waz.zclient.messages.controllers.EditActionSupport)1 TypingIndicatorView (com.waz.zclient.pages.main.conversation.views.TypingIndicatorView)1 AudioMessageRecordingView (com.waz.zclient.ui.audiomessage.AudioMessageRecordingView)1 CursorMenuItem (com.waz.zclient.ui.cursor.CursorMenuItem)1 ShieldView (com.waz.zclient.ui.views.e2ee.ShieldView)1 LoadingIndicatorView (com.waz.zclient.views.LoadingIndicatorView)1