fixed memory leak

This commit is contained in:
AlexandrKozlovskiy 2024-01-03 21:38:33 +03:00
parent d5ee96dd46
commit 970f511dd5
3 changed files with 276 additions and 281 deletions

View file

@ -80,10 +80,11 @@ public class AvatarPreviewer {
private Layout layout; private Layout layout;
private boolean visible; private boolean visible;
public void show(ViewGroup parentContainer, Data data, boolean accessibility,Callback callback) { public void show(ViewGroup parentContainer, Theme.ResourcesProvider resourcesProvider, Data data, Callback callback,boolean accessibility) {
Preconditions.checkNotNull(parentContainer);
Preconditions.checkNotNull(data); Objects.requireNonNull(parentContainer);
Preconditions.checkNotNull(callback); Objects.requireNonNull(data);
Objects.requireNonNull(callback);
final Context context = parentContainer.getContext(); final Context context = parentContainer.getContext();
@ -130,12 +131,12 @@ public void show(ViewGroup parentContainer, Data data, boolean accessibility,Cal
parentContainer.requestDisallowInterceptTouchEvent(true); parentContainer.requestDisallowInterceptTouchEvent(true);
visible = true; visible = true;
} }
else layout.showBottomSheet(); else layout.showContextMenu();
} }
} }
public void show(ViewGroup parentContainer, Data data, Callback callback) { public void show(ViewGroup parentContainer, Theme.ResourcesProvider resourcesProvider, Data data, Callback callback) {
show(parentContainer,data,false,callback); show(parentContainer,resourcesProvider,data,callback,false);
} }
public void close() { public void close() {
if (visible) { if (visible) {
@ -458,9 +459,9 @@ show(parentContainer,data,false,callback);
} else if (id == NotificationCenter.fileLoadProgressChanged) { } else if (id == NotificationCenter.fileLoadProgressChanged) {
String fileName = (String) args[0]; String fileName = (String) args[0];
if (TextUtils.equals(fileName, videoFileName)) { if (TextUtils.equals(fileName, videoFileName)) {
Long loadedSize = (Long) args[1]; Long loadedSize = (Long) args[1];
Long totalSize = (Long) args[2]; Long totalSize = (Long) args[2];
float progress = Math.min(1f, loadedSize / (float) totalSize); float progress = Math.min(1f, loadedSize / (float) totalSize);
avatarView.setProgress(progress); avatarView.setProgress(progress);
} }
} }

View file

@ -227,10 +227,13 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
private int POLL_HINT = -1; private int POLL_HINT = -1;
private int FORWARD = -1; private int FORWARD = -1;
private int TRANSCRIBE = -1; private int TRANSCRIBE = -1;
private int CONTACT = -1; private int CONTACT = -1;
private int CONTACT_VIEW = -1; private int CONTACT_VIEW = -1;
private int CONTACT_ADD = -1; private int CONTACT_ADD = -1;
private int CONTACT_MESSAGE = -1; private int CONTACT_MESSAGE = -1;
private boolean isInitializedNodes;
private boolean touch; //To catch,whether was touch before clear_accessibility_focus action was performed.
private int numberOfNodes =-1;
public boolean clipToGroupBounds; public boolean clipToGroupBounds;
public boolean drawForBlur; public boolean drawForBlur;
@ -4075,9 +4078,9 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
forwardBotPressed = true; forwardBotPressed = true;
result = true; result = true;
} else if ( } else if (
drawSideButton != 0 && drawSideButton != 0 &&
x >= sideStartX - dp(24) && x <= sideStartX + dp(40) && x >= sideStartX - dp(24) && x <= sideStartX + dp(40) &&
y >= sideStartY - dp(24) && y <= sideStartY + dp(38 + (drawSideButton == 3 && commentLayout != null ? 18 : 0) + (drawSideButton2 == SIDE_BUTTON_SPONSORED_MORE ? 38 : 0))) { y >= sideStartY - dp(24) && y <= sideStartY + dp(38 + (drawSideButton == 3 && commentLayout != null ? 18 : 0) + (drawSideButton2 == SIDE_BUTTON_SPONSORED_MORE ? 38 : 0))) {
if (currentMessageObject.isSent()) { if (currentMessageObject.isSent()) {
if (currentMessageObject.isSponsored()) { if (currentMessageObject.isSponsored()) {
if (y > sideStartY + dp(32) && drawSideButton2 == SIDE_BUTTON_SPONSORED_MORE) { if (y > sideStartY + dp(32) && drawSideButton2 == SIDE_BUTTON_SPONSORED_MORE) {
@ -4325,8 +4328,8 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
pressedSideButton = 0; pressedSideButton = 0;
} else if (event.getAction() == MotionEvent.ACTION_MOVE) { } else if (event.getAction() == MotionEvent.ACTION_MOVE) {
if (!( if (!(
x >= sideStartX - dp(24) && x <= sideStartX + dp(40) && x >= sideStartX - dp(24) && x <= sideStartX + dp(40) &&
y >= sideStartY - dp(24) && y <= sideStartY + dp(38 + (drawSideButton == 3 && commentLayout != null ? 18 : 0) + (drawSideButton2 == SIDE_BUTTON_SPONSORED_MORE ? 38 : 0)) y >= sideStartY - dp(24) && y <= sideStartY + dp(38 + (drawSideButton == 3 && commentLayout != null ? 18 : 0) + (drawSideButton2 == SIDE_BUTTON_SPONSORED_MORE ? 38 : 0))
)) { )) {
sideButtonPressed = false; sideButtonPressed = false;
pressedSideButton = 0; pressedSideButton = 0;
@ -4685,15 +4688,15 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
public float visibleParentOffset; public float visibleParentOffset;
public float visibleTop; public float visibleTop;
public void setVisiblePart( public void setVisiblePart(
int position, int position,
int height, int height,
int parent, int parent,
float parentOffset, float parentOffset,
float visibleTop, float visibleTop,
int parentW, int parentW,
int parentH, int parentH,
int blurredViewTopOffset, int blurredViewTopOffset,
int blurredViewBottomOffset int blurredViewBottomOffset
) { ) {
this.childPosition = position; this.childPosition = position;
this.visibleHeight = height; this.visibleHeight = height;
@ -5464,7 +5467,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
FORWARD = -1; FORWARD = -1;
TRANSCRIBE = -1; TRANSCRIBE = -1;
CONTACT = -1; CONTACT = -1;
CONTACT_VIEW = -1; CONTACT_VIEW = -1;
CONTACT_ADD = -1; CONTACT_ADD = -1;
CONTACT_MESSAGE = -1; CONTACT_MESSAGE = -1;
if (drawCommentButton || useTranscribeButton || drawSideButton == 3 && !((hasDiscussion && messageObject.isLinkedToChat(linkedChatId) || isRepliesChat) && (currentPosition == null || currentPosition.siblingHeights == null && (currentPosition.flags & MessageObject.POSITION_FLAG_BOTTOM) != 0 || currentPosition.siblingHeights != null && (currentPosition.flags & MessageObject.POSITION_FLAG_TOP) == 0))) { if (drawCommentButton || useTranscribeButton || drawSideButton == 3 && !((hasDiscussion && messageObject.isLinkedToChat(linkedChatId) || isRepliesChat) && (currentPosition == null || currentPosition.siblingHeights == null && (currentPosition.flags & MessageObject.POSITION_FLAG_BOTTOM) != 0 || currentPosition.siblingHeights != null && (currentPosition.flags & MessageObject.POSITION_FLAG_TOP) == 0))) {
@ -5518,7 +5521,7 @@ CONTACT_VIEW = -1;
} }
} }
if (chosenAnswer != null) { if (chosenAnswer != null) {
sendAccessibilityEventForVirtualView(MessageAccessibilityNodeProvider.POLL_BUTTONS_START + a, AccessibilityEvent.TYPE_VIEW_SELECTED, chosenAnswer.correct ? getString("AccDescrQuizCorrectAnswer", R.string.AccDescrQuizCorrectAnswer) : getString("AccDescrQuizIncorrectAnswer", R.string.AccDescrQuizIncorrectAnswer)); sendAccessibilityEventForVirtualView(POLL_BUTTONS_START + a, AccessibilityEvent.TYPE_VIEW_SELECTED, chosenAnswer.correct ? getString("AccDescrQuizCorrectAnswer", R.string.AccDescrQuizCorrectAnswer) : getString("AccDescrQuizIncorrectAnswer", R.string.AccDescrQuizIncorrectAnswer));
} }
} }
} }
@ -9401,14 +9404,22 @@ CONTACT_VIEW = -1;
keyboardHeight = 0; keyboardHeight = 0;
} }
//if (expiredStoryView == null || !expiredStoryView.visible) { //if (expiredStoryView == null || !expiredStoryView.visible) {
if (drawCommentButton) { if (drawCommentButton) {
totalHeight += AndroidUtilities.dp(shouldDrawTimeOnMedia() ? 41.3f : 43); totalHeight += AndroidUtilities.dp(shouldDrawTimeOnMedia() ? 41.3f : 43);
createSelectorDrawable(1); createSelectorDrawable(1);
} }
if (hasFactCheck && currentPosition != null) { if (hasFactCheck && currentPosition != null) {
totalHeight += dp(2 + (reactionsLayoutInBubble.isEmpty ? 18 : 0)) + factCheckHeight; totalHeight += dp(2 + (reactionsLayoutInBubble.isEmpty ? 18 : 0)) + factCheckHeight;
} }
if (drawPinnedBottom && drawPinnedTop) { if (drawPinnedBottom && drawPinnedTop) {
totalHeight -= AndroidUtilities.dp(2);
} else if (drawPinnedBottom) {
totalHeight -= AndroidUtilities.dp(1);
} else if (drawPinnedTop && pinnedBottom && currentPosition != null && currentPosition.siblingHeights == null) {
totalHeight -= AndroidUtilities.dp(1);
}
if (!mediaBackground) {
if (messageObject.type == MessageObject.TYPE_TEXT) {
totalHeight -= AndroidUtilities.dp(2); totalHeight -= AndroidUtilities.dp(2);
} }
if (drawPinnedBottom) { if (drawPinnedBottom) {
@ -9418,6 +9429,7 @@ CONTACT_VIEW = -1;
totalHeight -= AndroidUtilities.dp(1); totalHeight -= AndroidUtilities.dp(1);
} }
} }
if (messageObject.type != MessageObject.TYPE_EMOJIS) { if (messageObject.type != MessageObject.TYPE_EMOJIS) {
if (messageObject.isAnyKindOfSticker() && totalHeight < AndroidUtilities.dp(70)) { if (messageObject.isAnyKindOfSticker() && totalHeight < AndroidUtilities.dp(70)) {
additionalTimeOffsetY = AndroidUtilities.dp(70) - totalHeight; additionalTimeOffsetY = AndroidUtilities.dp(70) - totalHeight;
@ -10134,33 +10146,33 @@ CONTACT_VIEW = -1;
seekBarWaveform.setWaveform(waveform); seekBarWaveform.setWaveform(waveform);
} }
useTranscribeButton = ( useTranscribeButton = (
currentMessageObject != null && currentMessageObject != null &&
!currentMessageObject.isQuickReply() && !currentMessageObject.isQuickReply() &&
!currentMessageObject.isRepostPreview && !currentMessageObject.isRepostPreview &&
(!currentMessageObject.isOutOwner() || currentMessageObject.isSent()) && (!currentMessageObject.isOutOwner() || currentMessageObject.isSent()) &&
( (
UserConfig.getInstance(currentAccount).isPremium() UserConfig.getInstance(currentAccount).isPremium()
|| ||
MessagesController.getInstance(currentAccount).transcribeAudioTrialWeeklyNumber > 0 && MessagesController.getInstance(currentAccount).transcribeAudioTrialWeeklyNumber > 0 &&
currentMessageObject.getDuration() <= MessagesController.getInstance(currentAccount).transcribeAudioTrialDurationMax && ( currentMessageObject.getDuration() <= MessagesController.getInstance(currentAccount).transcribeAudioTrialDurationMax && (
currentMessageObject.messageOwner != null && ( currentMessageObject.messageOwner != null && (
!TextUtils.isEmpty(currentMessageObject.messageOwner.voiceTranscription) || !TextUtils.isEmpty(currentMessageObject.messageOwner.voiceTranscription) ||
currentMessageObject.messageOwner.voiceTranscriptionFinal currentMessageObject.messageOwner.voiceTranscriptionFinal
) || ) ||
TranscribeButton.canTranscribeTrial(currentMessageObject) || true TranscribeButton.canTranscribeTrial(currentMessageObject) || true
) )
|| ||
MessagesController.getInstance(currentAccount).transcribeAudioTrialWeeklyNumber <= 0 && MessagesController.getInstance(currentAccount).transcribeAudioTrialWeeklyNumber <= 0 &&
!MessagesController.getInstance(currentAccount).premiumFeaturesBlocked() && !MessagesController.getInstance(currentAccount).premiumFeaturesBlocked() &&
!MessagesController.getInstance(currentAccount).didPressTranscribeButtonEnough() && !currentMessageObject.isOutOwner() && ( !MessagesController.getInstance(currentAccount).didPressTranscribeButtonEnough() && !currentMessageObject.isOutOwner() && (
currentMessageObject.messageOwner != null && currentMessageObject.messageOwner.voiceTranscriptionForce || currentMessageObject.messageOwner != null && currentMessageObject.messageOwner.voiceTranscriptionForce ||
currentMessageObject.getDuration() >= 60 currentMessageObject.getDuration() >= 60
) )
) && ( ) && (
currentMessageObject.isVoice() && useSeekBarWaveform || currentMessageObject.isVoice() && useSeekBarWaveform ||
currentMessageObject.isRoundVideo() currentMessageObject.isRoundVideo()
) && currentMessageObject.messageOwner != null && !(MessageObject.getMedia(currentMessageObject.messageOwner) instanceof TLRPC.TL_messageMediaWebPage) && ) && currentMessageObject.messageOwner != null && !(MessageObject.getMedia(currentMessageObject.messageOwner) instanceof TLRPC.TL_messageMediaWebPage) &&
(currentMessageObject.messageOwner.media == null || currentMessageObject.messageOwner.media.ttl_seconds == 0) (currentMessageObject.messageOwner.media == null || currentMessageObject.messageOwner.media.ttl_seconds == 0)
); );
updateSeekBarWaveformWidth(null); updateSeekBarWaveformWidth(null);
} }
@ -12363,8 +12375,8 @@ CONTACT_VIEW = -1;
public void startRevealMedia() { public void startRevealMedia() {
startRevealMedia( startRevealMedia(
photoImage.getImageX() + photoImage.getImageWidth() / 2f, photoImage.getImageX() + photoImage.getImageWidth() / 2f,
photoImage.getImageY() + photoImage.getImageHeight() / 2f photoImage.getImageY() + photoImage.getImageHeight() / 2f
); );
} }
@ -13474,10 +13486,10 @@ CONTACT_VIEW = -1;
canvas.save(); canvas.save();
final int sz = dp(16); final int sz = dp(16);
factCheckArrow.setBounds( factCheckArrow.setBounds(
width - sz - dp(4 + 3), width - sz - dp(4 + 3),
height - sz - dp(2 + 3), height - sz - dp(2 + 3),
width - dp(4 + 3), width - dp(4 + 3),
height - dp(2 + 3) height - dp(2 + 3)
); );
canvas.rotate(AndroidUtilities.lerp(0, 180, expanded), factCheckArrow.getBounds().centerX(), factCheckArrow.getBounds().centerY()); canvas.rotate(AndroidUtilities.lerp(0, 180, expanded), factCheckArrow.getBounds().centerX(), factCheckArrow.getBounds().centerY());
factCheckArrow.setAlpha((int) (0xFF * alpha)); factCheckArrow.setAlpha((int) (0xFF * alpha));
@ -14079,9 +14091,9 @@ CONTACT_VIEW = -1;
blockSpoilersColor = quoteLine.getColor(); blockSpoilersColor = quoteLine.getColor();
Theme.chat_msgGameTextPaint.linkColor = Theme.chat_msgGameTextPaint.linkColor =
Theme.chat_replyTextPaint.linkColor = Theme.chat_replyTextPaint.linkColor =
Theme.chat_quoteTextPaint.linkColor = Theme.chat_quoteTextPaint.linkColor =
Theme.chat_msgTextPaint.linkColor = currentMessageObject.isOutOwner() ? Theme.getColor(Theme.key_chat_messageLinkOut, resourcesProvider) : quoteLine.getColor(); Theme.chat_msgTextPaint.linkColor = currentMessageObject.isOutOwner() ? Theme.getColor(Theme.key_chat_messageLinkOut, resourcesProvider) : quoteLine.getColor();
if (block.quoteCollapse && block.height > block.collapsedHeight) { if (block.quoteCollapse && block.height > block.collapsedHeight) {
collapsed = block.collapsed(transitionParams); collapsed = block.collapsed(transitionParams);
@ -14097,10 +14109,10 @@ CONTACT_VIEW = -1;
canvas.save(); canvas.save();
final int sz = dp(16); final int sz = dp(16);
quoteArrow.setBounds( quoteArrow.setBounds(
width - sz - dp(4 + 3), width - sz - dp(4 + 3),
block.height(transitionParams) - sz - dp(2), block.height(transitionParams) - sz - dp(2),
width - dp(4 + 3), width - dp(4 + 3),
block.height(transitionParams) - dp(2) block.height(transitionParams) - dp(2)
); );
canvas.rotate(AndroidUtilities.lerp(180, 0, collapsed), quoteArrow.getBounds().centerX(), quoteArrow.getBounds().centerY()); canvas.rotate(AndroidUtilities.lerp(180, 0, collapsed), quoteArrow.getBounds().centerX(), quoteArrow.getBounds().centerY());
quoteArrow.setAlpha((int) (0xFF * alpha)); quoteArrow.setAlpha((int) (0xFF * alpha));
@ -14242,9 +14254,9 @@ CONTACT_VIEW = -1;
captionX = backgroundDrawableLeft + AndroidUtilities.dp(currentMessageObject.isOutOwner() ? 11 : 17) + captionOffsetX; captionX = backgroundDrawableLeft + AndroidUtilities.dp(currentMessageObject.isOutOwner() ? 11 : 17) + captionOffsetX;
captionYBelow = totalHeight - captionHeight - AndroidUtilities.dp(drawPinnedTop ? 9 : 10) - linkPreviewHeight - AndroidUtilities.dp(17) - dp(drawCommentButton && drawSideButton != 3 ? (shouldDrawTimeOnMedia() ? 41.3f : 43) : 0); captionYBelow = totalHeight - captionHeight - AndroidUtilities.dp(drawPinnedTop ? 9 : 10) - linkPreviewHeight - AndroidUtilities.dp(17) - dp(drawCommentButton && drawSideButton != 3 ? (shouldDrawTimeOnMedia() ? 41.3f : 43) : 0);
captionY = AndroidUtilities.lerp( captionY = AndroidUtilities.lerp(
captionYBelow, captionYBelow,
dp(9), dp(9),
mediaAbove() mediaAbove()
); );
asBottom = true; asBottom = true;
} else { } else {
@ -14255,9 +14267,9 @@ CONTACT_VIEW = -1;
} }
captionYBelow = totalHeight - captionHeight - AndroidUtilities.dp(drawPinnedTop ? 9 : 10) - dp(drawCommentButton && drawSideButton != 3 ? (shouldDrawTimeOnMedia() ? 41.3f : 43) : 0) - (!reactionsLayoutInBubble.isEmpty && !reactionsLayoutInBubble.isSmall ? reactionsLayoutInBubble.totalHeight : 0); captionYBelow = totalHeight - captionHeight - AndroidUtilities.dp(drawPinnedTop ? 9 : 10) - dp(drawCommentButton && drawSideButton != 3 ? (shouldDrawTimeOnMedia() ? 41.3f : 43) : 0) - (!reactionsLayoutInBubble.isEmpty && !reactionsLayoutInBubble.isSmall ? reactionsLayoutInBubble.totalHeight : 0);
captionY = AndroidUtilities.lerp( captionY = AndroidUtilities.lerp(
captionYBelow, captionYBelow,
dp(9), dp(9),
mediaAbove() mediaAbove()
); );
asBottom = true; asBottom = true;
} }
@ -17624,10 +17636,10 @@ CONTACT_VIEW = -1;
} else if (currentMessageObject.isOutOwner()) { } else if (currentMessageObject.isOutOwner()) {
color = getThemedColor(Theme.key_chat_outForwardedNameText); color = getThemedColor(Theme.key_chat_outForwardedNameText);
} else if ( } else if (
currentMessageObject.overrideLinkColor >= 0 || currentMessageObject.overrideLinkColor >= 0 ||
currentMessageObject.isFromUser() && currentUser != null || currentMessageObject.isFromUser() && currentUser != null ||
currentMessageObject.isFromChannel() && currentChat != null || currentMessageObject.isFromChannel() && currentChat != null ||
currentMessageObject.sponsoredColor != null && currentMessageObject.sponsoredColor.color != -1 currentMessageObject.sponsoredColor != null && currentMessageObject.sponsoredColor.color != -1
) { ) {
int colorId; int colorId;
if (currentMessageObject.overrideLinkColor >= 0) { if (currentMessageObject.overrideLinkColor >= 0) {
@ -18273,9 +18285,9 @@ CONTACT_VIEW = -1;
} else if (currentMessageObject.isOutOwner()) { } else if (currentMessageObject.isOutOwner()) {
Theme.chat_namePaint.setColor(getThemedColor(Theme.key_chat_outForwardedNameText)); Theme.chat_namePaint.setColor(getThemedColor(Theme.key_chat_outForwardedNameText));
} else if ( } else if (
currentMessageObject.overrideLinkColor >= 0 || currentMessageObject.overrideLinkColor >= 0 ||
currentMessageObject.isFromUser() && currentUser != null || currentMessageObject.isFromUser() && currentUser != null ||
currentMessageObject.isFromChannel() && currentChat != null currentMessageObject.isFromChannel() && currentChat != null
) { ) {
int colorId; int colorId;
if (currentMessageObject.overrideLinkColor >= 0) { if (currentMessageObject.overrideLinkColor >= 0) {
@ -18332,10 +18344,10 @@ CONTACT_VIEW = -1;
Theme.setSelectorDrawableColor(nameLayoutSelector, nameLayoutSelectorColor = selectorColor, true); Theme.setSelectorDrawableColor(nameLayoutSelector, nameLayoutSelectorColor = selectorColor, true);
} }
nameLayoutSelector.setBounds( nameLayoutSelector.setBounds(
(int) (nx + nameOffsetX - dp(4)), (int) (nx + nameOffsetX - dp(4)),
(int) (nameY - dp(1.33f)), (int) (nameY - dp(1.33f)),
(int) (nx + nameOffsetX + (viaNameWidth > 0 ? viaNameWidth - dp(4 + 28) : nameLayoutWidth) + dp(4)), (int) (nx + nameOffsetX + (viaNameWidth > 0 ? viaNameWidth - dp(4 + 28) : nameLayoutWidth) + dp(4)),
(int) (nameY + nameLayout.getHeight() + dp(1.33f)) (int) (nameY + nameLayout.getHeight() + dp(1.33f))
); );
nameLayoutSelector.setAlpha((int) (0xFF * nameAlpha)); nameLayoutSelector.setAlpha((int) (0xFF * nameAlpha));
nameLayoutSelector.draw(canvas); nameLayoutSelector.draw(canvas);
@ -18352,10 +18364,10 @@ CONTACT_VIEW = -1;
float starVerticalOffset = isStarDrawable ? 1.5f : 0f; float starVerticalOffset = isStarDrawable ? 1.5f : 0f;
float starHorizontalOffset = isStarDrawable ? -5 : 0; float starHorizontalOffset = isStarDrawable ? -5 : 0;
nameStatusSelector.setBounds( nameStatusSelector.setBounds(
(int) (nx + nameOffsetX + (viaNameWidth > 0 ? viaNameWidth - dp(4 + 28) : nameLayoutWidth)), (int) (nx + nameOffsetX + (viaNameWidth > 0 ? viaNameWidth - dp(4 + 28) : nameLayoutWidth)),
(int) (nameY - dp(1.33f + 2 - starVerticalOffset)), (int) (nameY - dp(1.33f + 2 - starVerticalOffset)),
(int) (nx + nameOffsetX + (viaNameWidth > 0 ? viaNameWidth - dp(4 + 28) : nameLayoutWidth) + dp(4 + 12 + 4 + 4 + starHorizontalOffset)), (int) (nx + nameOffsetX + (viaNameWidth > 0 ? viaNameWidth - dp(4 + 28) : nameLayoutWidth) + dp(4 + 12 + 4 + 4 + starHorizontalOffset)),
(int) (nameY + nameLayout.getHeight() + dp(1.33f + 2 - starVerticalOffset)) (int) (nameY + nameLayout.getHeight() + dp(1.33f + 2 - starVerticalOffset))
); );
nameStatusSelector.setAlpha((int) (0xFF * nameAlpha)); nameStatusSelector.setAlpha((int) (0xFF * nameAlpha));
nameStatusSelector.draw(canvas); nameStatusSelector.draw(canvas);
@ -19271,10 +19283,11 @@ CONTACT_VIEW = -1;
buttonX -= AndroidUtilities.dp(10); buttonX -= AndroidUtilities.dp(10);
} }
commentButtonRect.set( commentButtonRect.set(
buttonX - AndroidUtilities.dp((currentMessageObject == null || !currentMessageObject.isOut()) && !drawPinnedBottom && currentPosition == null && (currentMessageObject == null || currentMessageObject.type != MessageObject.TYPE_POLL || pollInstantViewTouchesBottom) ? 6 : 0), buttonX - AndroidUtilities.dp((currentMessageObject == null || !currentMessageObject.isOut()) && !drawPinnedBottom && currentPosition == null && (currentMessageObject == null || currentMessageObject.type != MessageObject.TYPE_POLL || pollInstantViewTouchesBottom) ? 6 : 0),
(int) buttonY, (int) buttonY,
endX - AndroidUtilities.dp(14), endX - AndroidUtilities.dp(14),
layoutHeight - AndroidUtilities.dp(h) + 1 layoutHeight - AndroidUtilities.dp(h) + 1
);
if (selectorDrawable[1] != null && selectorDrawableMaskType[1] == 2) { if (selectorDrawable[1] != null && selectorDrawableMaskType[1] == 2) {
int count = canvas.getSaveCount(); int count = canvas.getSaveCount();
selectorDrawable[1].setBounds(commentButtonRect); selectorDrawable[1].setBounds(commentButtonRect);
@ -19595,11 +19608,11 @@ CONTACT_VIEW = -1;
if (transitionParams.animateMediaAbove && transitionParams.animateChangeProgress != 1f) { if (transitionParams.animateMediaAbove && transitionParams.animateChangeProgress != 1f) {
final float captionYTop, captionYBottom; final float captionYTop, captionYBottom;
if ( if (
currentMessageObject.type == MessageObject.TYPE_PHOTO || currentMessageObject.type == MessageObject.TYPE_PHOTO ||
currentMessageObject.type == MessageObject.TYPE_EXTENDED_MEDIA_PREVIEW || currentMessageObject.type == MessageObject.TYPE_EXTENDED_MEDIA_PREVIEW ||
documentAttachType == DOCUMENT_ATTACH_TYPE_VIDEO || documentAttachType == DOCUMENT_ATTACH_TYPE_VIDEO ||
currentMessageObject.type == MessageObject.TYPE_GIF || currentMessageObject.type == MessageObject.TYPE_GIF ||
currentMessageObject.type == MessageObject.TYPE_STORY currentMessageObject.type == MessageObject.TYPE_STORY
) { ) {
float y, h; float y, h;
y = photoImage.getImageY(); y = photoImage.getImageY();
@ -21071,10 +21084,10 @@ CONTACT_VIEW = -1;
foreverDrawable.setColorFilter(new PorterDuffColorFilter(foreverDrawableColor = Theme.chat_livePaint.getColor(), PorterDuff.Mode.SRC_IN)); foreverDrawable.setColorFilter(new PorterDuffColorFilter(foreverDrawableColor = Theme.chat_livePaint.getColor(), PorterDuff.Mode.SRC_IN));
} }
foreverDrawable.setBounds( foreverDrawable.setBounds(
(int) rect.centerX() - foreverDrawable.getIntrinsicWidth() / 2, (int) rect.centerX() - foreverDrawable.getIntrinsicWidth() / 2,
(int) rect.centerY() - foreverDrawable.getIntrinsicHeight() / 2, (int) rect.centerY() - foreverDrawable.getIntrinsicHeight() / 2,
(int) rect.centerX() + foreverDrawable.getIntrinsicWidth() / 2, (int) rect.centerX() + foreverDrawable.getIntrinsicWidth() / 2,
(int) rect.centerY() + foreverDrawable.getIntrinsicHeight() / 2 (int) rect.centerY() + foreverDrawable.getIntrinsicHeight() / 2
); );
foreverDrawable.draw(canvas); foreverDrawable.draw(canvas);
} else { } else {
@ -21537,10 +21550,10 @@ CONTACT_VIEW = -1;
boolean on = false; boolean on = false;
if (currentMessageObject != null && currentMessageObject.isRoundVideo() && (!currentMessageObject.mediaExists || currentMessageObject.isRoundOnce())) { if (currentMessageObject != null && currentMessageObject.isRoundVideo() && (!currentMessageObject.mediaExists || currentMessageObject.isRoundOnce())) {
radialProgress.setProgressRect( radialProgress.setProgressRect(
photoImage.getImageX() + (photoImage.getImageWidth() / 2f - radialProgress.getRadius()), photoImage.getImageX() + (photoImage.getImageWidth() / 2f - radialProgress.getRadius()),
photoImage.getImageY() + (photoImage.getImageHeight() / 2f - radialProgress.getRadius()), photoImage.getImageY() + (photoImage.getImageHeight() / 2f - radialProgress.getRadius()),
photoImage.getImageX() + (photoImage.getImageWidth() / 2f + radialProgress.getRadius()), photoImage.getImageX() + (photoImage.getImageWidth() / 2f + radialProgress.getRadius()),
photoImage.getImageY() + (photoImage.getImageHeight() / 2f + radialProgress.getRadius()) photoImage.getImageY() + (photoImage.getImageHeight() / 2f + radialProgress.getRadius())
); );
} else if (currentMessageObject != null && currentMessageObject.isRoundVideo()) { } else if (currentMessageObject != null && currentMessageObject.isRoundVideo()) {
radialProgress.setProgressRect( radialProgress.setProgressRect(
@ -21555,9 +21568,9 @@ CONTACT_VIEW = -1;
restore = true; restore = true;
} }
if ( if (
(!isRoundVideo || !hasLinkPreview) && (!isRoundVideo || !hasLinkPreview) &&
(!currentMessageObject.needDrawBluredPreview() || !MediaController.getInstance().isPlayingMessage(currentMessageObject)) && (!currentMessageObject.needDrawBluredPreview() || !MediaController.getInstance().isPlayingMessage(currentMessageObject)) &&
!(currentMessageObject.hasMediaSpoilers() && (!currentMessageObject.isMediaSpoilersRevealed || !currentMessageObject.revealingMediaSpoilers) && SharedConfig.isAutoplayVideo() && !currentMessageObject.isRepostPreview && currentMessagesGroup == null && (radialProgress.getIcon() == MediaActionDrawable.ICON_PLAY || radialProgress.getIcon() == MediaActionDrawable.ICON_NONE)) !(currentMessageObject.hasMediaSpoilers() && (!currentMessageObject.isMediaSpoilersRevealed || !currentMessageObject.revealingMediaSpoilers) && SharedConfig.isAutoplayVideo() && !currentMessageObject.isRepostPreview && currentMessagesGroup == null && (radialProgress.getIcon() == MediaActionDrawable.ICON_PLAY || radialProgress.getIcon() == MediaActionDrawable.ICON_NONE))
) { ) {
if (currentMessageObject.needDrawBluredPreview()) { if (currentMessageObject.needDrawBluredPreview()) {
radialProgress.overrideCircleAlpha = 0f; radialProgress.overrideCircleAlpha = 0f;
@ -22106,7 +22119,7 @@ CONTACT_VIEW = -1;
} }
if (lastPoll != null) { if (lastPoll != null) {
sb.append(", "); sb.append(", ");
sb.append(lastPoll.question); sb.append(lastPoll.question.text);
sb.append(", "); sb.append(", ");
String title; String title;
if (pollClosed) { if (pollClosed) {
@ -22544,22 +22557,6 @@ CONTACT_VIEW = -1;
private Path linkPath = new Path(); private Path linkPath = new Path();
private RectF rectF = new RectF(); private RectF rectF = new RectF();
private Rect rect = new Rect(); private Rect rect = new Rect();
private class ProfileSpan extends ClickableSpan {
private TLRPC.User user;
public ProfileSpan(TLRPC.User user) {
this.user = user;
}
@Override
public void onClick(@NonNull View view) {
if (delegate != null) {
delegate.didPressUserAvatar(ChatMessageCell.this, user, 0, 0);
}
}
}
@Override @Override
public AccessibilityNodeInfo createAccessibilityNodeInfo(int virtualViewId) { public AccessibilityNodeInfo createAccessibilityNodeInfo(int virtualViewId) {
int[] pos = {0, 0}; int[] pos = {0, 0};
@ -22569,197 +22566,193 @@ CONTACT_VIEW = -1;
onInitializeAccessibilityNodeInfo(info); onInitializeAccessibilityNodeInfo(info);
setAccessibilityTextIfNeeded(); setAccessibilityTextIfNeeded();
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) {
info.setContentDescription(accessibilityText.toString()); info.setContentDescription(accessibilityText.toString());
} else { } else {
info.setText(accessibilityText); info.setText(accessibilityText);
}
info.setEnabled(true);
if (Build.VERSION.SDK_INT >= 19) {
AccessibilityNodeInfo.CollectionItemInfo itemInfo = info.getCollectionItemInfo();
if (itemInfo != null) {
info.setCollectionItemInfo(AccessibilityNodeInfo.CollectionItemInfo.obtain(itemInfo.getRowIndex(), 1, 0, 1, false));
} }
info.setEnabled(true); }
if (Build.VERSION.SDK_INT >= 19) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
AccessibilityNodeInfo.CollectionItemInfo itemInfo = info.getCollectionItemInfo(); info.addAction(new AccessibilityNodeInfo.AccessibilityAction(R.id.acc_action_msg_options, LocaleController.getString("AccActionMessageOptions", R.string.AccActionMessageOptions)));
if (itemInfo != null) { int icon = getIconForCurrentState();
info.setCollectionItemInfo(AccessibilityNodeInfo.CollectionItemInfo.obtain(itemInfo.getRowIndex(), 1, 0, 1, false)); CharSequence actionLabel = null;
} switch (icon) {
case MediaActionDrawable.ICON_PLAY:
actionLabel = LocaleController.getString("AccActionPlay", R.string.AccActionPlay);
break;
case MediaActionDrawable.ICON_PAUSE:
actionLabel = LocaleController.getString("AccActionPause", R.string.AccActionPause);
break;
case MediaActionDrawable.ICON_FILE:
actionLabel = LocaleController.getString("AccActionOpenFile", R.string.AccActionOpenFile);
break;
case MediaActionDrawable.ICON_DOWNLOAD:
actionLabel = LocaleController.getString("AccActionDownload", R.string.AccActionDownload);
break;
case MediaActionDrawable.ICON_CANCEL:
actionLabel = LocaleController.getString("AccActionCancelDownload", R.string.AccActionCancelDownload);
break;
default:
if (currentMessageObject.type == MessageObject.TYPE_PHONE_CALL) {
actionLabel = LocaleController.getString("CallAgain", R.string.CallAgain);
}
} }
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { info.addAction(new AccessibilityNodeInfo.AccessibilityAction(AccessibilityNodeInfo.ACTION_CLICK, actionLabel));
info.addAction(new AccessibilityNodeInfo.AccessibilityAction(R.id.acc_action_msg_options, LocaleController.getString("AccActionMessageOptions", R.string.AccActionMessageOptions))); info.addAction(new AccessibilityNodeInfo.AccessibilityAction(AccessibilityNodeInfo.ACTION_LONG_CLICK, LocaleController.getString("AccActionEnterSelectionMode", R.string.AccActionEnterSelectionMode)));
int icon = getIconForCurrentState(); int smallIcon = getMiniIconForCurrentState();
CharSequence actionLabel = null; if (smallIcon == MediaActionDrawable.ICON_DOWNLOAD) {
switch (icon) { info.addAction(new AccessibilityNodeInfo.AccessibilityAction(R.id.acc_action_small_button, LocaleController.getString("AccActionDownload", R.string.AccActionDownload)));
case MediaActionDrawable.ICON_PLAY:
actionLabel = LocaleController.getString("AccActionPlay", R.string.AccActionPlay);
break;
case MediaActionDrawable.ICON_PAUSE:
actionLabel = LocaleController.getString("AccActionPause", R.string.AccActionPause);
break;
case MediaActionDrawable.ICON_FILE:
actionLabel = LocaleController.getString("AccActionOpenFile", R.string.AccActionOpenFile);
break;
case MediaActionDrawable.ICON_DOWNLOAD:
actionLabel = LocaleController.getString("AccActionDownload", R.string.AccActionDownload);
break;
case MediaActionDrawable.ICON_CANCEL:
actionLabel = LocaleController.getString("AccActionCancelDownload", R.string.AccActionCancelDownload);
break;
default:
if ((currentMessageObject.type == MessageObject.TYPE_PHONE_CALL) {
actionLabel = LocaleController.getString("CallAgain", R.string.CallAgain);
}
}
info.addAction(new AccessibilityNodeInfo.AccessibilityAction(AccessibilityNodeInfo.ACTION_CLICK, actionLabel));
info.addAction(new AccessibilityNodeInfo.AccessibilityAction(AccessibilityNodeInfo.ACTION_LONG_CLICK, LocaleController.getString("AccActionEnterSelectionMode", R.string.AccActionEnterSelectionMode)));
int smallIcon = getMiniIconForCurrentState();
if (smallIcon == MediaActionDrawable.ICON_DOWNLOAD) {
info.addAction(new AccessibilityNodeInfo.AccessibilityAction(R.id.acc_action_small_button, LocaleController.getString("AccActionDownload", R.string.AccActionDownload)));
}
} else {
info.addAction(AccessibilityNodeInfo.ACTION_CLICK);
info.addAction(AccessibilityNodeInfo.ACTION_LONG_CLICK);
} }
if (isSeekbarCell()) { } else {
seekBarAccessibilityDelegate.onInitializeAccessibilityNodeInfoInternal(info); info.addAction(AccessibilityNodeInfo.ACTION_CLICK);
} info.addAction(AccessibilityNodeInfo.ACTION_LONG_CLICK);
if (useTranscribeButton && transcribeButton != null) { }
if (!isInitializedNodes) { if (isSeekbarCell()) {
TRANSCRIBE = ++numberOfNodes; seekBarAccessibilityDelegate.onInitializeAccessibilityNodeInfoInternal(info);
} }
info.addChild(ChatMessageCell.this, TRANSCRIBE); if (useTranscribeButton && transcribeButton != null) {
if (!isInitializedNodes) {
TRANSCRIBE = ++numberOfNodes;
} }
info.addChild(ChatMessageCell.this, TRANSCRIBE);
}
int i; int i;
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) {
if (canAddOrUseProfileNode()) { if (canAddOrUseProfileNode()) {
if (!isInitializedNodes) {
PROFILE = ++numberOfNodes;
}
info.addChild(ChatMessageCell.this, PROFILE);
}
if (currentMessageObject.messageText instanceof Spannable) {
Spannable buffer = (Spannable) currentMessageObject.messageText;
CharacterStyle[] links = buffer.getSpans(0, buffer.length(), ClickableSpan.class);
if (!isInitializedNodes && links.length > 0) {
LINK_IDS_START = ++numberOfNodes;
numberOfNodes += links.length;
}
i = 0;
for (CharacterStyle link : links) {
info.addChild(ChatMessageCell.this, LINK_IDS_START + i);
i++;
}
if (currentMessageObject.caption instanceof Spannable && captionLayout != null) {
Spannable buffer = (Spannable) currentMessageObject.caption;
CharacterStyle[] links = buffer.getSpans(0, buffer.length(), ClickableSpan.class);
if (!isInitializedNodes && links.length > 0) {
LINK_CAPTION_IDS_START = ++numberOfNodes;
numberOfNodes += links.length;
}
i = 0;
for (CharacterStyle link : links) {
info.addChild(ChatMessageCell.this, LINK_CAPTION_IDS_START + i);
i++;
}
}
}
if (!isInitializedNodes && botButtons.size() > 0) {
BOT_BUTTONS_START = ++numberOfNodes;
numberOfNodes += botButtons.size();
}
i = 0;
for (BotButton button : botButtons) {
info.addChild(ChatMessageCell.this, BOT_BUTTONS_START + i);
i++;
}
if (hintButtonVisible && pollHintX != -1 && currentMessageObject.isPoll()) {
if (!isInitializedNodes) { if (!isInitializedNodes) {
POLL_HINT = ++numberOfNodes; PROFILE = ++numberOfNodes;
} }
info.addChild(ChatMessageCell.this, POLL_HINT); info.addChild(ChatMessageCell.this, PROFILE);
} }
if (!isInitializedNodes && pollButtons.size() > 0) { if (currentMessageObject.messageText instanceof Spannable) {
POLL_BUTTONS_START = ++numberOfNodes; Spannable buffer = (Spannable) currentMessageObject.messageText;
numberOfNodes += pollButtons.size(); CharacterStyle[] links = buffer.getSpans(0, buffer.length(), ClickableSpan.class);
} if (!isInitializedNodes && links.length > 0) {
i = 0; LINK_IDS_START = ++numberOfNodes;
for (PollButton button : pollButtons) { numberOfNodes += links.length;
info.addChild(ChatMessageCell.this, POLL_BUTTONS_START + i); }
i++; i = 0;
} for (CharacterStyle link : links) {
if (drawInstantView && !instantButtonRect.isEmpty()) { info.addChild(ChatMessageCell.this, LINK_IDS_START + i);
if (!isInitializedNodes) { i++;
INSTANT_VIEW = ++numberOfNodes;
} }
info.addChild(ChatMessageCell.this, INSTANT_VIEW);
} }
if (currentMessageObject.caption instanceof Spannable && captionLayout != null) {
Spannable buffer = (Spannable) currentMessageObject.caption;
CharacterStyle[] links = buffer.getSpans(0, buffer.length(), ClickableSpan.class);
if (!isInitializedNodes && links.length > 0) {
LINK_CAPTION_IDS_START = ++numberOfNodes;
numberOfNodes += links.length;
}
i = 0;
for (CharacterStyle link : links) {
info.addChild(ChatMessageCell.this, LINK_CAPTION_IDS_START + i);
i++;
}
}
}
if (!isInitializedNodes && botButtons.size() > 0) {
BOT_BUTTONS_START = ++numberOfNodes;
numberOfNodes += botButtons.size();
}
i = 0;
for (BotButton button : botButtons) {
info.addChild(ChatMessageCell.this, BOT_BUTTONS_START + i);
i++;
}
if (hintButtonVisible && pollHintX != -1 && currentMessageObject.isPoll()) {
if (!isInitializedNodes) {
POLL_HINT = ++numberOfNodes;
}
info.addChild(ChatMessageCell.this, POLL_HINT);
}
if (!isInitializedNodes && pollButtons.size() > 0) {
POLL_BUTTONS_START = ++numberOfNodes;
numberOfNodes += pollButtons.size();
}
i = 0;
for (PollButton button : pollButtons) {
info.addChild(ChatMessageCell.this, POLL_BUTTONS_START + i);
i++;
}
if (drawInstantView && !instantButtonRect.isEmpty()) {
if (!isInitializedNodes) {
INSTANT_VIEW = ++numberOfNodes;
}
info.addChild(ChatMessageCell.this, INSTANT_VIEW);
}
if (drawContact && contactRect != null && !contactRect.isEmpty()) { if (drawContact && contactRect != null && !contactRect.isEmpty()) {
if (!isInitializedNodes) { if (!isInitializedNodes) {
contact = ++numberOfNodes; CONTACT = ++numberOfNodes;
} }
info.addChild(ChatMessageCell.this, CONTACT); info.addChild(ChatMessageCell.this, CONTACT);
if (contactButtons != null && contactButtons.size() > 1) { if (contactButtons != null && contactButtons.size() > 1) {
for (InstantViewButton instantViewButton : contactButtons) { for (InstantViewButton instantViewButton : contactButtons) {
if (drawContactView && instantViewButton.type == INSTANT_BUTTON_TYPE_CONTACT_VIEW && !instantViewButton.rect.isEmpty()) { if (drawContactView && instantViewButton.type == INSTANT_BUTTON_TYPE_CONTACT_VIEW && !instantViewButton.rect.isEmpty()) {
if (!isInitializedNodes) { if (!isInitializedNodes) {
CONTACT_VIEW= ++numberOfNodes; CONTACT_VIEW= ++numberOfNodes;
} }
info.addChild(ChatMessageCell.this, CONTACT_VIEW); info.addChild(ChatMessageCell.this, CONTACT_VIEW);
} }
if (drawContactAdd && instantViewButton.type == INSTANT_BUTTON_TYPE_CONTACT_ADD && !instantViewButton.rect.isEmpty()) { if (drawContactAdd && instantViewButton.type == INSTANT_BUTTON_TYPE_CONTACT_ADD && !instantViewButton.rect.isEmpty()) {
if (!isInitializedNodes) { if (!isInitializedNodes) {
CONTACT_ADD= ++numberOfNodes; CONTACT_ADD= ++numberOfNodes;
} }
info.addChild(ChatMessageCell.this, CONTACT_ADD); info.addChild(ChatMessageCell.this, CONTACT_ADD);
} }
if (drawContactSendMessage && instantViewButton.type == INSTANT_BUTTON_TYPE_CONTACT_SEND_MESSAGE && !instantViewButton.rect.isEmpty()) { if (drawContactSendMessage && instantViewButton.type == INSTANT_BUTTON_TYPE_CONTACT_SEND_MESSAGE && !instantViewButton.rect.isEmpty()) {
if (!isInitializedNodes) { if (!isInitializedNodes) {
CONTACT_MESSAGE= ++numberOfNodes; CONTACT_MESSAGE= ++numberOfNodes;
} }
info.addChild(ChatMessageCell.this, CONTACT_MESSAGE); info.addChild(ChatMessageCell.this, CONTACT_MESSAGE);
} }
} }
} }
} }
if (commentLayout != null) { if (commentLayout != null) {
if(!isInitializedNodes) { if (!isInitializedNodes) {
COMMENT = ++numberOfNodes; COMMENT = ++numberOfNodes;
} }
info.addChild(ChatMessageCell.this, COMMENT); info.addChild(ChatMessageCell.this, COMMENT);
} }
if (drawSideButton == 1 || drawSideButton == 2) { if (drawSideButton == 1 || drawSideButton == 2) {
if(!isInitializedNodes) { if (!isInitializedNodes) {
SHARE = ++numberOfNodes; SHARE = ++numberOfNodes;
} }
info.addChild(ChatMessageCell.this, SHARE); info.addChild(ChatMessageCell.this, SHARE);
} }
if (replyNameLayout != null) { if (replyNameLayout != null) {
if(!isInitializedNodes) { if (!isInitializedNodes) {
REPLY = ++numberOfNodes; REPLY = ++numberOfNodes;
} }
info.addChild(ChatMessageCell.this, REPLY); info.addChild(ChatMessageCell.this, REPLY);
} }
if (forwardedNameLayout[0] != null && forwardedNameLayout[1] != null) { if (forwardedNameLayout[0] != null && forwardedNameLayout[1] != null) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
info.addAction(new AccessibilityNodeInfo.AccessibilityAction(R.id.acc_action_open_forwarded_origin, getString("AccActionOpenForwardedOrigin", R.string.AccActionOpenForwardedOrigin))); info.addAction(new AccessibilityNodeInfo.AccessibilityAction(R.id.acc_action_open_forwarded_origin, LocaleController.getString("AccActionOpenForwardedOrigin", R.string.AccActionOpenForwardedOrigin)));
} else { } else {
if(!isInitializedNodes) { if (!isInitializedNodes) {
FORWARD = ++numberOfNodes; FORWARD = ++numberOfNodes;
} }
info.addChild(ChatMessageCell.this, FORWARD); info.addChild(ChatMessageCell.this, FORWARD);
} }
if (commentLayout != null) { }
if (!isInitializedNodes) { if (drawSelectionBackground || getBackground() != null) {
COMMENT = ++numberOfNodes; info.setSelected(true);
} }
info.addChild(ChatMessageCell.this, COMMENT); isInitializedNodes = true;
} if (canAddOrUseProfileNode() && Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP && PROFILE < 0) {
if (drawSelectionBackground || getBackground() != null) { String longPressName = currentUser != null ? UserObject.getUserName(currentUser) + (getDelegate() != null && getDelegate().getAdminRank(currentUser.id, true) != null ? " (" + getDelegate().getAdminRank(currentUser.id, true) + ")" : "") : currentChat.title;
info.setSelected(true); info.addAction(new AccessibilityNodeInfo.AccessibilityAction(R.id.acc_action_user_or_channel, longPressName));
} }
isInitializedNodes = true; info.setAccessibilityFocused(true);
if (canAddOrUseProfileNode() && Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP && PROFILE < 0) { return info;
String longPressName = currentUser != null ? UserObject.getUserName(currentUser) + (getDelegate() != null && getDelegate().getAdminRank(currentUser.id, true) != null ? " (" + getDelegate().getAdminRank(currentUser.id, true) + ")" : "") : currentChat.title;
info.addAction(new AccessibilityNodeInfo.AccessibilityAction(R.id.acc_action_user_or_channel, longPressName));
}
info.setAccessibilityFocused(true);
return info;
} else { } else {
AccessibilityNodeInfo info = AccessibilityNodeInfo.obtain(); AccessibilityNodeInfo info = AccessibilityNodeInfo.obtain();
info.setSource(ChatMessageCell.this, virtualViewId); info.setSource(ChatMessageCell.this, virtualViewId);
@ -22879,7 +22872,7 @@ CONTACT_VIEW = -1;
info.addAction(AccessibilityNodeInfo.ACTION_CLICK); info.addAction(AccessibilityNodeInfo.ACTION_CLICK);
instantButtonRect.round(rect); instantButtonRect.round(rect);
} }
else if (virtualViewId == CONTACT) { else if (virtualViewId == CONTACT) {
info.setClassName("android.widget.Button"); info.setClassName("android.widget.Button");
if (titleLayout != null) { if (titleLayout != null) {
info.setText(titleLayout.getText()); info.setText(titleLayout.getText());
@ -22912,7 +22905,7 @@ else if (virtualViewId == CONTACT) {
} }
} }
} }
else if (virtualViewId == SHARE) { else if (virtualViewId == SHARE) {
info.setClassName("android.widget.ImageButton"); info.setClassName("android.widget.ImageButton");
if (isOpenChatByShare(currentMessageObject)) { if (isOpenChatByShare(currentMessageObject)) {
info.setContentDescription(getString("AccDescrOpenChat", R.string.AccDescrOpenChat)); info.setContentDescription(getString("AccDescrOpenChat", R.string.AccDescrOpenChat));

View file

@ -6115,6 +6115,7 @@ public class LaunchActivity extends BasePermissionsActivity implements INavigati
} catch (Exception e) { } catch (Exception e) {
FileLog.e(e); FileLog.e(e);
} }
clearFragments();
super.onDestroy(); super.onDestroy();
onFinish(); onFinish();
FloatingDebugController.onDestroy(); FloatingDebugController.onDestroy();