Search in sources :

Example 66 with IConversation

use of com.waz.api.IConversation in project wire-android by wireapp.

the class MainActivity method startCall.

private void startCall(final boolean withVideo) {
    final IConversation currentConversation = getStoreFactory().getConversationStore().getCurrentConversation();
    if (currentConversation == null) {
        return;
    }
    final VoiceChannel voiceChannel = currentConversation.getVoiceChannel();
    if (currentConversation.hasUnjoinedCall() && voiceChannel.isVideoCall() != withVideo) {
        ViewUtils.showAlertDialog(this, getString(R.string.calling__cannot_start__ongoing_different_kind__title, currentConversation.getName()), getString(R.string.calling__cannot_start__ongoing_different_kind__message), getString(R.string.calling__cannot_start__button), null, true);
        return;
    }
    if (currentConversation.getType() == IConversation.Type.GROUP && currentConversation.getUsers().size() >= 5) {
        int users = currentConversation.getUsers().size();
        ViewUtils.showAlertDialog(this, getString(R.string.group_calling_title), getString(R.string.group_calling_message, users), getString(R.string.group_calling_confirm), getString(R.string.group_calling_cancel), new DialogInterface.OnClickListener() {

            @Override
            public void onClick(DialogInterface dialog, int which) {
                injectJava(CallPermissionsController.class).startCall(new ConvId(voiceChannel.getConversation().getId()), withVideo);
            }
        }, null);
        return;
    } else {
        injectJava(CallPermissionsController.class).startCall(new ConvId(voiceChannel.getConversation().getId()), withVideo);
    }
}
Also used : CallPermissionsController(com.waz.zclient.calling.controllers.CallPermissionsController) DialogInterface(android.content.DialogInterface) VoiceChannel(com.waz.api.VoiceChannel) IConversation(com.waz.api.IConversation) ConvId(com.waz.model.ConvId) Paint(android.graphics.Paint)

Example 67 with IConversation

use of com.waz.api.IConversation in project wire-android by wireapp.

the class ScalaConversationStore method loadConnectRequestInboxConversations.

@Override
public void loadConnectRequestInboxConversations(OnInboxLoadedListener onConversationsLoadedListener, InboxLoadRequester inboxLoadRequester) {
    final List<IConversation> matches = new ArrayList<>();
    for (int i = 0; i < inboxList.size(); i++) {
        IConversation conversation = inboxList.get(i);
        if (isPendingIncomingConnectRequest(conversation)) {
            matches.add(conversation);
        }
    }
    onConversationsLoadedListener.onConnectRequestInboxConversationsLoaded(matches, inboxLoadRequester);
}
Also used : ArrayList(java.util.ArrayList) IConversation(com.waz.api.IConversation)

Example 68 with IConversation

use of com.waz.api.IConversation in project wire-android by wireapp.

the class ScalaConversationStore method getNextConversation.

@Override
public IConversation getNextConversation() {
    if (conversationsList == null || conversationsList.size() == 0) {
        return null;
    }
    for (int i = 0; i < conversationsList.size(); i++) {
        IConversation previousConversation = i >= 1 ? conversationsList.get(i - 1) : null;
        IConversation conversation = conversationsList.get(i);
        IConversation nextConversation = i == (conversationsList.size() - 1) ? null : conversationsList.get(i + 1);
        if (selectedConversation.equals(conversation)) {
            if (nextConversation != null) {
                return nextConversation;
            }
            return previousConversation;
        }
    }
    return null;
}
Also used : IConversation(com.waz.api.IConversation)

Example 69 with IConversation

use of com.waz.api.IConversation in project wire-android by wireapp.

the class ScalaConversationStore method setCurrentConversation.

@Override
public void setCurrentConversation(IConversation conversation, ConversationChangeRequester conversationChangerSender) {
    if (conversation instanceof InboxLinkConversation) {
        conversation = inboxList.get(0);
    }
    if (conversation != null) {
        conversation.setArchived(false);
    }
    if (conversation != null) {
        Timber.i("Set current conversation to %s, requester %s", conversation.getName(), conversationChangerSender);
    } else {
        Timber.i("Set current conversation to null, requester %s", conversationChangerSender);
    }
    this.conversationChangeRequester = conversationChangerSender;
    IConversation oldConversation = conversationChangerSender == ConversationChangeRequester.FIRST_LOAD ? null : selectedConversation;
    conversationsList.setSelectedConversation(conversation);
    if (oldConversation == null || (oldConversation != null && conversation != null && oldConversation.getId().equals(conversation.getId()))) {
        // Notify explicitly if the conversation doesn't change, the UiSginal notifies only when the conversation changes
        notifyCurrentConversationHasChanged(oldConversation, conversation, conversationChangerSender);
    }
}
Also used : IConversation(com.waz.api.IConversation) InboxLinkConversation(com.waz.zclient.core.stores.connect.InboxLinkConversation)

Aggregations

IConversation (com.waz.api.IConversation)69 FragmentTest (com.waz.zclient.testutils.FragmentTest)25 Test (org.junit.Test)25 GlobalTrackingController (com.waz.zclient.tracking.GlobalTrackingController)14 View (android.view.View)10 User (com.waz.api.User)9 ArrayList (java.util.ArrayList)6 SuppressLint (android.annotation.SuppressLint)5 Intent (android.content.Intent)4 Handler (android.os.Handler)4 AbsListView (android.widget.AbsListView)4 CreatedGroupConversationEvent (com.waz.zclient.controllers.tracking.events.group.CreatedGroupConversationEvent)4 FooterMenuCallback (com.waz.zclient.views.menus.FooterMenuCallback)4 Instrumentation (android.app.Instrumentation)3 TextView (android.widget.TextView)3 BaseScalaActivity (com.waz.zclient.BaseScalaActivity)3 AddedMemberToGroupEvent (com.waz.zclient.controllers.tracking.events.group.AddedMemberToGroupEvent)3 ExceptionHandler (net.hockeyapp.android.ExceptionHandler)3 Animator (android.animation.Animator)2 AnimatorSet (android.animation.AnimatorSet)2