Exemplo n.º 1
0
 private void updateTyping() {
   needNewUpdateTyping = false;
   if (description.getPeerType() == PeerType.PEER_USER
       || description.getPeerType() == PeerType.PEER_USER_ENCRYPTED) {
     if (userTypes) {
       typingLayout =
           new StaticLayout(
               getResources().getString(R.string.lang_common_typing),
               bodyHighlightPaint,
               layout.layoutMainWidth,
               Layout.Alignment.ALIGN_NORMAL,
               1.0f,
               0.0f,
               false);
     } else {
       typingLayout = null;
     }
   } else {
     if (typingUids != null && typingUids.length != 0) {
       String[] names = new String[typingUids.length];
       for (int i = 0; i < names.length; i++) {
         names[i] = application.getEngine().getUserRuntime(typingUids[i]).getFirstName();
       }
       String typing = TextUtil.formatTyping(names);
       Spannable spannable =
           application
               .getEmojiProcessor()
               .processEmojiCutMutable(typing, EmojiProcessor.CONFIGURATION_DIALOGS);
       CharSequence sequence =
           TextUtils.ellipsize(
               spannable, bodyHighlightPaint, layout.layoutMainWidth, TextUtils.TruncateAt.END);
       typingLayout =
           new StaticLayout(
               sequence,
               bodyHighlightPaint,
               layout.layoutMainWidth,
               Layout.Alignment.ALIGN_NORMAL,
               1.0f,
               0.0f,
               false);
     } else {
       typingLayout = null;
     }
   }
 }