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
d85ee01a
authored
Mar 18, 2019
by
eguven
Committed by
Oliver Woodman
Mar 20, 2019
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Convert DownloadManager.Listener methods no-op default methods
PiperOrigin-RevId: 239019504
parent
d229e1f4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
7 additions
and
36 deletions
demos/main/src/main/java/com/google/android/exoplayer2/demo/DownloadTracker.java
library/core/src/main/java/com/google/android/exoplayer2/offline/DownloadManager.java
library/core/src/main/java/com/google/android/exoplayer2/offline/DownloadService.java
testutils_robolectric/src/main/java/com/google/android/exoplayer2/testutil/TestDownloadManagerListener.java
demos/main/src/main/java/com/google/android/exoplayer2/demo/DownloadTracker.java
View file @
d85ee01a
...
...
@@ -35,7 +35,6 @@ import com.google.android.exoplayer2.offline.DownloadService;
import
com.google.android.exoplayer2.offline.DownloadState
;
import
com.google.android.exoplayer2.offline.DownloadStateCursor
;
import
com.google.android.exoplayer2.offline.StreamKey
;
import
com.google.android.exoplayer2.scheduler.Requirements
;
import
com.google.android.exoplayer2.trackselection.MappingTrackSelector.MappedTrackInfo
;
import
com.google.android.exoplayer2.upstream.DataSource
;
import
com.google.android.exoplayer2.util.Log
;
...
...
@@ -130,11 +129,6 @@ public class DownloadTracker implements DownloadManager.Listener {
// DownloadManager.Listener
@Override
public
void
onInitialized
(
DownloadManager
downloadManager
)
{
// Do nothing.
}
@Override
public
void
onDownloadStateChanged
(
DownloadManager
downloadManager
,
DownloadState
downloadState
)
{
if
(
downloadState
.
state
==
DownloadState
.
STATE_REMOVED
||
downloadState
.
state
==
DownloadState
.
STATE_FAILED
)
{
...
...
@@ -145,19 +139,6 @@ public class DownloadTracker implements DownloadManager.Listener {
}
}
@Override
public
void
onIdle
(
DownloadManager
downloadManager
)
{
// Do nothing.
}
@Override
public
void
onRequirementsStateChanged
(
DownloadManager
downloadManager
,
Requirements
requirements
,
@Requirements
.
RequirementFlags
int
notMetRequirements
)
{
// Do nothing.
}
// Internal methods
private
void
loadTrackedActions
()
{
...
...
library/core/src/main/java/com/google/android/exoplayer2/offline/DownloadManager.java
View file @
d85ee01a
...
...
@@ -68,21 +68,23 @@ public final class DownloadManager {
*
* @param downloadManager The reporting instance.
*/
void
onInitialized
(
DownloadManager
downloadManager
);
default
void
onInitialized
(
DownloadManager
downloadManager
)
{}
/**
* Called when the state of a download changes.
*
* @param downloadManager The reporting instance.
* @param downloadState The state of the download.
*/
void
onDownloadStateChanged
(
DownloadManager
downloadManager
,
DownloadState
downloadState
);
default
void
onDownloadStateChanged
(
DownloadManager
downloadManager
,
DownloadState
downloadState
)
{}
/**
* Called when there is no active download left.
*
* @param downloadManager The reporting instance.
*/
void
onIdle
(
DownloadManager
downloadManager
);
default
void
onIdle
(
DownloadManager
downloadManager
)
{}
/**
* Called when the download requirements state changed.
...
...
@@ -92,10 +94,10 @@ public final class DownloadManager {
* @param notMetRequirements {@link Requirements.RequirementFlags RequirementFlags} that are not
* met, or 0.
*/
void
onRequirementsStateChanged
(
default
void
onRequirementsStateChanged
(
DownloadManager
downloadManager
,
Requirements
requirements
,
@Requirements
.
RequirementFlags
int
notMetRequirements
)
;
@Requirements
.
RequirementFlags
int
notMetRequirements
)
{}
}
/** The default maximum number of simultaneous downloads. */
...
...
library/core/src/main/java/com/google/android/exoplayer2/offline/DownloadService.java
View file @
d85ee01a
...
...
@@ -533,11 +533,6 @@ public abstract class DownloadService extends Service {
}
@Override
public
void
onInitialized
(
DownloadManager
downloadManager
)
{
// Do nothing.
}
@Override
public
void
onDownloadStateChanged
(
DownloadManager
downloadManager
,
DownloadState
downloadState
)
{
if
(
downloadService
!=
null
)
{
...
...
testutils_robolectric/src/main/java/com/google/android/exoplayer2/testutil/TestDownloadManagerListener.java
View file @
d85ee01a
...
...
@@ -20,7 +20,6 @@ import static com.google.common.truth.Truth.assertThat;
import
android.os.ConditionVariable
;
import
com.google.android.exoplayer2.offline.DownloadManager
;
import
com.google.android.exoplayer2.offline.DownloadState
;
import
com.google.android.exoplayer2.scheduler.Requirements
;
import
java.util.HashMap
;
import
java.util.concurrent.ArrayBlockingQueue
;
import
java.util.concurrent.CountDownLatch
;
...
...
@@ -83,12 +82,6 @@ public final class TestDownloadManagerListener implements DownloadManager.Listen
}
}
@Override
public
void
onRequirementsStateChanged
(
DownloadManager
downloadManager
,
Requirements
requirements
,
int
notMetRequirements
)
{
// Do nothing.
}
/**
* Blocks until all remove and download tasks are complete and throws an exception if there was an
* error.
...
...
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