use of org.telegram.ui.Components.RoundVideoPlayingDrawable in project Telegram-FOSS by Telegram-FOSS-Team.
the class ChatMessageCell method drawOverlays.
public void drawOverlays(Canvas canvas) {
if (!drawFromPinchToZoom && delegate != null && delegate.getPinchToZoomHelper() != null && delegate.getPinchToZoomHelper().isInOverlayModeFor(this)) {
return;
}
long newAnimationTime = SystemClock.elapsedRealtime();
long animationDt = newAnimationTime - lastAnimationTime;
if (animationDt > 17) {
animationDt = 17;
}
lastAnimationTime = newAnimationTime;
if (currentMessageObject.hadAnimationNotReadyLoading && photoImage.getVisible() && !currentMessageObject.needDrawBluredPreview() && (documentAttachType == DOCUMENT_ATTACH_TYPE_ROUND || documentAttachType == DOCUMENT_ATTACH_TYPE_VIDEO || documentAttachType == DOCUMENT_ATTACH_TYPE_GIF)) {
AnimatedFileDrawable animation = photoImage.getAnimation();
if (animation != null && animation.hasBitmap()) {
currentMessageObject.hadAnimationNotReadyLoading = false;
updateButtonState(false, true, false);
}
}
if (hasGamePreview) {
} else if (currentMessageObject.type == MessageObject.TYPE_VIDEO || currentMessageObject.type == MessageObject.TYPE_PHOTO || documentAttachType == DOCUMENT_ATTACH_TYPE_VIDEO || documentAttachType == DOCUMENT_ATTACH_TYPE_GIF) {
if (photoImage.getVisible()) {
if (!currentMessageObject.needDrawBluredPreview()) {
if (documentAttachType == DOCUMENT_ATTACH_TYPE_VIDEO) {
int oldAlpha = ((BitmapDrawable) Theme.chat_msgMediaMenuDrawable).getPaint().getAlpha();
if (drawMediaCheckBox) {
Theme.chat_msgMediaMenuDrawable.setAlpha((int) (oldAlpha * controlsAlpha * (1.0f - checkBoxAnimationProgress)));
} else {
Theme.chat_msgMediaMenuDrawable.setAlpha((int) (oldAlpha * controlsAlpha));
}
setDrawableBounds(Theme.chat_msgMediaMenuDrawable, otherX = (int) (photoImage.getImageX() + photoImage.getImageWidth() - AndroidUtilities.dp(14)), otherY = (int) (photoImage.getImageY() + AndroidUtilities.dp(8.1f)));
Theme.chat_msgMediaMenuDrawable.draw(canvas);
Theme.chat_msgMediaMenuDrawable.setAlpha(oldAlpha);
}
}
boolean playing = MediaController.getInstance().isPlayingMessage(currentMessageObject);
if (animatingNoSoundPlaying != playing) {
animatingNoSoundPlaying = playing;
animatingNoSound = playing ? 1 : 2;
animatingNoSoundProgress = playing ? 1.0f : 0.0f;
}
boolean fullWidth = true;
if (currentPosition != null) {
int mask = MessageObject.POSITION_FLAG_LEFT | MessageObject.POSITION_FLAG_RIGHT;
fullWidth = (currentPosition.flags & mask) == mask;
}
if ((documentAttachType == DOCUMENT_ATTACH_TYPE_VIDEO || documentAttachType == DOCUMENT_ATTACH_TYPE_GIF) && (buttonState == 1 || buttonState == 2 || buttonState == 0 || buttonState == 3 || buttonState == -1 || currentMessageObject.needDrawBluredPreview())) {
if (autoPlayingMedia) {
updatePlayingMessageProgress();
}
if ((infoLayout != null || loadingProgressLayout != null) && (!forceNotDrawTime || autoPlayingMedia || drawVideoImageButton || animatingLoadingProgressProgress != 0 || (fullWidth && docTitleLayout != null) || (loadingProgressLayout != null && currentPosition != null && (buttonState == 1 || (buttonState == 3 && miniButtonState == 1))))) {
boolean drawLoadingProgress;
float alpha = 0;
boolean drawDocTitleLayout;
float loadingProgressAlpha = 1f;
if (!fullWidth) {
drawLoadingProgress = true;
drawDocTitleLayout = false;
loadingProgressAlpha = animatingLoadingProgressProgress;
} else {
drawLoadingProgress = (buttonState == 1 || miniButtonState == 1 || animatingLoadingProgressProgress != 0) && !currentMessageObject.isSecretMedia() && (documentAttachType == DOCUMENT_ATTACH_TYPE_VIDEO || documentAttachType == DOCUMENT_ATTACH_TYPE_GIF || documentAttachType == DOCUMENT_ATTACH_TYPE_DOCUMENT);
if (currentMessageObject.type == MessageObject.TYPE_VIDEO || currentMessageObject.type == 8 || documentAttachType == DOCUMENT_ATTACH_TYPE_VIDEO) {
alpha = currentMessageObject.needDrawBluredPreview() && docTitleLayout == null ? 0 : animatingDrawVideoImageButtonProgress;
}
drawDocTitleLayout = alpha > 0 && docTitleLayout != null;
if (!drawDocTitleLayout && (drawLoadingProgress || infoLayout == null)) {
loadingProgressAlpha = animatingLoadingProgressProgress;
}
}
Theme.chat_infoPaint.setColor(getThemedColor(Theme.key_chat_mediaInfoText));
int x1 = (int) (photoImage.getImageX() + AndroidUtilities.dp(4));
int y1 = (int) (photoImage.getImageY() + AndroidUtilities.dp(4));
int imageW;
int infoW;
if (autoPlayingMedia && (!playing || animatingNoSound != 0)) {
imageW = (int) ((Theme.chat_msgNoSoundDrawable.getIntrinsicWidth() + AndroidUtilities.dp(4)) * animatingNoSoundProgress);
} else {
imageW = 0;
}
if (drawLoadingProgress && loadingProgressLayout != null) {
imageW = 0;
infoW = (int) loadingProgressLayout.getLineWidth(0);
} else {
infoW = infoWidth;
}
int w = (int) Math.ceil(infoW + AndroidUtilities.dp(8) + imageW + (Math.max(infoW + (infoWidth == infoW ? imageW : 0), docTitleWidth) + (canStreamVideo ? AndroidUtilities.dp(32) : 0) - infoW - imageW) * alpha);
if (alpha != 0 && docTitleLayout == null) {
alpha = 0;
}
canvas.save();
canvas.scale(loadingProgressAlpha, loadingProgressAlpha, x1, y1);
int oldAlpha = getThemedPaint(Theme.key_paint_chatTimeBackground).getAlpha();
getThemedPaint(Theme.key_paint_chatTimeBackground).setAlpha((int) (oldAlpha * controlsAlpha * loadingProgressAlpha));
if (drawDocTitleLayout || (drawLoadingProgress && loadingProgressLayout != null) || (!drawLoadingProgress && infoLayout != null)) {
rect.set(x1, y1, x1 + w, y1 + AndroidUtilities.dp(16.5f + 15.5f * alpha));
int[] rad = photoImage.getRoundRadius();
int r = Math.min(AndroidUtilities.dp(8), Math.max(rad[0], rad[1]));
canvas.drawRoundRect(rect, r, r, getThemedPaint(Theme.key_paint_chatTimeBackground));
}
Theme.chat_infoPaint.setAlpha((int) (255 * controlsAlpha * loadingProgressAlpha));
canvas.translate(noSoundCenterX = (int) (photoImage.getImageX() + AndroidUtilities.dp(8 + (canStreamVideo ? 30 * alpha : 0))), photoImage.getImageY() + AndroidUtilities.dp(5.5f + 0.2f * alpha));
if (infoLayout != null && (!drawLoadingProgress || drawDocTitleLayout)) {
infoLayout.draw(canvas);
}
if (imageW != 0 && (!drawLoadingProgress || drawDocTitleLayout)) {
canvas.save();
Theme.chat_msgNoSoundDrawable.setAlpha((int) (255 * animatingNoSoundProgress * animatingNoSoundProgress * controlsAlpha));
int size = AndroidUtilities.dp(14 * animatingNoSoundProgress);
int y = (AndroidUtilities.dp(14) - size) / 2;
int offset = infoWidth + AndroidUtilities.dp(4);
canvas.translate(offset, 0);
Theme.chat_msgNoSoundDrawable.setBounds(0, y, size, y + size);
Theme.chat_msgNoSoundDrawable.draw(canvas);
noSoundCenterX += offset + size / 2;
canvas.restore();
}
if (drawLoadingProgress && loadingProgressLayout != null) {
canvas.save();
if (drawDocTitleLayout) {
Theme.chat_infoPaint.setAlpha((int) (255 * controlsAlpha * alpha));
canvas.translate(0, AndroidUtilities.dp(14.3f * alpha));
}
loadingProgressLayout.draw(canvas);
canvas.restore();
} else if (drawDocTitleLayout) {
Theme.chat_infoPaint.setAlpha((int) (255 * controlsAlpha * alpha));
canvas.translate(0, AndroidUtilities.dp(14.3f * alpha));
docTitleLayout.draw(canvas);
}
canvas.restore();
Theme.chat_infoPaint.setAlpha(255);
getThemedPaint(Theme.key_paint_chatTimeBackground).setAlpha(oldAlpha);
}
}
if (animatingDrawVideoImageButton == 1) {
animatingDrawVideoImageButtonProgress -= animationDt / 160.0f;
if (animatingDrawVideoImageButtonProgress <= 0) {
animatingDrawVideoImageButtonProgress = 0;
animatingDrawVideoImageButton = 0;
}
invalidate();
} else if (animatingDrawVideoImageButton == 2) {
animatingDrawVideoImageButtonProgress += animationDt / 160.0f;
if (animatingDrawVideoImageButtonProgress >= 1) {
animatingDrawVideoImageButtonProgress = 1;
animatingDrawVideoImageButton = 0;
}
invalidate();
}
if (animatingNoSound == 1) {
animatingNoSoundProgress -= animationDt / 180.0f;
if (animatingNoSoundProgress <= 0.0f) {
animatingNoSoundProgress = 0.0f;
animatingNoSound = 0;
}
invalidate();
} else if (animatingNoSound == 2) {
animatingNoSoundProgress += animationDt / 180.0f;
if (animatingNoSoundProgress >= 1.0f) {
animatingNoSoundProgress = 1.0f;
animatingNoSound = 0;
}
invalidate();
}
float animatingToLoadingProgress = (buttonState == 1 || miniButtonState == 1) && loadingProgressLayout != null ? 1f : 0f;
if (animatingToLoadingProgress == 0f && infoLayout != null && fullWidth) {
animatingLoadingProgressProgress = 0f;
}
if (animatingLoadingProgressProgress < animatingToLoadingProgress) {
animatingLoadingProgressProgress += animationDt / 160.0f;
if (animatingLoadingProgressProgress > animatingToLoadingProgress) {
animatingLoadingProgressProgress = animatingToLoadingProgress;
}
invalidate();
} else if (animatingLoadingProgressProgress != animatingToLoadingProgress) {
animatingLoadingProgressProgress -= animationDt / 160.0f;
if (animatingLoadingProgressProgress < animatingToLoadingProgress) {
animatingLoadingProgressProgress = animatingToLoadingProgress;
}
invalidate();
}
}
} else if (currentMessageObject.type == MessageObject.TYPE_GEO) {
if (docTitleLayout != null) {
if (currentMessageObject.isOutOwner()) {
Theme.chat_locationTitlePaint.setColor(getThemedColor(Theme.key_chat_messageTextOut));
Theme.chat_locationAddressPaint.setColor(getThemedColor(isDrawSelectionBackground() ? Theme.key_chat_outVenueInfoSelectedText : Theme.key_chat_outVenueInfoText));
} else {
Theme.chat_locationTitlePaint.setColor(getThemedColor(Theme.key_chat_messageTextIn));
Theme.chat_locationAddressPaint.setColor(getThemedColor(isDrawSelectionBackground() ? Theme.key_chat_inVenueInfoSelectedText : Theme.key_chat_inVenueInfoText));
}
if (currentMessageObject.messageOwner.media instanceof TLRPC.TL_messageMediaGeoLive) {
int cy = (int) (photoImage.getImageY2() + AndroidUtilities.dp(30));
if (!locationExpired || transitionParams.animateLocationIsExpired) {
forceNotDrawTime = true;
float progress;
String text;
StaticLayout docTitleLayout = this.docTitleLayout;
StaticLayout infoLayout = this.infoLayout;
float alpha = 1f;
if (transitionParams.animateLocationIsExpired) {
progress = transitionParams.lastDrawLocationExpireProgress;
text = transitionParams.lastDrawLocationExpireText;
docTitleLayout = transitionParams.lastDrawDocTitleLayout;
infoLayout = transitionParams.lastDrawInfoLayout;
alpha = 1f - transitionParams.animateChangeProgress;
} else {
progress = 1.0f - Math.abs(ConnectionsManager.getInstance(currentAccount).getCurrentTime() - currentMessageObject.messageOwner.date) / (float) currentMessageObject.messageOwner.media.period;
text = LocaleController.formatLocationLeftTime(Math.abs(currentMessageObject.messageOwner.media.period - (ConnectionsManager.getInstance(currentAccount).getCurrentTime() - currentMessageObject.messageOwner.date)));
}
rect.set(photoImage.getImageX2() - AndroidUtilities.dp(43), cy - AndroidUtilities.dp(15), photoImage.getImageX2() - AndroidUtilities.dp(13), cy + AndroidUtilities.dp(15));
if (currentMessageObject.isOutOwner()) {
Theme.chat_radialProgress2Paint.setColor(getThemedColor(Theme.key_chat_outInstant));
Theme.chat_livePaint.setColor(getThemedColor(Theme.key_chat_outInstant));
} else {
Theme.chat_radialProgress2Paint.setColor(getThemedColor(Theme.key_chat_inInstant));
Theme.chat_livePaint.setColor(getThemedColor(Theme.key_chat_inInstant));
}
int docTitleAlpha = Theme.chat_locationTitlePaint.getAlpha();
int infoAlpha = Theme.chat_locationAddressPaint.getAlpha();
int liveAplha = Theme.chat_livePaint.getAlpha();
if (alpha != 1f) {
Theme.chat_locationTitlePaint.setAlpha((int) (docTitleAlpha * alpha));
Theme.chat_locationAddressPaint.setAlpha((int) (infoAlpha * alpha));
Theme.chat_livePaint.setAlpha((int) (liveAplha * alpha));
canvas.save();
canvas.translate(0, -AndroidUtilities.dp(50) * transitionParams.animateChangeProgress);
}
Theme.chat_radialProgress2Paint.setAlpha((int) (50 * alpha));
canvas.drawCircle(rect.centerX(), rect.centerY(), AndroidUtilities.dp(15), Theme.chat_radialProgress2Paint);
Theme.chat_radialProgress2Paint.setAlpha((int) (255 * alpha));
canvas.drawArc(rect, -90, -360 * progress, false, Theme.chat_radialProgress2Paint);
float w = Theme.chat_livePaint.measureText(text);
canvas.drawText(text, rect.centerX() - w / 2, cy + AndroidUtilities.dp(4), Theme.chat_livePaint);
if (docTitleLayout != null && infoLayout != null) {
canvas.save();
canvas.translate(photoImage.getImageX() + AndroidUtilities.dp(10), photoImage.getImageY2() + AndroidUtilities.dp(10));
docTitleLayout.draw(canvas);
canvas.translate(0, AndroidUtilities.dp(23));
infoLayout.draw(canvas);
canvas.restore();
}
if (alpha != 1f) {
Theme.chat_locationTitlePaint.setAlpha(docTitleAlpha);
Theme.chat_locationAddressPaint.setAlpha(infoAlpha);
Theme.chat_livePaint.setAlpha(liveAplha);
canvas.restore();
}
transitionParams.lastDrawLocationExpireProgress = progress;
transitionParams.lastDrawLocationExpireText = text;
transitionParams.lastDrawDocTitleLayout = docTitleLayout;
transitionParams.lastDrawInfoLayout = infoLayout;
} else {
transitionParams.lastDrawLocationExpireText = null;
transitionParams.lastDrawDocTitleLayout = null;
transitionParams.lastDrawInfoLayout = null;
}
int cx = (int) (photoImage.getImageX() + photoImage.getImageWidth() / 2 - AndroidUtilities.dp(31));
cy = (int) (photoImage.getImageY() + photoImage.getImageHeight() / 2 - AndroidUtilities.dp(38));
setDrawableBounds(Theme.chat_msgAvatarLiveLocationDrawable, cx, cy);
Theme.chat_msgAvatarLiveLocationDrawable.draw(canvas);
locationImageReceiver.setImageCoords(cx + AndroidUtilities.dp(5.0f), cy + AndroidUtilities.dp(5.0f), AndroidUtilities.dp(52), AndroidUtilities.dp(52));
locationImageReceiver.draw(canvas);
} else {
canvas.save();
canvas.translate(photoImage.getImageX() + AndroidUtilities.dp(6), photoImage.getImageY2() + AndroidUtilities.dp(8));
docTitleLayout.draw(canvas);
if (infoLayout != null) {
canvas.translate(0, AndroidUtilities.dp(21));
infoLayout.draw(canvas);
}
canvas.restore();
}
}
} else if (currentMessageObject.type == 16) {
if (currentMessageObject.isOutOwner()) {
Theme.chat_audioTitlePaint.setColor(getThemedColor(Theme.key_chat_messageTextOut));
Theme.chat_contactPhonePaint.setColor(getThemedColor(isDrawSelectionBackground() ? Theme.key_chat_outTimeSelectedText : Theme.key_chat_outTimeText));
} else {
Theme.chat_audioTitlePaint.setColor(getThemedColor(Theme.key_chat_messageTextIn));
Theme.chat_contactPhonePaint.setColor(getThemedColor(isDrawSelectionBackground() ? Theme.key_chat_inTimeSelectedText : Theme.key_chat_inTimeText));
}
forceNotDrawTime = true;
int x;
if (currentMessageObject.isOutOwner()) {
x = layoutWidth - backgroundWidth + AndroidUtilities.dp(16);
} else {
if (isChat && !isThreadPost && currentMessageObject.needDrawAvatar()) {
x = AndroidUtilities.dp(74);
} else {
x = AndroidUtilities.dp(25);
}
}
otherX = x;
if (titleLayout != null) {
canvas.save();
canvas.translate(x, AndroidUtilities.dp(12) + namesOffset);
titleLayout.draw(canvas);
canvas.restore();
}
if (docTitleLayout != null) {
canvas.save();
canvas.translate(x + AndroidUtilities.dp(19), AndroidUtilities.dp(37) + namesOffset);
docTitleLayout.draw(canvas);
canvas.restore();
}
Drawable icon;
Drawable phone;
int idx = currentMessageObject.isVideoCall() ? 1 : 0;
if (currentMessageObject.isOutOwner()) {
icon = Theme.chat_msgCallUpGreenDrawable;
if (currentMessageObject.isVideoCall()) {
phone = getThemedDrawable(isDrawSelectionBackground() ? Theme.key_drawable_msgOutCallVideoSelected : Theme.key_drawable_msgOutCallVideo);
} else {
phone = getThemedDrawable(isDrawSelectionBackground() ? Theme.key_drawable_msgOutCallAudioSelected : Theme.key_drawable_msgOutCallAudio);
}
} else {
TLRPC.PhoneCallDiscardReason reason = currentMessageObject.messageOwner.action.reason;
if (reason instanceof TLRPC.TL_phoneCallDiscardReasonMissed || reason instanceof TLRPC.TL_phoneCallDiscardReasonBusy) {
icon = Theme.chat_msgCallDownRedDrawable;
} else {
icon = Theme.chat_msgCallDownGreenDrawable;
}
phone = isDrawSelectionBackground() ? Theme.chat_msgInCallSelectedDrawable[idx] : Theme.chat_msgInCallDrawable[idx];
}
setDrawableBounds(icon, x - AndroidUtilities.dp(1), AndroidUtilities.dp(37) + namesOffset);
icon.draw(canvas);
if (Build.VERSION.SDK_INT >= 21 && selectorDrawable[0] != null && selectorDrawableMaskType[0] == 4) {
selectorDrawable[0].draw(canvas);
}
if (!pinnedBottom && !pinnedTop) {
otherY = AndroidUtilities.dp(18.5f);
} else if (pinnedBottom && pinnedTop) {
otherY = AndroidUtilities.dp(18);
} else if (!pinnedBottom) {
otherY = AndroidUtilities.dp(17);
} else {
otherY = AndroidUtilities.dp(19);
}
setDrawableBounds(phone, x + AndroidUtilities.dp(idx == 0 ? 201 : 200), otherY);
phone.draw(canvas);
} else if (currentMessageObject.type == MessageObject.TYPE_POLL) {
long newTime = System.currentTimeMillis();
long dt = newTime - voteLastUpdateTime;
if (dt > 17) {
dt = 17;
}
voteLastUpdateTime = newTime;
int color1;
int color2;
if (currentMessageObject.isOutOwner()) {
color1 = getThemedColor(Theme.key_chat_messageTextOut);
color2 = getThemedColor(isDrawSelectionBackground() ? Theme.key_chat_outTimeSelectedText : Theme.key_chat_outTimeText);
} else {
color1 = getThemedColor(Theme.key_chat_messageTextIn);
color2 = getThemedColor(isDrawSelectionBackground() ? Theme.key_chat_inTimeSelectedText : Theme.key_chat_inTimeText);
}
Theme.chat_audioTitlePaint.setColor(color1);
Theme.chat_audioPerformerPaint.setColor(color1);
Theme.chat_instantViewPaint.setColor(color1);
Theme.chat_timePaint.setColor(color2);
Theme.chat_livePaint.setColor(color2);
Theme.chat_locationAddressPaint.setColor(color2);
canvas.save();
if (transitionParams.animateForwardedLayout) {
float y = namesOffset * transitionParams.animateChangeProgress + transitionParams.animateForwardedNamesOffset * (1f - transitionParams.animateChangeProgress);
if (currentMessageObject.needDrawForwarded()) {
y -= namesOffset;
}
canvas.translate(0, y);
}
int x;
if (currentMessageObject.isOutOwner()) {
x = layoutWidth - backgroundWidth + AndroidUtilities.dp(11);
} else {
if (isChat && !isThreadPost && currentMessageObject.needDrawAvatar()) {
x = AndroidUtilities.dp(68);
} else {
x = AndroidUtilities.dp(20);
}
}
if (titleLayout != null) {
canvas.save();
canvas.translate(x + getExtraTextX(), AndroidUtilities.dp(15) + namesOffset);
titleLayout.draw(canvas);
canvas.restore();
}
int y = (titleLayout != null ? titleLayout.getHeight() : 0) + AndroidUtilities.dp(20) + namesOffset;
if (docTitleLayout != null) {
canvas.save();
canvas.translate(x + docTitleOffsetX + getExtraTextX(), y);
docTitleLayout.draw(canvas);
canvas.restore();
TLRPC.TL_messageMediaPoll media = (TLRPC.TL_messageMediaPoll) currentMessageObject.messageOwner.media;
if (lastPoll.quiz && (pollVoted || pollClosed) && !TextUtils.isEmpty(media.results.solution)) {
Drawable drawable = getThemedDrawable(currentMessageObject.isOutOwner() ? Theme.key_drawable_chat_pollHintDrawableOut : Theme.key_drawable_chat_pollHintDrawableIn);
if (pollVoteInProgress) {
drawable.setAlpha((int) (255 * pollAnimationProgress));
} else {
drawable.setAlpha(255);
}
if (docTitleOffsetX < 0 || docTitleOffsetX == 0 && docTitleLayout.getLineLeft(0) == 0) {
pollHintX = currentBackgroundDrawable.getBounds().right - drawable.getIntrinsicWidth() - AndroidUtilities.dp(currentMessageObject.isOutOwner() ? 17 : 11);
} else {
pollHintX = getCurrentBackgroundLeft() + AndroidUtilities.dp(11);
}
pollHintY = y - AndroidUtilities.dp(6);
int cx = pollHintX + drawable.getIntrinsicWidth() / 2;
int cy = pollHintY + drawable.getIntrinsicHeight() / 2;
float scale = hintButtonVisible && hintButtonProgress < 1 ? AnimationProperties.overshootInterpolator.getInterpolation(hintButtonProgress) : hintButtonProgress;
int w = (int) (drawable.getIntrinsicWidth() * scale);
int h = (int) (drawable.getIntrinsicHeight() * scale);
drawable.setBounds(cx - w / 2, cy - h / 2, cx + w / 2, cy + h / 2);
drawable.draw(canvas);
} else {
pollHintX = -1;
}
if (pollAvatarImages != null && !isBot) {
int toAdd;
int ax;
int lineLeft = (int) Math.ceil(docTitleLayout.getLineLeft(0));
if (docTitleOffsetX != 0 || lineLeft != 0) {
toAdd = -AndroidUtilities.dp(13);
if (docTitleOffsetX != 0) {
ax = x + docTitleOffsetX - AndroidUtilities.dp(7 + 16) - getExtraTextX();
} else {
ax = x + lineLeft - AndroidUtilities.dp(7 + 16) - getExtraTextX();
}
} else {
toAdd = AndroidUtilities.dp(13);
ax = x + (int) Math.ceil(docTitleLayout.getLineWidth(0)) + AndroidUtilities.dp(7) + getExtraTextX();
}
for (int a = pollAvatarImages.length - 1; a >= 0; a--) {
if (!pollAvatarImagesVisible[a] || !pollAvatarImages[a].hasImageSet()) {
continue;
}
pollAvatarImages[a].setImageX(ax + toAdd * a);
pollAvatarImages[a].setImageY(y - AndroidUtilities.dp(1));
if (a != pollAvatarImages.length - 1) {
canvas.drawCircle(pollAvatarImages[a].getCenterX(), pollAvatarImages[a].getCenterY(), AndroidUtilities.dp(9), currentBackgroundDrawable.getPaint());
}
if (animatePollAvatars && animatePollAnswerAlpha) {
float alpha = Math.min(pollUnvoteInProgress ? (1.0f - pollAnimationProgress) / 0.3f : pollAnimationProgress, 1.0f);
pollAvatarImages[a].setAlpha(alpha);
}
pollAvatarImages[a].draw(canvas);
}
}
}
if ((!pollClosed && !pollVoted || pollVoteInProgress) && lastPoll.quiz && lastPoll.close_period != 0) {
long currentTime = ConnectionsManager.getInstance(currentAccount).getCurrentTimeMillis();
long time = Math.max(0, ((long) lastPoll.close_date) * 1000 - currentTime);
if (closeTimeText == null || lastPollCloseTime != time) {
closeTimeText = AndroidUtilities.formatDurationNoHours((int) Math.ceil(time / 1000.0f), false);
closeTimeWidth = (int) Math.ceil(Theme.chat_timePaint.measureText(closeTimeText));
lastPollCloseTime = time;
}
if (time <= 0 && !pollClosed) {
if (currentMessageObject.pollLastCheckTime + 1000 < SystemClock.elapsedRealtime()) {
currentMessageObject.pollLastCheckTime = 0;
}
delegate.needReloadPolls();
}
int tx = currentBackgroundDrawable.getBounds().right - closeTimeWidth - AndroidUtilities.dp(currentMessageObject.isOutOwner() ? 40 : 34);
if (time <= 5000) {
Theme.chat_timePaint.setColor(getThemedColor(currentMessageObject.isOutOwner() ? Theme.key_chat_outPollWrongAnswer : Theme.key_chat_inPollWrongAnswer));
}
if (animatePollAnswer) {
Theme.chat_timePaint.setAlpha((int) (255 * (1.0f - pollAnimationProgress)));
}
canvas.drawText(closeTimeText, tx, y + AndroidUtilities.dp(11), Theme.chat_timePaint);
Theme.chat_pollTimerPaint.setColor(Theme.chat_timePaint.getColor());
tx += closeTimeWidth + AndroidUtilities.dp(13);
int rad = AndroidUtilities.dp(5.1f);
int ty = y + AndroidUtilities.dp(6);
if (time <= 60000) {
rect.set(tx - rad, ty - rad, tx + rad, ty + rad);
float radProgress = -360 * (time / (Math.min(60, lastPoll.close_period) * 1000.0f));
canvas.drawArc(rect, -90, radProgress, false, Theme.chat_pollTimerPaint);
timerParticles.draw(canvas, Theme.chat_pollTimerPaint, rect, radProgress, pollVoteInProgress ? (1.0f - pollAnimationProgress) : 1.0f);
} else {
canvas.drawCircle(tx, ty, rad, Theme.chat_pollTimerPaint);
}
if (time > 60000 || timerTransitionProgress != 0.0f) {
Theme.chat_pollTimerPaint.setAlpha((int) (255 * timerTransitionProgress));
canvas.drawLine(tx - AndroidUtilities.dp(2.1f) * timerTransitionProgress, ty - AndroidUtilities.dp(7.5f), tx + AndroidUtilities.dp(2.1f) * timerTransitionProgress, ty - AndroidUtilities.dp(7.5f), Theme.chat_pollTimerPaint);
canvas.drawLine(tx, ty - AndroidUtilities.dp(3) * timerTransitionProgress, tx, ty, Theme.chat_pollTimerPaint);
if (time <= 60000) {
timerTransitionProgress -= dt / 180.0f;
if (timerTransitionProgress < 0) {
timerTransitionProgress = 0;
}
}
}
invalidate();
}
if (Build.VERSION.SDK_INT >= 21 && selectorDrawable[0] != null && (selectorDrawableMaskType[0] == 1 || selectorDrawableMaskType[0] == 3)) {
if (selectorDrawableMaskType[0] == 3) {
canvas.save();
canvas.scale(hintButtonProgress, hintButtonProgress, selectorDrawable[0].getBounds().centerX(), selectorDrawable[0].getBounds().centerY());
}
selectorDrawable[0].draw(canvas);
if (selectorDrawableMaskType[0] == 3) {
canvas.restore();
}
}
int lastVoteY = 0;
for (int a = 0, N = pollButtons.size(); a < N; a++) {
PollButton button = pollButtons.get(a);
button.x = x;
canvas.save();
canvas.translate(x + AndroidUtilities.dp(35), button.y + namesOffset);
button.title.draw(canvas);
int alpha = (int) (animatePollAnswerAlpha ? 255 * Math.min((pollUnvoteInProgress ? 1.0f - pollAnimationProgress : pollAnimationProgress) / 0.3f, 1.0f) : 255);
if (pollVoted || pollClosed || animatePollAnswerAlpha) {
if (lastPoll.quiz && pollVoted && button.chosen) {
String key;
if (button.correct) {
key = currentMessageObject.isOutOwner() ? Theme.key_chat_outPollCorrectAnswer : Theme.key_chat_inPollCorrectAnswer;
} else {
key = currentMessageObject.isOutOwner() ? Theme.key_chat_outPollWrongAnswer : Theme.key_chat_inPollWrongAnswer;
}
if (!currentBackgroundDrawable.hasGradient() || Theme.hasThemeKey(key)) {
Theme.chat_docBackPaint.setColor(getThemedColor(key));
} else {
Theme.chat_docBackPaint.setColor(getThemedColor(currentMessageObject.isOutOwner() ? Theme.key_chat_outAudioSeekbarFill : Theme.key_chat_inAudioSeekbarFill));
}
} else {
Theme.chat_docBackPaint.setColor(getThemedColor(currentMessageObject.isOutOwner() ? Theme.key_chat_outAudioSeekbarFill : Theme.key_chat_inAudioSeekbarFill));
}
if (animatePollAnswerAlpha) {
float oldAlpha = Theme.chat_instantViewPaint.getAlpha() / 255.0f;
Theme.chat_instantViewPaint.setAlpha((int) (alpha * oldAlpha));
oldAlpha = Theme.chat_docBackPaint.getAlpha() / 255.0f;
Theme.chat_docBackPaint.setAlpha((int) (alpha * oldAlpha));
}
int currentPercent = (int) Math.ceil(button.prevPercent + (button.percent - button.prevPercent) * pollAnimationProgress);
String text = String.format("%d%%", currentPercent);
int width = (int) Math.ceil(Theme.chat_instantViewPaint.measureText(text));
canvas.drawText(text, -AndroidUtilities.dp(6.5f) - width, AndroidUtilities.dp(14), Theme.chat_instantViewPaint);
width = backgroundWidth - AndroidUtilities.dp(76);
float currentPercentProgress = button.prevPercentProgress + (button.percentProgress - button.prevPercentProgress) * pollAnimationProgress;
rect.set(0, button.height + AndroidUtilities.dp(6), width * currentPercentProgress, button.height + AndroidUtilities.dp(11));
canvas.drawRoundRect(rect, AndroidUtilities.dp(2), AndroidUtilities.dp(2), Theme.chat_docBackPaint);
if (button.chosen || button.prevChosen || lastPoll.quiz && button.correct && (pollVoted || pollClosed)) {
float cx = rect.left - AndroidUtilities.dp(13.5f);
float cy = rect.centerY();
canvas.drawCircle(cx, cy, AndroidUtilities.dp(7), Theme.chat_docBackPaint);
Drawable drawable;
if (lastPoll.quiz && button.chosen && !button.correct) {
drawable = Theme.chat_pollCrossDrawable[currentMessageObject.isOutOwner() ? 1 : 0];
} else {
drawable = Theme.chat_pollCheckDrawable[currentMessageObject.isOutOwner() ? 1 : 0];
}
drawable.setAlpha(alpha);
setDrawableBounds(drawable, cx - drawable.getIntrinsicWidth() / 2, cy - drawable.getIntrinsicHeight() / 2);
drawable.draw(canvas);
}
}
if (!pollVoted && !pollClosed || animatePollAnswerAlpha) {
if (isDrawSelectionBackground()) {
Theme.chat_replyLinePaint.setColor(getThemedColor(currentMessageObject.isOutOwner() ? Theme.key_chat_outVoiceSeekbarSelected : Theme.key_chat_inVoiceSeekbarSelected));
} else {
Theme.chat_replyLinePaint.setColor(getThemedColor(currentMessageObject.isOutOwner() ? Theme.key_chat_outVoiceSeekbar : Theme.key_chat_inVoiceSeekbar));
}
if (animatePollAnswerAlpha) {
float oldAlpha = Theme.chat_replyLinePaint.getAlpha() / 255.0f;
Theme.chat_replyLinePaint.setAlpha((int) ((255 - alpha) * oldAlpha));
}
canvas.drawLine(-AndroidUtilities.dp(2), button.height + AndroidUtilities.dp(13), backgroundWidth - AndroidUtilities.dp(58), button.height + AndroidUtilities.dp(13), Theme.chat_replyLinePaint);
if (pollVoteInProgress && a == pollVoteInProgressNum) {
Theme.chat_instantViewRectPaint.setColor(getThemedColor(currentMessageObject.isOutOwner() ? Theme.key_chat_outAudioSeekbarFill : Theme.key_chat_inAudioSeekbarFill));
if (animatePollAnswerAlpha) {
float oldAlpha = Theme.chat_instantViewRectPaint.getAlpha() / 255.0f;
Theme.chat_instantViewRectPaint.setAlpha((int) ((255 - alpha) * oldAlpha));
}
rect.set(-AndroidUtilities.dp(22) - AndroidUtilities.dp(8.5f), AndroidUtilities.dp(9) - AndroidUtilities.dp(8.5f), -AndroidUtilities.dp(23) + AndroidUtilities.dp(8.5f), AndroidUtilities.dp(9) + AndroidUtilities.dp(8.5f));
canvas.drawArc(rect, voteRadOffset, voteCurrentCircleLength, false, Theme.chat_instantViewRectPaint);
} else {
if (currentMessageObject.isOutOwner()) {
Theme.chat_instantViewRectPaint.setColor(getThemedColor(isDrawSelectionBackground() ? Theme.key_chat_outMenuSelected : Theme.key_chat_outMenu));
} else {
Theme.chat_instantViewRectPaint.setColor(getThemedColor(isDrawSelectionBackground() ? Theme.key_chat_inMenuSelected : Theme.key_chat_inMenu));
}
if (animatePollAnswerAlpha) {
float oldAlpha = Theme.chat_instantViewRectPaint.getAlpha() / 255.0f;
Theme.chat_instantViewRectPaint.setAlpha((int) ((255 - alpha) * oldAlpha));
}
canvas.drawCircle(-AndroidUtilities.dp(22), AndroidUtilities.dp(9), AndroidUtilities.dp(8.5f), Theme.chat_instantViewRectPaint);
if (lastPoll.multiple_choice) {
int size = AndroidUtilities.dp(8.5f);
String key = Theme.key_checkboxCheck;
if (currentMessageObject.isOutOwner()) {
if (getThemedColor(key) == 0xffffffff) {
key = Theme.key_chat_outBubble;
}
}
pollCheckBox[a].setColor(null, currentMessageObject.isOutOwner() ? Theme.key_chat_outAudioSeekbarFill : Theme.key_chat_inAudioSeekbarFill, key);
pollCheckBox[a].setBounds(-AndroidUtilities.dp(22) - size / 2, AndroidUtilities.dp(9) - size / 2, size, size);
pollCheckBox[a].draw(canvas);
}
}
}
canvas.restore();
if (a == N - 1) {
lastVoteY = button.y + namesOffset + button.height;
}
}
if (drawInstantView) {
int textX = getCurrentBackgroundLeft() + AndroidUtilities.dp(currentMessageObject.isOutOwner() || mediaBackground || drawPinnedBottom ? 2 : 8);
int instantY = lastVoteY + AndroidUtilities.dp(13);
if (currentMessageObject.isOutOwner()) {
Theme.chat_instantViewPaint.setColor(getThemedColor(Theme.key_chat_outPreviewInstantText));
} else {
Theme.chat_instantViewPaint.setColor(getThemedColor(Theme.key_chat_inPreviewInstantText));
}
instantButtonRect.set(textX, instantY, textX + instantWidth, instantY + AndroidUtilities.dp(44));
if (selectorDrawable[0] != null && selectorDrawableMaskType[0] == 2) {
selectorDrawable[0].setBounds(textX, instantY, textX + instantWidth, instantY + AndroidUtilities.dp(44));
selectorDrawable[0].draw(canvas);
}
if (instantViewLayout != null) {
canvas.save();
canvas.translate(textX + instantTextX, instantY + AndroidUtilities.dp(14.5f));
instantViewLayout.draw(canvas);
canvas.restore();
}
} else if (infoLayout != null) {
if (lastPoll.public_voters || lastPoll.multiple_choice) {
lastVoteY += AndroidUtilities.dp(6);
}
canvas.save();
canvas.translate(x + infoX, lastVoteY + AndroidUtilities.dp(22));
infoLayout.draw(canvas);
canvas.restore();
}
updatePollAnimations(dt);
canvas.restore();
} else if (currentMessageObject.type == 12) {
if (currentMessageObject.isOutOwner()) {
Theme.chat_contactNamePaint.setColor(getThemedColor(Theme.key_chat_outContactNameText));
Theme.chat_contactPhonePaint.setColor(getThemedColor(isDrawSelectionBackground() ? Theme.key_chat_outContactPhoneSelectedText : Theme.key_chat_outContactPhoneText));
} else {
Theme.chat_contactNamePaint.setColor(getThemedColor(Theme.key_chat_inContactNameText));
Theme.chat_contactPhonePaint.setColor(getThemedColor(isDrawSelectionBackground() ? Theme.key_chat_inContactPhoneSelectedText : Theme.key_chat_inContactPhoneText));
}
if (titleLayout != null) {
canvas.save();
canvas.translate(photoImage.getImageX() + photoImage.getImageWidth() + AndroidUtilities.dp(9), AndroidUtilities.dp(16) + namesOffset);
titleLayout.draw(canvas);
canvas.restore();
}
if (docTitleLayout != null) {
canvas.save();
canvas.translate(photoImage.getImageX() + photoImage.getImageWidth() + AndroidUtilities.dp(9), AndroidUtilities.dp(39) + namesOffset);
docTitleLayout.draw(canvas);
canvas.restore();
}
Drawable menuDrawable;
if (currentMessageObject.isOutOwner()) {
menuDrawable = getThemedDrawable(isDrawSelectionBackground() ? Theme.key_drawable_msgOutMenuSelected : Theme.key_drawable_msgOutMenu);
} else {
menuDrawable = isDrawSelectionBackground() ? Theme.chat_msgInMenuSelectedDrawable : Theme.chat_msgInMenuDrawable;
}
setDrawableBounds(menuDrawable, otherX = (int) (photoImage.getImageX() + backgroundWidth - AndroidUtilities.dp(48)), otherY = (int) (photoImage.getImageY() - AndroidUtilities.dp(2)));
menuDrawable.draw(canvas);
if (drawInstantView) {
int textX = (int) (photoImage.getImageX() - AndroidUtilities.dp(2));
int instantY = layoutHeight - AndroidUtilities.dp(36 + 30);
if (!reactionsLayoutInBubble.isEmpty && !reactionsLayoutInBubble.isSmall) {
instantY -= reactionsLayoutInBubble.totalHeight;
}
Paint backPaint = Theme.chat_instantViewRectPaint;
if (currentMessageObject.isOutOwner()) {
Theme.chat_instantViewPaint.setColor(getThemedColor(Theme.key_chat_outPreviewInstantText));
backPaint.setColor(getThemedColor(Theme.key_chat_outPreviewInstantText));
} else {
Theme.chat_instantViewPaint.setColor(getThemedColor(Theme.key_chat_inPreviewInstantText));
backPaint.setColor(getThemedColor(Theme.key_chat_inPreviewInstantText));
}
instantButtonRect.set(textX, instantY, textX + instantWidth, instantY + AndroidUtilities.dp(36));
if (Build.VERSION.SDK_INT >= 21) {
selectorDrawableMaskType[0] = 0;
selectorDrawable[0].setBounds(textX, instantY, textX + instantWidth, instantY + AndroidUtilities.dp(36));
selectorDrawable[0].draw(canvas);
}
canvas.drawRoundRect(instantButtonRect, AndroidUtilities.dp(6), AndroidUtilities.dp(6), backPaint);
if (instantViewLayout != null) {
canvas.save();
canvas.translate(textX + instantTextX, instantY + AndroidUtilities.dp(10.5f));
instantViewLayout.draw(canvas);
canvas.restore();
}
}
}
if (drawImageButton && photoImage.getVisible()) {
if (controlsAlpha != 1.0f) {
radialProgress.setOverrideAlpha(controlsAlpha);
}
if (photoImage.hasImageSet()) {
radialProgress.setBackgroundDrawable(null);
} else {
radialProgress.setBackgroundDrawable(isDrawSelectionBackground() ? currentBackgroundSelectedDrawable : currentBackgroundDrawable);
}
if (!currentMessageObject.needDrawBluredPreview() || !MediaController.getInstance().isPlayingMessage(currentMessageObject)) {
radialProgress.draw(canvas);
}
}
if (buttonState == -1 && currentMessageObject.needDrawBluredPreview() && !MediaController.getInstance().isPlayingMessage(currentMessageObject) && photoImage.getVisible() && currentMessageObject.messageOwner.destroyTime != 0) {
if (!currentMessageObject.isOutOwner()) {
long msTime = System.currentTimeMillis() + ConnectionsManager.getInstance(currentAccount).getTimeDifference() * 1000;
float progress = Math.max(0, (long) currentMessageObject.messageOwner.destroyTime * 1000 - msTime) / (currentMessageObject.messageOwner.ttl * 1000.0f);
Theme.chat_deleteProgressPaint.setAlpha((int) (255 * controlsAlpha));
canvas.drawArc(deleteProgressRect, -90, -360 * progress, true, Theme.chat_deleteProgressPaint);
if (progress != 0) {
int offset = AndroidUtilities.dp(2);
invalidate((int) deleteProgressRect.left - offset, (int) deleteProgressRect.top - offset, (int) deleteProgressRect.right + offset * 2, (int) deleteProgressRect.bottom + offset * 2);
}
}
updateSecretTimeText(currentMessageObject);
}
if ((drawVideoImageButton || animatingDrawVideoImageButton != 0) && photoImage.getVisible()) {
if (controlsAlpha != 1.0f) {
videoRadialProgress.setOverrideAlpha(controlsAlpha);
}
videoRadialProgress.draw(canvas);
}
if (drawMediaCheckBox) {
if (documentAttachType == DOCUMENT_ATTACH_TYPE_MUSIC || documentAttachType == DOCUMENT_ATTACH_TYPE_DOCUMENT && !drawPhotoImage) {
int size = AndroidUtilities.dp(20);
mediaCheckBox.setBackgroundType(radialProgress.getMiniIcon() != MediaActionDrawable.ICON_NONE ? 12 : 13);
mediaCheckBox.setBounds(buttonX + AndroidUtilities.dp(28), buttonY + AndroidUtilities.dp(28), size, size);
mediaCheckBox.setColor(currentMessageObject.isOutOwner() ? Theme.key_chat_outTimeText : Theme.key_chat_inTimeText, currentMessageObject.isOutOwner() ? Theme.key_chat_outLoader : Theme.key_chat_inLoader, currentMessageObject.isOutOwner() ? Theme.key_chat_outBubble : Theme.key_chat_inBubble);
mediaCheckBox.setBackgroundDrawable(isDrawSelectionBackground() ? currentBackgroundSelectedDrawable : currentBackgroundDrawable);
} else {
int size = AndroidUtilities.dp(21);
mediaCheckBox.setBackgroundType(0);
mediaCheckBox.setBounds((int) photoImage.getImageX2() - AndroidUtilities.dp(21 + 4), (int) photoImage.getImageY() + AndroidUtilities.dp(4), size, size);
mediaCheckBox.setColor(null, null, currentMessageObject.isOutOwner() ? Theme.key_chat_outBubbleSelected : Theme.key_chat_inBubbleSelected);
mediaCheckBox.setBackgroundDrawable(null);
}
mediaCheckBox.draw(canvas);
}
if (documentAttachType == DOCUMENT_ATTACH_TYPE_ROUND) {
float x1, y1;
boolean playing = MediaController.getInstance().isPlayingMessage(currentMessageObject);
if (currentMessageObject.type == MessageObject.TYPE_ROUND_VIDEO) {
float offsetX = 0f;
if (currentMessageObject.isOutOwner()) {
float offsetSize = (AndroidUtilities.roundPlayingMessageSize - AndroidUtilities.roundMessageSize) * 0.2f;
offsetX = isPlayingRound ? offsetSize : 0;
if (transitionParams.animatePlayingRound) {
offsetX = (isPlayingRound ? transitionParams.animateChangeProgress : (1f - transitionParams.animateChangeProgress)) * offsetSize;
}
}
x1 = backgroundDrawableLeft + transitionParams.deltaLeft + AndroidUtilities.dp(8) + roundPlayingDrawableProgress + offsetX;
y1 = layoutHeight - AndroidUtilities.dp(28 - (drawPinnedBottom ? 2 : 0));
if (!reactionsLayoutInBubble.isEmpty) {
y1 -= reactionsLayoutInBubble.totalHeight;
}
transitionParams.lastDrawRoundVideoDotY = y1;
if (transitionParams.animateRoundVideoDotY) {
y1 = transitionParams.animateFromRoundVideoDotY * (1f - transitionParams.animateChangeProgress) + y1 * transitionParams.animateChangeProgress;
}
rect.set(x1, y1, x1 + timeWidthAudio + AndroidUtilities.dp(8 + 12 + 2), y1 + AndroidUtilities.dp(17));
int oldAlpha = getThemedPaint(Theme.key_paint_chatActionBackground).getAlpha();
getThemedPaint(Theme.key_paint_chatActionBackground).setAlpha((int) (oldAlpha * timeAlpha));
applyServiceShaderMatrix(getMeasuredWidth(), backgroundHeight, getX(), viewTop);
canvas.drawRoundRect(rect, AndroidUtilities.dp(6), AndroidUtilities.dp(6), getThemedPaint(Theme.key_paint_chatActionBackground));
if (hasGradientService()) {
int oldAlpha2 = Theme.chat_actionBackgroundGradientDarkenPaint.getAlpha();
Theme.chat_actionBackgroundGradientDarkenPaint.setAlpha((int) (oldAlpha2 * timeAlpha));
canvas.drawRoundRect(rect, AndroidUtilities.dp(6), AndroidUtilities.dp(6), Theme.chat_actionBackgroundGradientDarkenPaint);
Theme.chat_actionBackgroundGradientDarkenPaint.setAlpha(oldAlpha2);
}
getThemedPaint(Theme.key_paint_chatActionBackground).setAlpha(oldAlpha);
boolean showPlayingDrawable = playing || !currentMessageObject.isContentUnread();
if (showPlayingDrawable && roundPlayingDrawableProgress != 1f) {
roundPlayingDrawableProgress += 16f / 150f;
if (roundPlayingDrawableProgress > 1f) {
roundPlayingDrawableProgress = 1f;
} else {
invalidate();
}
} else if (!showPlayingDrawable && roundPlayingDrawableProgress != 0) {
roundPlayingDrawableProgress -= 16f / 150f;
if (roundPlayingDrawableProgress < 0f) {
roundPlayingDrawableProgress = 0f;
} else {
invalidate();
}
}
if (showPlayingDrawable) {
if (playing && !MediaController.getInstance().isMessagePaused()) {
roundVideoPlayingDrawable.start();
} else {
roundVideoPlayingDrawable.stop();
}
}
if (roundPlayingDrawableProgress < 1f) {
float cx = x1 + timeWidthAudio + AndroidUtilities.dp(12);
float cy = y1 + AndroidUtilities.dp(8.3f);
canvas.save();
canvas.scale((1f - roundPlayingDrawableProgress), (1f - roundPlayingDrawableProgress), cx, cy);
Theme.chat_docBackPaint.setColor(getThemedColor(Theme.key_chat_serviceText));
Theme.chat_docBackPaint.setAlpha((int) (255 * timeAlpha * (1f - roundPlayingDrawableProgress)));
canvas.drawCircle(cx, cy, AndroidUtilities.dp(3), Theme.chat_docBackPaint);
canvas.restore();
}
if (roundPlayingDrawableProgress > 0f) {
setDrawableBounds(roundVideoPlayingDrawable, x1 + timeWidthAudio + AndroidUtilities.dp(6), y1 + AndroidUtilities.dp(2.3f));
canvas.save();
canvas.scale(roundPlayingDrawableProgress, roundPlayingDrawableProgress, roundVideoPlayingDrawable.getBounds().centerX(), roundVideoPlayingDrawable.getBounds().centerY());
roundVideoPlayingDrawable.setAlpha((int) (255 * roundPlayingDrawableProgress));
roundVideoPlayingDrawable.draw(canvas);
canvas.restore();
}
x1 += AndroidUtilities.dp(4);
y1 += AndroidUtilities.dp(1.7f);
} else {
x1 = backgroundDrawableLeft + AndroidUtilities.dp(currentMessageObject.isOutOwner() || drawPinnedBottom ? 12 : 18);
y1 = layoutHeight - AndroidUtilities.dp(6.3f - (drawPinnedBottom ? 2 : 0)) - timeLayout.getHeight();
}
if (durationLayout != null) {
Theme.chat_timePaint.setAlpha((int) (255 * timeAlpha));
canvas.save();
canvas.translate(x1, y1);
durationLayout.draw(canvas);
canvas.restore();
Theme.chat_timePaint.setAlpha(255);
}
}
}
Aggregations