Search in sources :

Example 1 with ConversationFragment

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

the class ConversationUIService method getConversationFragment.

public ConversationFragment getConversationFragment() {
    ConversationFragment conversationFragment = (ConversationFragment) UIService.getFragmentByTag(fragmentActivity, CONVERSATION_FRAGMENT);
    if (conversationFragment == null) {
        Contact contact = ((ConversationActivity) fragmentActivity).getContact();
        Channel channel = ((ConversationActivity) fragmentActivity).getChannel();
        Integer conversationId = ((ConversationActivity) fragmentActivity).getConversationId();
        conversationFragment = ConversationFragment.newInstance(contact, channel, conversationId, null, null);
        ConversationActivity.addFragment(fragmentActivity, conversationFragment, CONVERSATION_FRAGMENT);
    }
    return conversationFragment;
}
Also used : ConversationActivity(com.applozic.mobicomkit.uiwidgets.conversation.activity.ConversationActivity) Channel(com.applozic.mobicommons.people.channel.Channel) MobiComQuickConversationFragment(com.applozic.mobicomkit.uiwidgets.conversation.fragment.MobiComQuickConversationFragment) ConversationFragment(com.applozic.mobicomkit.uiwidgets.conversation.fragment.ConversationFragment) Contact(com.applozic.mobicommons.people.contact.Contact)

Example 2 with ConversationFragment

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

the class ConversationUIService method updateTypingStatus.

public void updateTypingStatus(String userId, String isTypingStatus) {
    if (!BroadcastService.isIndividual()) {
        return;
    }
    ConversationFragment conversationFragment = getConversationFragment();
    Utils.printLog(fragmentActivity, TAG, "Received typing status for: " + userId);
    if (conversationFragment != null && conversationFragment.getContact() != null && userId.equals(conversationFragment.getContact().getContactIds()) || conversationFragment.getChannel() != null) {
        conversationFragment.updateUserTypingStatus(userId, isTypingStatus);
    }
}
Also used : MobiComQuickConversationFragment(com.applozic.mobicomkit.uiwidgets.conversation.fragment.MobiComQuickConversationFragment) ConversationFragment(com.applozic.mobicomkit.uiwidgets.conversation.fragment.ConversationFragment)

Example 3 with ConversationFragment

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

the class ConversationActivity method onBackPressed.

@Override
public void onBackPressed() {
    if (isFromSearch()) {
        return;
    }
    if (getSupportFragmentManager().getBackStackEntryCount() == 1) {
        try {
            Intent upIntent = ApplozicSetting.getInstance(this).getParentActivityIntent(this);
            if (upIntent != null && isTaskRoot()) {
                TaskStackBuilder.create(this).addNextIntentWithParentStack(upIntent).startActivities();
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        this.finish();
        return;
    }
    Boolean takeOrder = getIntent().getBooleanExtra(TAKE_ORDER, false);
    ConversationFragment conversationFragment = (ConversationFragment) getSupportFragmentManager().findFragmentByTag(ConversationUIService.CONVERSATION_FRAGMENT);
    if (conversationFragment != null && conversationFragment.isVisible() && (conversationFragment.multimediaPopupGrid.getVisibility() == View.VISIBLE)) {
        conversationFragment.hideMultimediaOptionGrid();
        return;
    }
    if (takeOrder && getSupportFragmentManager().getBackStackEntryCount() == 2) {
        Intent upIntent = ApplozicSetting.getInstance(this).getParentActivityIntent(this);
        if (upIntent != null && isTaskRoot()) {
            TaskStackBuilder.create(this).addNextIntentWithParentStack(upIntent).startActivities();
        }
        ConversationActivity.this.finish();
    } else if (getSupportFragmentManager().getBackStackEntryCount() > 1) {
        getSupportFragmentManager().popBackStack();
    } else {
        super.onBackPressed();
    }
}
Also used : Intent(android.content.Intent) MobiComQuickConversationFragment(com.applozic.mobicomkit.uiwidgets.conversation.fragment.MobiComQuickConversationFragment) ConversationFragment(com.applozic.mobicomkit.uiwidgets.conversation.fragment.ConversationFragment)

Example 4 with ConversationFragment

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

the class ConversationUIService method updateMessageKeyString.

public void updateMessageKeyString(Message message) {
    if (!BroadcastService.isIndividual()) {
        return;
    }
    String userId = message.getContactIds();
    ConversationFragment conversationFragment = getConversationFragment();
    if (conversationFragment != null && !TextUtils.isEmpty(userId) && conversationFragment.getContact() != null && userId.equals(conversationFragment.getContact().getUserId()) || conversationFragment.getCurrentChannelKey(message.getGroupId())) {
        conversationFragment.updateMessageKeyString(message);
    }
}
Also used : MobiComQuickConversationFragment(com.applozic.mobicomkit.uiwidgets.conversation.fragment.MobiComQuickConversationFragment) ConversationFragment(com.applozic.mobicomkit.uiwidgets.conversation.fragment.ConversationFragment)

Example 5 with ConversationFragment

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

the class ConversationUIService method updateLastSeenStatus.

public void updateLastSeenStatus(String contactId) {
    if (BroadcastService.isQuick() && getQuickConversationFragment() != null) {
        getQuickConversationFragment().updateLastSeenStatus(contactId);
        return;
    }
    if (BroadcastService.isIndividual()) {
        final ConversationFragment conversationFragment = getConversationFragment();
        if (conversationFragment != null && conversationFragment.getContact() != null && contactId.equals(conversationFragment.getContact().getContactIds()) || conversationFragment.getChannel() != null) {
            Thread thread = new Thread(new Runnable() {

                @Override
                public void run() {
                    conversationFragment.updateLastSeenStatus();
                }
            });
            thread.setPriority(android.os.Process.THREAD_PRIORITY_BACKGROUND);
            thread.start();
        }
    }
}
Also used : MobiComQuickConversationFragment(com.applozic.mobicomkit.uiwidgets.conversation.fragment.MobiComQuickConversationFragment) ConversationFragment(com.applozic.mobicomkit.uiwidgets.conversation.fragment.ConversationFragment)

Aggregations

ConversationFragment (com.applozic.mobicomkit.uiwidgets.conversation.fragment.ConversationFragment)5 MobiComQuickConversationFragment (com.applozic.mobicomkit.uiwidgets.conversation.fragment.MobiComQuickConversationFragment)5 Intent (android.content.Intent)1 ConversationActivity (com.applozic.mobicomkit.uiwidgets.conversation.activity.ConversationActivity)1 Channel (com.applozic.mobicommons.people.channel.Channel)1 Contact (com.applozic.mobicommons.people.contact.Contact)1