use of org.telegram.ui.VoiceMessageEnterTransition in project Telegram-FOSS by Telegram-FOSS-Team.
the class ChatListItemAnimator method animateAddImpl.
public void animateAddImpl(final RecyclerView.ViewHolder holder, int addedItemsHeight) {
final View view = holder.itemView;
final ViewPropertyAnimator animation = view.animate();
mAddAnimations.add(holder);
view.setTranslationY(addedItemsHeight);
holder.itemView.setScaleX(1);
holder.itemView.setScaleY(1);
ChatMessageCell chatMessageCell = holder.itemView instanceof ChatMessageCell ? (ChatMessageCell) holder.itemView : null;
if (!(chatMessageCell != null && chatMessageCell.getTransitionParams().ignoreAlpha)) {
holder.itemView.setAlpha(1);
}
if (chatMessageCell != null && activity.animatingMessageObjects.contains(chatMessageCell.getMessageObject())) {
activity.animatingMessageObjects.remove(chatMessageCell.getMessageObject());
if (activity.getChatActivityEnterView().canShowMessageTransition()) {
if (chatMessageCell.getMessageObject().isVoice()) {
if (Math.abs(view.getTranslationY()) < view.getMeasuredHeight() * 3f) {
VoiceMessageEnterTransition transition = new VoiceMessageEnterTransition(chatMessageCell, activity.getChatActivityEnterView(), recyclerListView, activity.messageEnterTransitionContainer, resourcesProvider);
transition.start();
}
} else {
if (SharedConfig.getDevicePerformanceClass() != SharedConfig.PERFORMANCE_CLASS_LOW && Math.abs(view.getTranslationY()) < recyclerListView.getMeasuredHeight()) {
TextMessageEnterTransition transition = new TextMessageEnterTransition(chatMessageCell, activity, recyclerListView, activity.messageEnterTransitionContainer, resourcesProvider);
transition.start();
}
}
activity.getChatActivityEnterView().startMessageTransition();
}
}
animation.translationY(0).setDuration(getMoveDuration()).setInterpolator(translationInterpolator).setListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationStart(Animator animator) {
dispatchAddStarting(holder);
}
@Override
public void onAnimationCancel(Animator animator) {
view.setTranslationY(0);
if (view instanceof ChatMessageCell) {
((ChatMessageCell) view).getTransitionParams().messageEntering = false;
}
}
@Override
public void onAnimationEnd(Animator animator) {
if (view instanceof ChatMessageCell) {
((ChatMessageCell) view).getTransitionParams().messageEntering = false;
}
animation.setListener(null);
if (mAddAnimations.remove(holder)) {
dispatchAddFinished(holder);
dispatchFinishedWhenDone();
}
}
}).start();
}
Aggregations