@Nullable @Override public View onCreateView( LayoutInflater inflater, @Nullable ViewGroup viewContainer, @Nullable Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment_likes_list, viewContainer, false); toolbar = ViewUtils.getView(rootView, R.id.t__likes_list__toolbar); likersListView = ViewUtils.getView(rootView, R.id.rv__likes_list); likesAdapter = new LikesAdapter(); likersListView.setLayoutManager(new LinearLayoutManager(getActivity())); likersListView.setAdapter(likesAdapter); toolbar.setNavigationOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { getContainer().closeLikesList(); } }); Message likedMessage = getArguments().getParcelable(ARGUMENT_LIKED_MESSAGE); likesAdapter.setLikes(likedMessage.getLikes()); return rootView; }
@Override public void onIncomingMessage(final Message message) { if (message.getMessageType() == Message.Type.KNOCK || message.getMessageType() == Message.Type.MEMBER_JOIN || message.getMessageType() == Message.Type.MEMBER_LEAVE || message.getMessageType() == Message.Type.RENAME || message.getMessageType() == Message.Type.MISSED_CALL) { return; } IConversation currentConversation = getStoreFactory().getConversationStore().getCurrentConversation(); if (getStoreFactory() .getInAppNotificationStore() .shouldShowChatheads(currentConversation, message)) { notificationDisplayPrioritizer.onNewIncomingMessage(message); } // Play sound for incoming connect request if (message.getMessageType() == Message.Type.CONNECT_REQUEST && message.getConversation().getType() == IConversation.Type.INCOMING_CONNECTION) { getStoreFactory().getMediaStore().playSound(R.raw.first_message); } else if (message.getMessageType() == Message.Type.TEXT || message.getMessageType() == Message.Type.ASSET || message.getMessageType() == Message.Type.RICH_MEDIA) { if (message.isFirstMessage()) { getStoreFactory().getMediaStore().playSound(R.raw.first_message); } else { getStoreFactory().getMediaStore().playSound(R.raw.new_message); } } getControllerFactory().getVibratorController().vibrate(R.array.new_message); }
@Override public void onConversationLoaded(IConversation conversation) { currentNextMessageConversationType = conversation.getType(); getStoreFactory() .getConversationStore() .loadConversation( newIncomingMessage.getConversation().getId(), newMessageConversationListener); }
private void showChathead(Message message) { if (isDetached()) { return; } if (chatheadNotificationIsVisible || chatheadView == null) { return; } chatheadView.setMessage(message); final IConversation conversation = message.getConversation(); chatheadView.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { if (chatheadNotificationIsVisible) { getStoreFactory() .getConversationStore() .setCurrentConversation(conversation, ConversationChangeRequester.CHAT_HEAD); } } }); hideChatheadHandler.removeCallbacksAndMessages(null); if (MathUtils.floatEqual(chatheadView.getAlpha(), 1f)) { scheduleChatheadHide(); } else { if (isDetached()) { return; } chatheadView .animate() .alpha(1) .translationX(0) .setDuration( getResources().getInteger(R.integer.notification__chathead_animation__duration)) .withStartAction( new Runnable() { @Override public void run() { chatheadNotificationIsVisible = true; chatheadView.setTranslationX(-chatheadView.getMeasuredWidth()); } }) .withEndAction( new Runnable() { @Override public void run() { scheduleChatheadHide(); } }) .start(); } }
public void onNewIncomingMessage(Message newIncomingMessage) { if (currentNextMessage == null) { currentNextMessage = newIncomingMessage; showMessageHandler.removeCallbacksAndMessages(null); showMessageHandler.postDelayed( showChatheadRunnable, getResources() .getInteger( R.integer.notification__timespan_messages_considered_arriving_simultaneously)); } else { this.newIncomingMessage = newIncomingMessage; getStoreFactory() .getConversationStore() .loadConversation( currentNextMessage.getConversation().getId(), currentNextMessageConversationListener); } }