-
- All Implemented Interfaces:
-
android.os.Parcelable
public class DownloadStatus implements Parcelable
Download status describes the current status of a download request.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public @interface
DownloadStatus.StatusCode
The list of possible status values for android.app.DownloadManager.Request.
public @interface
DownloadStatus.ReasonCode
The list of possible reasons code that will be set when StatusCode is either STATUS_RETRY or STATUS_FAILED.
-
Field Summary
Fields Modifier and Type Field Description public final static int
STATUS_PAUSED
public final static int
STATUS_DELETING
public final static int
STATUS_CANCELLING
public final static int
STATUS_QUEUEING
public final static int
STATUS_NOT_QUEUED
public final static int
STATUS_PENDING
public final static int
STATUS_DOWNLOADING
public final static int
STATUS_RETRY
public final static int
STATUS_FAILED
public final static int
STATUS_COMPLETE
public final static int
ERROR_NONE
public final static int
PAUSED_WAITING_TO_RETRY
public final static int
PAUSED_WAITING_FOR_NETWORK
public final static int
PAUSED_QUEUED_FOR_WIFI
public final static int
PAUSED_UNKNOWN
public final static int
ERROR_UNKNOWN
public final static int
ERROR_FILE_ERROR
public final static int
ERROR_UNHANDLED_HTTP_CODE
public final static int
ERROR_HTTP_DATA_ERROR
public final static int
ERROR_TOO_MANY_REDIRECTS
public final static int
ERROR_INSUFFICIENT_SPACE
public final static int
ERROR_DEVICE_NOT_FOUND
public final static int
ERROR_CANNOT_RESUME
public final static int
ERROR_FILE_ALREADY_EXISTS
long
time
int
code
int
reason
long
bytesDownloaded
long
actualSize
long
estimatedSize
public final static Parcelable.Creator<DownloadStatus>
CREATOR
-
Method Summary
Modifier and Type Method Description long
getTime()
Gets the date and time when the status changed as number of milliseconds sinceJanuary 1, 1970, 00:00:00 GMT. int
getCode()
Gets the status code of the download request. void
setCode(int code)
Sets the status code. int
getReason()
Gets the reason code of the download request, if any. void
setReason(int reason)
Sets the reason code related to the download status long
getBytesDownloaded()
Gets the total number of bytes downloaded so far. long
getActualSize()
Gets the actual total size of the file as number of bytes. long
getEstimatedSize()
Gets the estimated total size of the file as number of bytes. static DownloadStatus
createForInvalidDownloadsFile()
Creates a new DownloadStatus instance with error specifying that the DownloadsFileis invalid. String
toString()
boolean
equals(Object o)
int
hashCode()
boolean
isMarkedForDeletion()
Checks if the status indicates the download is currently marked for deletion. int
getStatusMessage()
Converts the current status code to a string resource identifier that explains status. static int
toStatusMessage(int code)
Converts the given status code to a string resource identifier that explains the status. int
getReasonMessage()
Converts the current status code the string resourced identifier that explains the status. static int
toReasonMessage(int reason)
Converts the given reason code to a string resource identifier that explains the reason. long
getMaxSize()
Gets the maximum size of the file as number of bytes by comparing actualSize and estimatedSize double
getProgress()
Calculates the download progress as percentage value. int
describeContents()
void
writeToParcel(Parcel dest, int flags)
-
-
Method Detail
-
getTime
long getTime()
Gets the date and time when the status changed as number of milliseconds sinceJanuary 1, 1970, 00:00:00 GMT.
-
getCode
int getCode()
Gets the status code of the download request.
-
setCode
void setCode(int code)
Sets the status code.
- Parameters:
code
- the status code.
-
getReason
int getReason()
Gets the reason code of the download request, if any.
-
setReason
void setReason(int reason)
Sets the reason code related to the download status
- Parameters:
reason
- the reason code.
-
getBytesDownloaded
long getBytesDownloaded()
Gets the total number of bytes downloaded so far.
-
getActualSize
long getActualSize()
Gets the actual total size of the file as number of bytes.
-
getEstimatedSize
long getEstimatedSize()
Gets the estimated total size of the file as number of bytes.
-
createForInvalidDownloadsFile
static DownloadStatus createForInvalidDownloadsFile()
Creates a new DownloadStatus instance with error specifying that the DownloadsFileis invalid.
-
hashCode
int hashCode()
-
isMarkedForDeletion
boolean isMarkedForDeletion()
Checks if the status indicates the download is currently marked for deletion.
-
getStatusMessage
int getStatusMessage()
Converts the current status code to a string resource identifier that explains status.
-
toStatusMessage
static int toStatusMessage(int code)
Converts the given status code to a string resource identifier that explains the status.
- Parameters:
code
- the status code.
-
getReasonMessage
int getReasonMessage()
Converts the current status code the string resourced identifier that explains the status.
-
toReasonMessage
static int toReasonMessage(int reason)
Converts the given reason code to a string resource identifier that explains the reason.
- Parameters:
reason
- the reason code.
-
getMaxSize
long getMaxSize()
Gets the maximum size of the file as number of bytes by comparing actualSize and estimatedSize
-
getProgress
double getProgress()
Calculates the download progress as percentage value.
-
describeContents
int describeContents()
-
writeToParcel
void writeToParcel(Parcel dest, int flags)
-
-
-
-