UserViewInfo.java 2.03 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
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; // 记录坐标
17 18
    private int sourcesType;
    private String cover;
19 20 21 22 23

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

24
    public UserViewInfo(String cover, String url, int sourcesType) {
25
        this.url = url;
26 27
        this.cover = cover;
        this.sourcesType = sourcesType;
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
    }


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

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

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

    @Override
46 47
    public String getCover() {
        return cover;
48 49
    }

50 51 52 53 54 55
    @Override
    public int getSourcesType() {
        return sourcesType;
    }


56 57 58 59
    public void setBounds(Rect bounds) {
        mBounds = bounds;
    }

60

61 62 63 64 65 66 67 68 69 70

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

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeString(this.url);
        dest.writeParcelable(this.mBounds, flags);
71 72
        dest.writeString(this.cover);
        dest.writeInt(this.sourcesType);
73 74 75 76 77
    }

    protected UserViewInfo(Parcel in) {
        this.url = in.readString();
        this.mBounds = in.readParcelable(Rect.class.getClassLoader());
78 79
        this.cover = in.readString();
        this.sourcesType = in.readInt();
80 81 82 83 84 85 86 87 88 89 90 91 92 93
    }

    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];
        }
    };
}