Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
SDK
/
exoplayer
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
771aa080
authored
Dec 07, 2018
by
eguven
Committed by
Andrew Lewis
Dec 10, 2018
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Add totalBytes to TaskState
PiperOrigin-RevId: 224506700
parent
17e8c554
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
1 deletions
library/core/src/main/java/com/google/android/exoplayer2/offline/DownloadManager.java
library/core/src/main/java/com/google/android/exoplayer2/offline/DownloadManager.java
View file @
771aa080
...
...
@@ -523,6 +523,8 @@ public final class DownloadManager {
public
final
float
downloadPercentage
;
/** The total number of downloaded bytes. */
public
final
long
downloadedBytes
;
/** The total size of the media, or {@link C#LENGTH_UNSET} if unknown. */
public
final
long
totalBytes
;
/** If {@link #state} is {@link #STATE_FAILED} then this is the cause, otherwise null. */
@Nullable
public
final
Throwable
error
;
...
...
@@ -533,12 +535,14 @@ public final class DownloadManager {
@State
int
state
,
float
downloadPercentage
,
long
downloadedBytes
,
long
totalBytes
,
@Nullable
Throwable
error
)
{
this
.
taskId
=
taskId
;
this
.
action
=
action
;
this
.
state
=
state
;
this
.
downloadPercentage
=
downloadPercentage
;
this
.
downloadedBytes
=
downloadedBytes
;
this
.
totalBytes
=
totalBytes
;
this
.
error
=
error
;
}
...
...
@@ -587,11 +591,14 @@ public final class DownloadManager {
public
TaskState
getTaskState
()
{
float
downloadPercentage
=
C
.
PERCENTAGE_UNSET
;
long
downloadedBytes
=
0
;
long
totalBytes
=
C
.
LENGTH_UNSET
;
if
(
downloader
!=
null
)
{
downloadPercentage
=
downloader
.
getDownloadPercentage
();
downloadedBytes
=
downloader
.
getDownloadedBytes
();
totalBytes
=
downloader
.
getTotalBytes
();
}
return
new
TaskState
(
id
,
action
,
state
,
downloadPercentage
,
downloadedBytes
,
error
);
return
new
TaskState
(
id
,
action
,
state
,
downloadPercentage
,
downloadedBytes
,
totalBytes
,
error
);
}
/** Returns whether the task is finished. */
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment