Search in sources :

Example 1 with ConversationCallbackHandler

use of com.applozic.mobicomkit.uiwidgets.conversation.ConversationCallbackHandler in project Applozic-Android-SDK by AppLozic.

the class ConversationFragment method onCreateView.

public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    this.title = getResources().getString(R.string.chats);
    this.conversationService = new MobiComConversationService(getActivity());
    hideExtendedSendingOptionLayout = true;
    View view = super.onCreateView(inflater, container, savedInstanceState);
    populateAttachmentOptions();
    conversationCallbackHandler = new ConversationCallbackHandler(getContext(), this);
    if (alCustomizationSettings.isHideAttachmentButton()) {
        attachButton.setVisibility(View.GONE);
        messageEditText.setPadding(20, 0, 0, 0);
    }
    sendType.setSelection(1);
    messageEditText.setHint(R.string.enter_message_hint);
    multimediaPopupGrid.setVisibility(View.GONE);
    ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(getActivity(), R.array.secret_message_timer_array, R.layout.mobiframework_custom_spinner);
    adapter.setDropDownViewResource(R.layout.mobiframework_custom_spinner);
    inputMethodManager = (InputMethodManager) getActivity().getSystemService(Activity.INPUT_METHOD_SERVICE);
    messageEditText.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            multimediaPopupGrid.setVisibility(View.GONE);
        }
    });
    attachButton.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View view) {
            if (contact != null && !contact.isBlocked() || channel != null) {
                if (attachmentLayout.getVisibility() == View.VISIBLE) {
                    Toast.makeText(getActivity(), R.string.select_file_count_limit, Toast.LENGTH_LONG).show();
                    return;
                }
            }
            if (channel != null) {
                if (Channel.GroupType.GROUPOFTWO.getValue().equals(channel.getType())) {
                    String userId = ChannelService.getInstance(getActivity()).getGroupOfTwoReceiverUserId(channel.getKey());
                    if (!TextUtils.isEmpty(userId)) {
                        Contact withUserContact = appContactService.getContactById(userId);
                        if (withUserContact.isBlocked()) {
                            userBlockDialog(false, withUserContact, true);
                        } else {
                            processAttachButtonClick(view);
                        }
                    }
                } else {
                    processAttachButtonClick(view);
                }
            } else if (contact != null) {
                if (contact.isBlocked()) {
                    userBlockDialog(false, contact, false);
                } else {
                    processAttachButtonClick(view);
                }
            }
        }
    });
    return view;
}
Also used : ConversationCallbackHandler(com.applozic.mobicomkit.uiwidgets.conversation.ConversationCallbackHandler) MobiComConversationService(com.applozic.mobicomkit.api.conversation.MobiComConversationService) View(android.view.View) MultimediaOptionsGridView(com.applozic.mobicomkit.uiwidgets.conversation.MultimediaOptionsGridView) Contact(com.applozic.mobicommons.people.contact.Contact)

Aggregations

View (android.view.View)1 MobiComConversationService (com.applozic.mobicomkit.api.conversation.MobiComConversationService)1 ConversationCallbackHandler (com.applozic.mobicomkit.uiwidgets.conversation.ConversationCallbackHandler)1 MultimediaOptionsGridView (com.applozic.mobicomkit.uiwidgets.conversation.MultimediaOptionsGridView)1 Contact (com.applozic.mobicommons.people.contact.Contact)1