package com.yidianling.consultant.preview;

import android.graphics.Rect;
import android.os.Parcel;
import android.os.Parcelable;


/**
 * Deprecated: 图片预览实体类
 *
 * @author rainb
 */
public class UserViewInfo implements IThumbViewInfo {

    private String url;  //图片地址
    private Rect mBounds; // 记录坐标
    private int sourcesType;
    private String cover;

    public UserViewInfo(String url) {
        this.url = url;
    }

    public UserViewInfo(String cover, String url, int sourcesType) {
        this.url = url;
        this.cover = cover;
        this.sourcesType = sourcesType;
    }


    @Override
    public String getUrl() {//将你的图片地址字段返回
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    @Override
    public Rect getBounds() {//将你的图片显示坐标字段返回
        return mBounds;
    }

    @Override
    public String getCover() {
        return cover;
    }

    @Override
    public int getSourcesType() {
        return sourcesType;
    }


    public void setBounds(Rect bounds) {
        mBounds = bounds;
    }



    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeString(this.url);
        dest.writeParcelable(this.mBounds, flags);
        dest.writeString(this.cover);
        dest.writeInt(this.sourcesType);
    }

    protected UserViewInfo(Parcel in) {
        this.url = in.readString();
        this.mBounds = in.readParcelable(Rect.class.getClassLoader());
        this.cover = in.readString();
        this.sourcesType = in.readInt();
    }

    public static final Parcelable.Creator<UserViewInfo> CREATOR = new Parcelable.Creator<UserViewInfo>() {
        @Override
        public UserViewInfo createFromParcel(Parcel source) {
            return new UserViewInfo(source);
        }

        @Override
        public UserViewInfo[] newArray(int size) {
            return new UserViewInfo[size];
        }
    };
}