Search in sources :

Example 16 with MobiComConversationService

use of com.applozic.mobicomkit.api.conversation.MobiComConversationService 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)

Example 17 with MobiComConversationService

use of com.applozic.mobicomkit.api.conversation.MobiComConversationService in project Applozic-Android-SDK by AppLozic.

the class ConversationUIService method deleteConversationThread.

public void deleteConversationThread(final Contact contact, final Channel channel) {
    AlertDialog.Builder alertDialog = new AlertDialog.Builder(fragmentActivity).setPositiveButton(R.string.delete_conversation, new DialogInterface.OnClickListener() {

        @Override
        public void onClick(DialogInterface dialogInterface, int i) {
            AlTask.execute(new DeleteConversationAsyncTask(new MobiComConversationService(fragmentActivity), contact, channel, null, fragmentActivity));
        }
    });
    alertDialog.setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {

        @Override
        public void onClick(DialogInterface dialogInterface, int i) {
        }
    });
    String name = "";
    if (channel != null) {
        if (Channel.GroupType.GROUPOFTWO.getValue().equals(channel.getType())) {
            String userId = ChannelService.getInstance(fragmentActivity).getGroupOfTwoReceiverUserId(channel.getKey());
            if (!TextUtils.isEmpty(userId)) {
                Contact withUserContact = baseContactService.getContactById(userId);
                name = withUserContact.getDisplayName();
            }
        } else {
            name = ChannelUtils.getChannelTitleName(channel, MobiComUserPreference.getInstance(fragmentActivity).getUserId());
        }
    } else if (contact != null) {
        name = contact.getDisplayName();
    }
    alertDialog.setTitle(fragmentActivity.getString(R.string.dialog_delete_conversation_title).replace("[name]", name));
    alertDialog.setMessage(fragmentActivity.getString(R.string.dialog_delete_conversation_confir).replace("[name]", name));
    alertDialog.setCancelable(true);
    alertDialog.create().show();
}
Also used : AlertDialog(android.app.AlertDialog) DialogInterface(android.content.DialogInterface) MobiComConversationService(com.applozic.mobicomkit.api.conversation.MobiComConversationService) Contact(com.applozic.mobicommons.people.contact.Contact)

Aggregations

MobiComConversationService (com.applozic.mobicomkit.api.conversation.MobiComConversationService)17 Message (com.applozic.mobicomkit.api.conversation.Message)5 DialogInterface (android.content.DialogInterface)4 Contact (com.applozic.mobicommons.people.contact.Contact)4 AlertDialog (android.app.AlertDialog)3 View (android.view.View)2 MobiComUserPreference (com.applozic.mobicomkit.api.account.user.MobiComUserPreference)2 MessageClientService (com.applozic.mobicomkit.api.conversation.MessageClientService)2 MessageDatabaseService (com.applozic.mobicomkit.api.conversation.database.MessageDatabaseService)2 AppContactService (com.applozic.mobicomkit.contact.AppContactService)2 DeleteConversationAsyncTask (com.applozic.mobicomkit.uiwidgets.conversation.DeleteConversationAsyncTask)2 ALStoragePermission (com.applozic.mobicomkit.uiwidgets.uilistener.ALStoragePermission)2 Before (org.junit.Before)2 NotificationManager (android.app.NotificationManager)1 Context (android.content.Context)1 Intent (android.content.Intent)1 IntentFilter (android.content.IntentFilter)1 ColorDrawable (android.graphics.drawable.ColorDrawable)1 ImageView (android.widget.ImageView)1 TextView (android.widget.TextView)1