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
b5e4523b
authored
Mar 18, 2019
by
eguven
Committed by
Oliver Woodman
Mar 20, 2019
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Remove index modifier methods from DownloadIndex interface
PiperOrigin-RevId: 239045412
parent
d85ee01a
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
15 additions
and
20 deletions
demos/main/src/main/java/com/google/android/exoplayer2/demo/DownloadTracker.java
library/core/src/main/java/com/google/android/exoplayer2/offline/DefaultDownloadIndex.java
library/core/src/main/java/com/google/android/exoplayer2/offline/DownloadIndex.java
library/core/src/main/java/com/google/android/exoplayer2/offline/DownloadIndexUtil.java
demos/main/src/main/java/com/google/android/exoplayer2/demo/DownloadTracker.java
View file @
b5e4523b
...
...
@@ -29,7 +29,6 @@ import com.google.android.exoplayer2.offline.ActionFile;
import
com.google.android.exoplayer2.offline.DefaultDownloadIndex
;
import
com.google.android.exoplayer2.offline.DownloadAction
;
import
com.google.android.exoplayer2.offline.DownloadHelper
;
import
com.google.android.exoplayer2.offline.DownloadIndex
;
import
com.google.android.exoplayer2.offline.DownloadManager
;
import
com.google.android.exoplayer2.offline.DownloadService
;
import
com.google.android.exoplayer2.offline.DownloadState
;
...
...
@@ -68,7 +67,7 @@ public class DownloadTracker implements DownloadManager.Listener {
private
final
DataSource
.
Factory
dataSourceFactory
;
private
final
CopyOnWriteArraySet
<
Listener
>
listeners
;
private
final
HashMap
<
Uri
,
DownloadState
>
trackedDownloadStates
;
private
final
DownloadIndex
downloadIndex
;
private
final
D
efaultD
ownloadIndex
downloadIndex
;
private
final
Handler
indexHandler
;
@Nullable
private
StartDownloadDialogHelper
startDownloadDialogHelper
;
...
...
library/core/src/main/java/com/google/android/exoplayer2/offline/DefaultDownloadIndex.java
View file @
b5e4523b
...
...
@@ -183,7 +183,12 @@ public final class DefaultDownloadIndex implements DownloadIndex {
return
new
DownloadStateCursorImpl
(
cursor
);
}
@Override
/**
* Adds or replaces a {@link DownloadState}.
*
* @param downloadState The {@link DownloadState} to be added.
* @throws DatabaseIOException If an error occurs setting the state.
*/
public
void
putDownloadState
(
DownloadState
downloadState
)
throws
DatabaseIOException
{
ensureInitialized
();
Assertions
.
checkState
(
downloadState
.
state
!=
DownloadState
.
STATE_REMOVED
);
...
...
@@ -212,7 +217,11 @@ public final class DefaultDownloadIndex implements DownloadIndex {
}
}
@Override
/**
* Removes the {@link DownloadState} with the given {@code id}.
*
* @throws DatabaseIOException If an error occurs removing the state.
*/
public
void
removeDownloadState
(
String
id
)
throws
DatabaseIOException
{
ensureInitialized
();
try
{
...
...
library/core/src/main/java/com/google/android/exoplayer2/offline/DownloadIndex.java
View file @
b5e4523b
...
...
@@ -41,18 +41,4 @@ public interface DownloadIndex {
*/
DownloadStateCursor
getDownloadStates
(
@DownloadState
.
State
int
...
states
)
throws
IOException
;
/**
* Adds or replaces a {@link DownloadState}.
*
* @param downloadState The {@link DownloadState} to be added.
* @throws IOException If an error occurs setting the state.
*/
void
putDownloadState
(
DownloadState
downloadState
)
throws
IOException
;
/**
* Removes the {@link DownloadState} with the given {@code id}.
*
* @throws IOException If an error occurs removing the state.
*/
void
removeDownloadState
(
String
id
)
throws
IOException
;
}
library/core/src/main/java/com/google/android/exoplayer2/offline/DownloadIndexUtil.java
View file @
b5e4523b
...
...
@@ -48,7 +48,7 @@ public final class DownloadIndexUtil {
*/
public
static
void
upgradeActionFile
(
ActionFile
actionFile
,
DownloadIndex
downloadIndex
,
D
efaultD
ownloadIndex
downloadIndex
,
@Nullable
DownloadIdProvider
downloadIdProvider
)
throws
IOException
{
if
(
downloadIdProvider
==
null
)
{
...
...
@@ -72,7 +72,8 @@ public final class DownloadIndexUtil {
* @throws IOException If an error occurs storing the state in the {@link DownloadIndex}.
*/
public
static
void
addAction
(
DownloadIndex
downloadIndex
,
@Nullable
String
id
,
DownloadAction
action
)
throws
IOException
{
DefaultDownloadIndex
downloadIndex
,
@Nullable
String
id
,
DownloadAction
action
)
throws
IOException
{
DownloadState
downloadState
=
downloadIndex
.
getDownloadState
(
id
!=
null
?
id
:
action
.
id
);
if
(
downloadState
!=
null
)
{
downloadState
=
downloadState
.
mergeAction
(
action
);
...
...
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