コード例 #1
0
ファイル: IMMessage.java プロジェクト: supengchao/XmppIm
  /** shimiso 按时间降序排列 */
  @Override
  public int compareTo(IMMessage oth) {
    if (null == this.getTime() || null == oth.getTime()) {
      return 0;
    }
    String format = null;
    String time1 = "";
    String time2 = "";
    if (this.getTime().length() == oth.getTime().length() && this.getTime().length() == 23) {
      time1 = this.getTime();
      time2 = oth.getTime();
      format = Constant.MS_FORMART;
    } else {
      time1 = this.getTime().substring(0, 19);
      time2 = oth.getTime().substring(0, 19);
    }
    Date da1 = DateUtil.str2Date(time1, format);
    Date da2 = DateUtil.str2Date(time2, format);
    if (da1.before(da2)) {
      return -1;
    }
    if (da2.before(da1)) {
      return 1;
    }

    return 0;
  }
コード例 #2
0
ファイル: IMMessage.java プロジェクト: supengchao/XmppIm
 @Override
 public IMMessage createFromParcel(Parcel source) {
   IMMessage message = new IMMessage();
   message.setType(source.readInt());
   message.setContent(source.readString());
   message.setTime(source.readString());
   message.setFromSubJid(source.readString());
   message.setMsgType(source.readInt());
   return message;
 }