Search in sources :

Example 16 with IConversation

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

the class ParticipantHeaderFragmentTest method assertOneToOneConversationCanNotBeEdited.

@Test
public void assertOneToOneConversationCanNotBeEdited() throws InterruptedException {
    IConversation mockConversation = mock(IConversation.class);
    when(mockConversation.getType()).thenReturn(IConversation.Type.ONE_TO_ONE);
    when(mockConversation.isMemberOfConversation()).thenReturn(true);
    User otherUser = MockHelper.createMockUser("James", "988");
    when(otherUser.getVerified()).thenReturn(Verification.UNVERIFIED);
    when(mockConversation.getOtherParticipant()).thenReturn(otherUser);
    MockHelper.setupParticipantsMocks(mockConversation, activity);
    attachFragment(ParticipantHeaderFragment.newInstance(IConnectStore.UserRequester.CONVERSATION), ParticipantHeaderFragment.TAG);
    Thread.sleep(400);
    onView(withId(R.id.gtv__participants_header__pen_icon)).check(isGone());
    onView(withId(R.id.taet__participants__header__editable)).check(isGone());
}
Also used : User(com.waz.api.User) IConversation(com.waz.api.IConversation) Test(org.junit.Test) FragmentTest(com.waz.zclient.testutils.FragmentTest)

Example 17 with IConversation

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

the class BlockedUserProfileFragment method unblockUser.

private void unblockUser(User user) {
    goToConversationWithUser = true;
    ((BaseScalaActivity) getActivity()).injectJava(GlobalTrackingController.class).tagEvent(new UnblockingEvent());
    IConversation conversation = getStoreFactory().getConnectStore().unblockUser(user);
    if (conversation != null) {
        // Note! important to pass conversation returned by unblockUser() instead of user.getConversation()
        getContainer().onUnblockedUser(conversation);
    }
}
Also used : GlobalTrackingController(com.waz.zclient.tracking.GlobalTrackingController) UnblockingEvent(com.waz.zclient.controllers.tracking.events.connect.UnblockingEvent) IConversation(com.waz.api.IConversation)

Example 18 with IConversation

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

the class ConnectRequestInboxFragment method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, final ViewGroup viewContainer, Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.fragment_connect_request_inbox, viewContainer, false);
    ConnectActionsCallback connectActionsCallback = new ConnectActionsCallback() {

        @Override
        public void onAccepted(IConversation conversation) {
            onAcceptedUser(conversation);
        }

        @Override
        public void onIgnored(User user) {
            onIgnoredUser(user);
        }
    };
    inboxAdapter = new ConnectRequestInboxAdapter(getActivity(), connectActionsCallback);
    inboxListView = ViewUtils.getView(rootView, R.id.crlv_connect_request_inbox__list);
    if (LayoutSpec.isTablet(getActivity())) {
        inboxListView.setStackFromBottom(true);
        inboxListView.setTranscriptMode(AbsListView.TRANSCRIPT_MODE_ALWAYS_SCROLL);
    }
    inboxListView.setAdapter(inboxAdapter);
    if (savedInstanceState != null) {
        visibleConversationId = savedInstanceState.getString(ARGUMENT_CONVERSATION_ID);
    } else if (visibleConversationId.equals(NO_ARGUMENT_PROVIDED_CONVERSATION_ID)) {
        visibleConversationId = getArguments().getString(ARGUMENT_CONVERSATION_ID);
    }
    return rootView;
}
Also used : User(com.waz.api.User) IConversation(com.waz.api.IConversation) ConnectRequestInboxListView(com.waz.zclient.pages.main.connect.views.ConnectRequestInboxListView) View(android.view.View) AbsListView(android.widget.AbsListView)

Example 19 with IConversation

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

the class ConnectRequestInboxFragment method onConnectRequestInboxConversationsLoaded.

//////////////////////////////////////////////////////////////////////////////////////////
//
//  OnInboxLoadedListener
//
//////////////////////////////////////////////////////////////////////////////////////////
@Override
public void onConnectRequestInboxConversationsLoaded(List<IConversation> conversations, InboxLoadRequester inboxLoadRequester) {
    if (conversations.size() == 0) {
        return;
    }
    // Reset inbox, show first item
    if (inboxLoadRequester == InboxLoadRequester.CONNECT_REQUEST_NOTIFICATION || inboxLoadRequester == InboxLoadRequester.INBOX_LOAD) {
        visibleConversationId = NO_ARGUMENT_PROVIDED_CONVERSATION_ID;
        setInboxConversations(conversations, 0);
        return;
    }
    if (LayoutSpec.isTablet(getActivity())) {
        setInboxConversations(conversations, -1);
        return;
    }
    // Set main connect request if value is initiated for first time or a new id value was provided as an argument
    //  -> swiping back & forth between conversation list and inbox does not change currently displayed connect request
    int newVisiblePosition = 0;
    for (int i = 0; i < conversations.size(); i++) {
        IConversation conversation = conversations.get(i);
        if (conversation.getId().equals(visibleConversationId)) {
            newVisiblePosition = i;
            break;
        }
    }
    if (inboxAdapter.getMainConnectRequestPosition() != newVisiblePosition || inboxLoadRequester == InboxLoadRequester.INBOX_DISMISS) {
        setInboxConversations(conversations, newVisiblePosition);
    }
}
Also used : IConversation(com.waz.api.IConversation)

Example 20 with IConversation

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

the class ConnectRequestInboxRow method animateAccept.

private void animateAccept(final User user) {
    final int animationDuration = getResources().getInteger(R.integer.framework_animation_duration_medium);
    final List<Animator> animatorList = new ArrayList<>();
    final int translationDestination = -displayNameTextView.getWidth();
    for (View v : Arrays.asList(displayNameTextView)) {
        if (v == null) {
            continue;
        }
        ObjectAnimator animator = ObjectAnimator.ofFloat(v, View.TRANSLATION_X, translationDestination);
        animator.setInterpolator(new Expo.EaseIn());
        animatorList.add(animator);
    }
    for (View v : Arrays.asList(ignoreButton, acceptButton, acceptMenu)) {
        if (v == null) {
            continue;
        }
        ObjectAnimator animator = ObjectAnimator.ofFloat(v, View.ALPHA, 0f);
        animator.setInterpolator(new Quart.EaseOut());
        animatorList.add(animator);
    }
    AnimatorSet animatorSet = new AnimatorSet();
    animatorSet.addListener(new AnimatorListenerAdapter() {

        @Override
        public void onAnimationEnd(Animator animation) {
            scaleOutIfNecessary(new Runnable() {

                @Override
                public void run() {
                    final IConversation conversation = user.acceptConnection();
                    if (connectActionCallback != null) {
                        connectActionCallback.onAccepted(conversation);
                    }
                }
            });
        }
    });
    animatorSet.setDuration(animationDuration);
    animatorSet.playTogether(animatorList);
    animatorSet.start();
}
Also used : ObjectAnimator(android.animation.ObjectAnimator) ArrayList(java.util.ArrayList) AnimatorSet(android.animation.AnimatorSet) IConversation(com.waz.api.IConversation) ImageAssetImageView(com.waz.zclient.views.images.ImageAssetImageView) View(android.view.View) UserDetailsView(com.waz.zclient.ui.views.UserDetailsView) TextView(android.widget.TextView) Animator(android.animation.Animator) ObjectAnimator(android.animation.ObjectAnimator) ValueAnimator(android.animation.ValueAnimator) Expo(com.waz.zclient.ui.animation.interpolators.penner.Expo) Quart(com.waz.zclient.ui.animation.interpolators.penner.Quart) AnimatorListenerAdapter(android.animation.AnimatorListenerAdapter)

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