Tabnine Logo
AVIMTypedMessage
Code IndexAdd Tabnine to your IDE (free)

How to use
AVIMTypedMessage
in
com.avos.avoscloud.im.v2

Best Java code snippets using com.avos.avoscloud.im.v2.AVIMTypedMessage (Showing top 11 results out of 315)

origin: cn.leancloud.android/avoscloud-push

@Override
public final String getContent() {
 JSONObject json = new JSONObject();
 json.put("_lctype", this.getMessageType());
 if (!fieldCache.contains(this.getClass())) {
  computeFieldAttribute(this.getClass());
 }
 Map<String, FieldAttribute> classFieldAttributesMap = fieldCache.get(this.getClass());
 for (FieldAttribute fieldAttribute : classFieldAttributesMap.values()) {
  Object fieldValue = fieldAttribute.get(this);
  json.put(fieldAttribute.getAliaName(), fieldValue);
 }
 return json.toJSONString();
}
origin: WuXiaolong/WoChat

  private void sendNotification(AVIMTypedMessage message, AVIMConversation conversation) {
    String notificationContent = message instanceof AVIMTextMessage ? ((AVIMTextMessage) message).getText() : context.getString(R.string.unspport_message_type);

    Intent intent = new Intent(context, NotificationBroadcastReceiver.class);
    intent.putExtra(AppConstant.CONVERSATION_ID, conversation.getConversationId());
    intent.putExtra(AppConstant.ACTIVITY_TITLE, conversation.getName());
    intent.putExtra(AppConstant.MEMBER_ID, message.getFrom());
//        NotificationUtils.showNotification(context, "新信息", notificationContent, null, intent);
  }
}
origin: cn.leancloud.android/avoscloud-push

public AVIMTypedMessage() {
 super();
 initMessageType();
}
origin: BaaSBeginner/leanchat-android

 /**
  * 判断是什么消息类型
  */

 @Override
 public int getItemViewType(int position) {
  AVIMMessage message = messageList.get(position);
  if (null != message && message instanceof AVIMTypedMessage) {
   AVIMTypedMessage typedMessage = (AVIMTypedMessage) message;
   boolean isMe = fromMe(typedMessage);
   if (typedMessage.getMessageType() == LCIMRedPacketMessage.RED_PACKET_MESSAGE_TYPE) {
    return isMe ? ITEM_RIGHT_TEXT_RED_PACKET : ITEM_LEFT_TEXT_RED_PACKET;
   } else if (typedMessage.getMessageType() == LCIMRedPacketAckMessage.RED_PACKET_ACK_MESSAGE_TYPE) {
//        return RedPacketUtils.getInstance().receiveRedPacketAckMsg((LCIMRedPacketAckMessage) typedMessage,ITEM_TEXT_RED_PACKET_NOTIFY,ITEM_TEXT_RED_PACKET_NOTIFY_MEMBER);
   } else if (typedMessage.getMessageType() == LCIMTransferMessage.TRANSFER_MESSAGE_TYPE) {
    return isMe ? ITEM_RIGHT_TEXT_TRANSFER : ITEM_LEFT_TEXT_TRANSFER;
   }
  }
  return super.getItemViewType(position);
 }
}
origin: cn.leancloud.android/avoscloud-push

@Override
public final void setContent(String content) {
 Map<String, Object> contentMap = JSONObject.parseObject(content, Map.class);
 if (!fieldCache.contains(this.getClass())) {
  computeFieldAttribute(this.getClass());
 }
 Map<String, FieldAttribute> classFieldAttributesMap = fieldCache.get(this.getClass());
 for (FieldAttribute fieldAttribute : classFieldAttributesMap.values()) {
  Object value = contentMap.get(fieldAttribute.getAliaName());
  if (value instanceof Map && fieldAttribute.getFieldType() != null) {
   value = JSON.parseObject(JSON.toJSONString(value), fieldAttribute.getFieldType());
  }
  fieldAttribute.set(this, value);
 }
}
origin: cn.leancloud.android/avoscloud-push

field = getField(currentClazz, propertyName);
if (field == null && (isBooleanGetterMethod || isSetterMethod)) {
 String isFieldName =
   "is" + Character.toUpperCase(propertyName.charAt(0)) + propertyName.substring(1);
 field = getField(currentClazz, isFieldName);
 if (field != null) {
  propertyName = isFieldName;
origin: cn.leancloud.android/avoscloud-push

AVIMMessage message = AVIMTypedMessage.parseMessage(conversationId, jsonObj);
conversation.setLastMessage(message);
origin: cn.leancloud.android/avoscloud-push

@Override
public void onMessagePatchCommand(boolean isModify, Integer requestKey, Messages.PatchCommand patchCommand) {
 updateLocalPatchTime(isModify, patchCommand);
 if (isModify) {
  if (patchCommand.getPatchesCount() > 0) {
   for (Messages.PatchItem patchItem : patchCommand.getPatchesList()) {
    AVIMMessage message = AVIMTypedMessage.getMessage(patchItem.getCid(), patchItem.getMid(), patchItem.getData(), patchItem.getFrom(), patchItem.getTimestamp(), 0, 0);
    message.setUpdateAt(patchItem.getPatchTimestamp());
    AVConversationHolder conversation = session.getConversationHolder(patchItem.getCid(), Conversation.CONV_TYPE_NORMAL);
    conversation.onMessageUpdateEvent(message, patchItem.getRecall());
   }
  }
 } else {
  Operation op = session.conversationOperationCache.poll(requestKey);
  AVIMOperation operation = AVIMOperation.getAVIMOperation(op.operation);
  Bundle bundle = new Bundle();
  bundle.putLong(Conversation.PARAM_MESSAGE_PATCH_TIME, patchCommand.getLastPatchTime());
  BroadcastUtil.sendIMLocalBroadcast(session.getSelfPeerId(), null, requestKey, bundle, operation);
 }
}
origin: WuXiaolong/WoChat

@Override
public int getItemViewType(int position) {
  AVIMMessage message = messageList.get(position);
  if (null != message && message instanceof AVIMTypedMessage) {
    AVIMTypedMessage typedMessage = (AVIMTypedMessage) message;
    boolean isMe = message.getFrom().equals(AVImClientManager.getInstance().getClientId());
    if (typedMessage.getMessageType() == AVIMReservedMessageType.TextMessageType.getType()) {
      return isMe ? ITEM_RIGHT_TEXT : ITEM_LEFT_TEXT;
    } else {
      return isMe ? ITEM_RIGHT : ITEM_LEFT;
    }
  }
  return 8888;
}
origin: WuXiaolong/WoChat

  @Override
  public void onMessage(AVIMTypedMessage message, AVIMConversation conversation, AVIMClient client) {
    Log.e("wxl", "MessageHandler onMessage");
    String clientID = "";
    try {
      clientID = AVImClientManager.getInstance().getClientId();

      if (client.getClientId().equals(clientID)) {
        Log.e("wxl", "MessageHandler onMessage clientID=" + clientID + ",client.getClientId()=" + client.getClientId() + ",message.getFrom()=" + message.getFrom());
        // 过滤掉自己发的消息
        if (!message.getFrom().equals(clientID)) {
          sendEvent(message, conversation);
//                    Log.e("wxl", "MessageHandler=" + NotificationUtils.isShowNotification(conversation.getConversationId()));
//                    if (NotificationUtils.isShowNotification(conversation.getConversationId())) {
//                        sendNotification(message, conversation);
//                    }
        }
      } else {
        client.close(null);
      }
    } catch (IllegalStateException e) {
      client.close(null);
    }
  }

origin: FreedomZZQ/YouJoin-Android

@Override
public void onMessage(AVIMTypedMessage message, AVIMConversation conversation, AVIMClient client){
  String clientID = "";
  try{
    clientID = AVImClientManager.getInstance().getClientId();
    if(client.getClientId().equals(clientID)){
      //过滤自己发的消息
      if(!message.getFrom().equals(clientID)){
        sendEvent(message, conversation);
      }
    }else {
      client.close(null);
    }
  }catch(IllegalStateException e){
    client.close(null);
    e.printStackTrace();
  }
}
com.avos.avoscloud.im.v2AVIMTypedMessage

Most used methods

  • getMessageType
  • getFrom
  • computeFieldAttribute
  • getField
  • getMessage
  • initMessageType
  • parseMessage
    从 conversation 数据中解析 lastMessage

Popular in Java

  • Finding current android device location
  • runOnUiThread (Activity)
  • getContentResolver (Context)
  • setRequestProperty (URLConnection)
  • List (java.util)
    An ordered collection (also known as a sequence). The user of this interface has precise control ove
  • TimerTask (java.util)
    The TimerTask class represents a task to run at a specified time. The task may be run once or repeat
  • Vector (java.util)
    Vector is an implementation of List, backed by an array and synchronized. All optional operations in
  • Manifest (java.util.jar)
    The Manifest class is used to obtain attribute information for a JarFile and its entries.
  • ZipFile (java.util.zip)
    This class provides random read access to a zip file. You pay more to read the zip file's central di
  • Base64 (org.apache.commons.codec.binary)
    Provides Base64 encoding and decoding as defined by RFC 2045.This class implements section 6.8. Base
  • CodeWhisperer alternatives
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now