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());
}
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);
}
}
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;
}
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);
}
}
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();
}
Aggregations