package com.example.lab3;

import android.os.Parcel;
import android.os.Parcelable;

public class ProgressInfo implements Parcelable {

    public static final int STATUS_IN_PROGRESS = 0;
    public static final int STATUS_COMPLETED = 1;
    public static final int STATUS_ERROR = -1;

    public long downloadedBytes = 0;
    public int fileSize = 0;
    public int status = STATUS_IN_PROGRESS;

    public ProgressInfo() {}

    protected ProgressInfo(Parcel in) {
        downloadedBytes = in.readLong();
        fileSize = in.readInt();
        status = in.readInt();
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeLong(downloadedBytes);
        dest.writeInt(fileSize);
        dest.writeInt(status);
    }

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

    public static final Creator<ProgressInfo> CREATOR = new Creator<ProgressInfo>() {
        @Override
        public ProgressInfo createFromParcel(Parcel in) {
            return new ProgressInfo(in);
        }

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