Example #1
0
 @Override
 public void onItemClick(int facesPos, int viewIndex) {
   int deleteId = (++viewIndex) * (SysConstant.pageSize - 1);
   if (deleteId > Emoparser.getInstance(MessageActivity.this).getResIdList().length) {
     deleteId = Emoparser.getInstance(MessageActivity.this).getResIdList().length;
   }
   if (deleteId == facesPos) {
     String msgContent = messageEdt.getText().toString();
     if (msgContent.isEmpty()) return;
     if (msgContent.contains("["))
       msgContent = msgContent.substring(0, msgContent.lastIndexOf("["));
     messageEdt.setText(msgContent);
   } else {
     int resId = Emoparser.getInstance(MessageActivity.this).getResIdList()[facesPos];
     String pharse = Emoparser.getInstance(MessageActivity.this).getIdPhraseMap().get(resId);
     int startIndex = messageEdt.getSelectionStart();
     Editable edit = messageEdt.getEditableText();
     if (startIndex < 0 || startIndex >= edit.length()) {
       if (null != pharse) {
         edit.append(pharse);
       }
     } else {
       if (null != pharse) {
         edit.insert(startIndex, pharse);
       }
     }
   }
   Editable edtable = messageEdt.getText();
   int position = edtable.length();
   Selection.setSelection(edtable, position);
 }
Example #2
0
 private boolean isMsgGif(MessageEntity msg) {
   String content = msg.getContent();
   // @YM 临时处理  牙牙表情与消息混合出现的消息丢失
   if (TextUtils.isEmpty(content) || !(content.startsWith("[") && content.endsWith("]"))) {
     return false;
   }
   return Emoparser.getInstance(this.ctx).isMessageGif(msg.getContent());
 }
Example #3
0
        @Override
        public void onItemClick(int facesPos, int viewIndex) {
          int resId = Emoparser.getInstance(MessageActivity.this).getYayaResIdList()[facesPos];
          logger.d("message_activity#yayaEmoGridView be clicked");

          String content =
              Emoparser.getInstance(MessageActivity.this).getYayaIdPhraseMap().get(resId);
          if (content.equals("")) {
            Toast.makeText(
                    MessageActivity.this,
                    getResources().getString(R.string.message_null),
                    Toast.LENGTH_LONG)
                .show();
            return;
          }

          TextMessage textMessage = TextMessage.buildForSend(content, loginUser, peerEntity);
          imService.getMessageManager().sendText(textMessage);
          pushList(textMessage);
          scrollToBottomListItem();
        }
Example #4
0
 private void initEmo() {
   Emoparser.getInstance(MessageActivity.this);
   IMApplication.gifRunning = true;
 }