Search in sources :

Example 41 with IConversation

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

the class PendingConnectRequestFragment method setFooterForIncomingConnectRequest.

private void setFooterForIncomingConnectRequest(final User user) {
    if (userRequester != IConnectStore.UserRequester.PARTICIPANTS) {
        return;
    }
    footerMenu.setVisibility(View.VISIBLE);
    footerMenu.setRightActionText(getString(R.string.glyph__minus));
    footerMenu.setCallback(new FooterMenuCallback() {

        @Override
        public void onLeftActionClicked() {
            IConversation conversation = user.acceptConnection();
            getContainer().onAcceptedConnectRequest(conversation);
        }

        @Override
        public void onRightActionClicked() {
            getContainer().showRemoveConfirmation(user);
        }
    });
    footerMenu.setLeftActionText(getString(R.string.glyph__plus));
    footerMenu.setLeftActionLabelText(getString(R.string.send_connect_request__connect_button__text));
}
Also used : FooterMenuCallback(com.waz.zclient.views.menus.FooterMenuCallback) IConversation(com.waz.api.IConversation)

Example 42 with IConversation

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

the class PendingConnectRequestFragment method setFooterForIgnoredConnectRequest.

private void setFooterForIgnoredConnectRequest(final User user) {
    footerMenu.setVisibility(View.VISIBLE);
    footerMenu.setRightActionText("");
    footerMenu.setRightActionLabelText("");
    footerMenu.setCallback(new FooterMenuCallback() {

        @Override
        public void onLeftActionClicked() {
            IConversation conversation = user.acceptConnection();
            getContainer().onAcceptedConnectRequest(conversation);
        }

        @Override
        public void onRightActionClicked() {
        }
    });
    footerMenu.setLeftActionText(getString(R.string.glyph__plus));
    footerMenu.setLeftActionLabelText(getString(R.string.send_connect_request__connect_button__text));
}
Also used : FooterMenuCallback(com.waz.zclient.views.menus.FooterMenuCallback) IConversation(com.waz.api.IConversation)

Example 43 with IConversation

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

the class ConversationFragmentTest method assertToolbarVisibleInOneToOneConversation.

@Test
public void assertToolbarVisibleInOneToOneConversation() throws InterruptedException {
    IConversation mockConversation = mock(IConversation.class);
    when(mockConversation.getType()).thenReturn(IConversation.Type.ONE_TO_ONE);
    when(mockConversation.isMemberOfConversation()).thenReturn(true);
    MockHelper.setupConversationMocks(mockConversation, activity);
    attachFragment(ConversationFragment.newInstance(), ConversationFragment.TAG);
    onView(withId(R.id.t_conversation_toolbar)).check(isVisible());
}
Also used : IConversation(com.waz.api.IConversation) FragmentTest(com.waz.zclient.testutils.FragmentTest) Test(org.junit.Test)

Example 44 with IConversation

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

the class FileUploadTest method assertFileIsLargeWarningShowed.

@Test
@SuppressLint("NewApi")
public void assertFileIsLargeWarningShowed() throws InterruptedException {
    IConversation mockConversation = mock(IConversation.class);
    when(mockConversation.getType()).thenReturn(IConversation.Type.ONE_TO_ONE);
    when(mockConversation.isMemberOfConversation()).thenReturn(true);
    when(mockConversation.isActive()).thenReturn(true);
    MockHelper.setupConversationMocks(mockConversation, activity);
    IConversationStore mockConversationStore = activity.getStoreFactory().getConversationStore();
    // Mock intent result
    String action;
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
        action = Intent.ACTION_OPEN_DOCUMENT;
    } else {
        action = Intent.ACTION_GET_CONTENT;
    }
    Matcher<Intent> expectedIntent = allOf(hasAction(action), hasType("*/*"));
    Intent intent = new Intent();
    intent.setData(Uri.parse("file:///tmp/whatever.txt"));
    Instrumentation.ActivityResult result = new Instrumentation.ActivityResult(Activity.RESULT_OK, intent);
    intending(expectedIntent).respondWith(result);
    doAnswer(new Answer<Void>() {

        @Override
        public Void answer(InvocationOnMock invocation) {
            Object[] args = invocation.getArguments();
            MessageContent.Asset.ErrorHandler errorHandler = (MessageContent.Asset.ErrorHandler) args[1];
            errorHandler.noWifiAndFileIsLarge(20 * 1024 * 1024, NetworkMode._3G, mock(MessageContent.Asset.Answer.class));
            return null;
        }
    }).when(mockConversationStore).sendMessage(any(AssetForUpload.class), any(MessageContent.Asset.ErrorHandler.class));
    // attach fragment
    attachFragment(ConversationFragment.newInstance(), ConversationFragment.TAG);
    // verify stuff
    Thread.sleep(500);
    onView(withId(R.id.cursor_menu_item_more)).perform(click());
    Thread.sleep(500);
    onView(withId(R.id.cursor_menu_item_file)).perform(click());
    Thread.sleep(200);
    onView(withText(activity.getString(R.string.asset_upload_warning__large_file__title))).check(isVisible());
}
Also used : MessageContent(com.waz.api.MessageContent) IConversationStore(com.waz.zclient.core.stores.conversation.IConversationStore) Instrumentation(android.app.Instrumentation) IConversation(com.waz.api.IConversation) Intent(android.content.Intent) InvocationOnMock(org.mockito.invocation.InvocationOnMock) AssetForUpload(com.waz.api.AssetForUpload) FragmentTest(com.waz.zclient.testutils.FragmentTest) Test(org.junit.Test) SuppressLint(android.annotation.SuppressLint)

Example 45 with IConversation

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

the class ParticipantHeaderFragmentTest method assertGroupMembersSummaryIsVisibleInGroup.

@Test
public void assertGroupMembersSummaryIsVisibleInGroup() throws InterruptedException {
    IConversation mockConversation = mock(IConversation.class);
    when(mockConversation.getType()).thenReturn(IConversation.Type.GROUP);
    when(mockConversation.isMemberOfConversation()).thenReturn(true);
    MockHelper.setupParticipantsMocks(mockConversation, activity);
    attachFragment(ParticipantHeaderFragment.newInstance(IConnectStore.UserRequester.CONVERSATION), ParticipantHeaderFragment.TAG);
    Thread.sleep(400);
    onView(withId(R.id.ttv__participants__sub_header)).check(isVisible());
}
Also used : IConversation(com.waz.api.IConversation) Test(org.junit.Test) FragmentTest(com.waz.zclient.testutils.FragmentTest)

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