Search in sources :

Example 36 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 37 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 38 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)

Example 39 with IConversation

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

the class RootFragment method dismissInboxFragment.

@Override
public void dismissInboxFragment() {
    IConversation nextConversation = getStoreFactory().getConversationStore().getNextConversation();
    if (nextConversation == null) {
        return;
    }
    getStoreFactory().getConversationStore().setCurrentConversation(nextConversation, ConversationChangeRequester.START_CONVERSATION);
}
Also used : IConversation(com.waz.api.IConversation)

Example 40 with IConversation

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

the class ConnectRequestInboxAdapter method getView.

@Override
public View getView(int position, View convertView, ViewGroup parent) {
    ViewHolder viewHolder;
    if (convertView == null) {
        convertView = new ConnectRequestInboxRow(parent.getContext());
        viewHolder = new ViewHolder();
        viewHolder.nameView = ViewUtils.getView(convertView, R.id.ttv__connect_request__display_name);
        viewHolder.separatorView = ViewUtils.getView(convertView, R.id.v__connect_request__separator_line);
        convertView.setTag(viewHolder);
    } else {
        viewHolder = (ViewHolder) convertView.getTag();
    }
    // Set valuesCon
    IConversation request = getItem(position);
    viewHolder.nameView.setText(request.getName());
    TextViewUtils.boldText(viewHolder.nameView);
    ((ConnectRequestInboxRow) convertView).setConnectActionCallback(connectActionsCallback);
    ((ConnectRequestInboxRow) convertView).setAccentColor(accentColor);
    ((ConnectRequestInboxRow) convertView).loadUser(request.getOtherParticipant());
    if (LayoutSpec.isPhone(context)) {
        if (position == 0) {
            viewHolder.separatorView.setVisibility(View.GONE);
        } else {
            viewHolder.separatorView.setVisibility(View.VISIBLE);
        }
    }
    return convertView;
}
Also used : IConversation(com.waz.api.IConversation) ConnectRequestInboxRow(com.waz.zclient.pages.main.connect.views.ConnectRequestInboxRow)

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