CNNotificationMessage.java 5.4 KB
package com.cnlive.libs.chat.model;

import android.net.Uri;
import android.os.Parcel;
import android.os.Parcelable;

import io.rong.push.RongPushClient;
import io.rong.push.common.ParcelUtils;
import io.rong.push.notification.PushNotificationMessage;

/**
 * Created by Lynn on 2/17/2017.
 */

public class CNNotificationMessage implements Parcelable {

    private String pushId;
    private RongPushClient.ConversationType conversationType;
    private long receivedTime;
    private String objectName;
    private String senderId;
    private String senderName;
    private Uri senderPortrait;
    private String targetId;
    private String targetUserName;
    private String pushTitle;
    private String pushContent;
    private String pushData;
    private String extra;
    private String isFromPush;
    public static final Creator<PushNotificationMessage> CREATOR = new Creator() {
        public CNNotificationMessage createFromParcel(Parcel source) {
            return new CNNotificationMessage(source);
        }

        public CNNotificationMessage[] newArray(int size) {
            return new CNNotificationMessage[size];
        }
    };

    public CNNotificationMessage() {
    }

    public void setPushId(String id) {
        this.pushId = id;
    }

    public void setConversationType(RongPushClient.ConversationType type) {
        this.conversationType = type;
    }

    public void setReceivedTime(long time) {
        this.receivedTime = time;
    }

    public void setObjectName(String objectName) {
        this.objectName = objectName;
    }

    public void setSenderId(String id) {
        this.senderId = id;
    }

    public void setSenderName(String name) {
        this.senderName = name;
    }

    public void setSenderPortrait(Uri uri) {
        this.senderPortrait = uri;
    }

    public void setTargetId(String id) {
        this.targetId = id;
    }

    public void setTargetUserName(String name) {
        this.targetUserName = name;
    }

    public void setPushTitle(String title) {
        this.pushTitle = title;
    }

    public void setPushContent(String content) {
        this.pushContent = content;
    }

    public void setPushData(String appDataContent) {
        this.pushData = appDataContent;
    }

    public void setExtra(String extra) {
        this.extra = extra;
    }

    public void setPushFlag(String value) {
        this.isFromPush = value;
    }

    public String getPushId() {
        return this.pushId;
    }

    public RongPushClient.ConversationType getConversationType() {
        return this.conversationType;
    }

    public String getTargetId() {
        return this.targetId;
    }

    public String getTargetUserName() {
        return this.targetUserName;
    }

    public long getReceivedTime() {
        return this.receivedTime;
    }

    public String getObjectName() {
        return this.objectName;
    }

    public String getSenderId() {
        return this.senderId;
    }

    public String getSenderName() {
        return this.senderName;
    }

    public Uri getSenderPortrait() {
        return this.senderPortrait;
    }

    public String getPushTitle() {
        return this.pushTitle;
    }

    public String getPushContent() {
        return this.pushContent;
    }

    public String getPushData() {
        return this.pushData;
    }

    public String getExtra() {
        return this.extra;
    }

    public String getPushFlag() {
        return this.isFromPush;
    }

    public void writeToParcel(Parcel dest, int flags) {
        ParcelUtils.writeToParcel(dest, this.getPushId());
        ParcelUtils.writeToParcel(dest, Integer.valueOf(this.getConversationType().getValue()));
        ParcelUtils.writeToParcel(dest, Long.valueOf(this.getReceivedTime()));
        ParcelUtils.writeToParcel(dest, this.getObjectName());
        ParcelUtils.writeToParcel(dest, this.getSenderId());
        ParcelUtils.writeToParcel(dest, this.getSenderName());
        ParcelUtils.writeToParcel(dest, this.getSenderPortrait());
        ParcelUtils.writeToParcel(dest, this.getTargetId());
        ParcelUtils.writeToParcel(dest, this.getTargetUserName());
        ParcelUtils.writeToParcel(dest, this.getPushTitle());
        ParcelUtils.writeToParcel(dest, this.getPushContent());
        ParcelUtils.writeToParcel(dest, this.getPushData());
        ParcelUtils.writeToParcel(dest, this.getExtra());
        ParcelUtils.writeToParcel(dest, this.getPushFlag());
    }

    public CNNotificationMessage(Parcel in) {
        this.setPushId(ParcelUtils.readFromParcel(in));
        this.setConversationType(RongPushClient.ConversationType.setValue(ParcelUtils.readIntFromParcel(in).intValue()));
        this.setReceivedTime(ParcelUtils.readLongFromParcel(in).longValue());
        this.setObjectName(ParcelUtils.readFromParcel(in));
        this.setSenderId(ParcelUtils.readFromParcel(in));
        this.setSenderName(ParcelUtils.readFromParcel(in));
        this.setSenderPortrait((Uri) ParcelUtils.readFromParcel(in, Uri.class));
        this.setTargetId(ParcelUtils.readFromParcel(in));
        this.setTargetUserName(ParcelUtils.readFromParcel(in));
        this.setPushTitle(ParcelUtils.readFromParcel(in));
        this.setPushContent(ParcelUtils.readFromParcel(in));
        this.setPushData(ParcelUtils.readFromParcel(in));
        this.setExtra(ParcelUtils.readFromParcel(in));
        this.setPushFlag(ParcelUtils.readFromParcel(in));
    }

    public int describeContents() {
        return 0;
    }
}