@@ -207,6 +207,13 @@ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
207207 captionLayoutWidth = captionLayout .getLineCount () > 0 ? captionLayout .getLineWidth (0 ) : 0 ;
208208 }
209209 captionLayoutEmojis = AnimatedEmojiSpan .update (AnimatedEmojiDrawable .CACHE_TYPE_MESSAGES , this , captionLayoutEmojis , captionLayout );
210+ } else if ((currentMessageObject .isVoice () || currentMessageObject .isRoundVideo ()) && !TextUtils .isEmpty (currentMessageObject .messageOwner .message )) {
211+ CharSequence caption = Emoji .replaceEmoji (currentMessageObject .messageOwner .message .replace ("\n " , " " ).replaceAll (" +" , " " ).trim (), Theme .chat_msgTextPaint .getFontMetricsInt (), false );
212+ caption = TextUtils .ellipsize (caption , captionTextPaint , maxWidth , TextUtils .TruncateAt .END );
213+ captionLayout = new StaticLayout (caption , captionTextPaint , maxWidth + dp (4 ), Layout .Alignment .ALIGN_NORMAL , 1.0f , 0.0f , false );
214+ captionLayoutLeft = captionLayout .getLineCount () > 0 ? captionLayout .getLineLeft (0 ) : 0 ;
215+ captionLayoutWidth = captionLayout .getLineCount () > 0 ? captionLayout .getLineWidth (0 ) : 0 ;
216+ captionLayoutEmojis = AnimatedEmojiSpan .update (AnimatedEmojiDrawable .CACHE_TYPE_MESSAGES , this , captionLayoutEmojis , captionLayout );
210217 }
211218 try {
212219 if (/*viewType == VIEW_TYPE_GLOBAL_SEARCH && */ (currentMessageObject .isVoice () || currentMessageObject .isRoundVideo ())) {
@@ -612,7 +619,11 @@ public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) {
612619 if (currentMessageObject .isMusic ()) {
613620 info .setText (LocaleController .formatString ("AccDescrMusicInfo" , R .string .AccDescrMusicInfo , currentMessageObject .getMusicAuthor (), currentMessageObject .getMusicTitle ()));
614621 } else if (titleLayout != null && descriptionLayout != null ) {
615- info .setText (titleLayout .getText () + ", " + descriptionLayout .getText ());
622+ if (captionLayout != null ) {
623+ info .setText (titleLayout .getText () + ", " + captionLayout .getText () + ", " + descriptionLayout .getText ());
624+ } else {
625+ info .setText (titleLayout .getText () + ", " + descriptionLayout .getText ());
626+ }
616627 }
617628 if (checkBox .isChecked ()) {
618629 info .setCheckable (true );
0 commit comments