Search in sources :

Example 26 with IConversation

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

the class ConversationManagerFragment method onSelectedUsers.

@Override
public void onSelectedUsers(List<User> users, ConversationChangeRequester requester) {
    // TODO https://wearezeta.atlassian.net/browse/AN-3730
    getControllerFactory().getPickUserController().hidePickUser(getCurrentPickerDestination(), false);
    IConversation currentConversation = getStoreFactory().getConversationStore().getCurrentConversation();
    if (currentConversation.getType() == IConversation.Type.ONE_TO_ONE) {
        getStoreFactory().getConversationStore().createGroupConversation(users, requester);
        if (!getStoreFactory().getNetworkStore().hasInternetConnection()) {
            ViewUtils.showAlertDialog(getActivity(), R.string.conversation__create_group_conversation__no_network__title, R.string.conversation__create_group_conversation__no_network__message, R.string.conversation__create_group_conversation__no_network__button, null, true);
        }
        ((BaseScalaActivity) getActivity()).injectJava(GlobalTrackingController.class).tagEvent(new CreatedGroupConversationEvent(true, (users.size() + 1)));
    } else if (currentConversation.getType() == IConversation.Type.GROUP) {
        currentConversation.addMembers(users);
        if (!getStoreFactory().getNetworkStore().hasInternetConnection()) {
            ViewUtils.showAlertDialog(getActivity(), R.string.conversation__add_user__no_network__title, R.string.conversation__add_user__no_network__message, R.string.conversation__add_user__no_network__button, null, true);
        }
        ((BaseScalaActivity) getActivity()).injectJava(GlobalTrackingController.class).tagEvent(new AddedMemberToGroupEvent(getParticipantsCount(), users.size()));
    }
}
Also used : CreatedGroupConversationEvent(com.waz.zclient.controllers.tracking.events.group.CreatedGroupConversationEvent) GlobalTrackingController(com.waz.zclient.tracking.GlobalTrackingController) BaseScalaActivity(com.waz.zclient.BaseScalaActivity) IConversation(com.waz.api.IConversation) AddedMemberToGroupEvent(com.waz.zclient.controllers.tracking.events.group.AddedMemberToGroupEvent)

Example 27 with IConversation

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

the class ConversationFragment method openExtendedCursor.

private void openExtendedCursor(ExtendedCursorContainer.Type type) {
    final IConversation conversation = getStoreFactory().getConversationStore().getCurrentConversation();
    switch(type) {
        case NONE:
            break;
        case VOICE_FILTER_RECORDING:
            extendedCursorContainer.openVoiceFilter(this);
            hideSendButtonIfNeeded();
            ((BaseScalaActivity) getActivity()).injectJava(GlobalTrackingController.class).tagEvent(OpenedMediaActionEvent.cursorAction(OpenedMediaAction.AUDIO_MESSAGE, conversation));
            break;
        case IMAGES:
            extendedCursorContainer.openCursorImages(this);
            hideSendButtonIfNeeded();
            ((BaseScalaActivity) getActivity()).injectJava(GlobalTrackingController.class).tagEvent(OpenedMediaActionEvent.cursorAction(OpenedMediaAction.PHOTO, conversation));
            break;
    }
}
Also used : GlobalTrackingController(com.waz.zclient.tracking.GlobalTrackingController) IConversation(com.waz.api.IConversation)

Example 28 with IConversation

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

the class ConversationFragment method onEphemeralButtonClicked.

@Override
public void onEphemeralButtonClicked(EphemeralExpiration currentEphemeralExpiration) {
    extendedCursorContainer.openEphemeral(this, currentEphemeralExpiration);
    if (currentEphemeralExpiration == EphemeralExpiration.NONE) {
        IConversation conversation = getStoreFactory().getConversationStore().getCurrentConversation();
        ((BaseScalaActivity) getActivity()).injectJava(GlobalTrackingController.class).tagEvent(OpenedMediaActionEvent.ephemeral(conversation, false));
    }
}
Also used : GlobalTrackingController(com.waz.zclient.tracking.GlobalTrackingController) IConversation(com.waz.api.IConversation)

Example 29 with IConversation

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

the class TabbedParticipantBodyFragment method updateViews.

private void updateViews(User user) {
    if (viewPager == null) {
        return;
    }
    View view = viewPager.findViewWithTag(TabbedParticipantPagerAdapter.ParticipantTabs.DETAILS);
    if (view instanceof ParticipantDetailsTab) {
        ParticipantDetailsTab tab = (ParticipantDetailsTab) view;
        tab.setUser(user);
        final IConversation conversation = getStoreFactory().getConversationStore().getCurrentConversation();
        if (conversation != null) {
            if (conversation.getType() == IConversation.Type.ONE_TO_ONE) {
                tab.updateFooterMenu(R.string.glyph__add_people, R.string.conversation__action__create_group, R.string.glyph__more, R.string.empty_string, callbacks);
            } else {
                tab.updateFooterMenu(R.string.glyph__conversation, R.string.empty_string, R.string.glyph__minus, R.string.empty_string, callbacks);
            }
        }
    }
}
Also used : IConversation(com.waz.api.IConversation) View(android.view.View) ParticipantDetailsTab(com.waz.zclient.pages.main.participants.views.ParticipantDetailsTab)

Example 30 with IConversation

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

the class TabbedParticipantBodyFragment method updateUser.

private void updateUser() {
    IConversation conversation = getStoreFactory().getConversationStore().getCurrentConversation();
    if (conversation == null) {
        userModelObserver.clear();
        userModelObserverForTabs.clear();
        otrClientsModelObserver.clear();
        return;
    }
    User updatedUser;
    if (conversation.getType() == IConversation.Type.ONE_TO_ONE) {
        updatedUser = conversation.getOtherParticipant();
    } else {
        updatedUser = getStoreFactory().getSingleParticipantStore().getUser();
    }
    userModelObserver.setAndUpdate(updatedUser);
    userModelObserverForTabs.setAndUpdate(updatedUser);
}
Also used : User(com.waz.api.User) IConversation(com.waz.api.IConversation)

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