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
eae09c67
authored
Feb 15, 2019
by
tonihei
Committed by
Andrew Lewis
Feb 18, 2019
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Release download helper if new download track selection is started.
PiperOrigin-RevId: 234128521
parent
b69041be
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
3 deletions
demos/main/src/main/java/com/google/android/exoplayer2/demo/DownloadTracker.java
demos/main/src/main/java/com/google/android/exoplayer2/demo/DownloadTracker.java
View file @
eae09c67
...
...
@@ -20,6 +20,7 @@ import android.content.DialogInterface;
import
android.net.Uri
;
import
android.os.Handler
;
import
android.os.HandlerThread
;
import
android.support.annotation.Nullable
;
import
android.support.v4.app.FragmentManager
;
import
android.widget.Toast
;
import
com.google.android.exoplayer2.C
;
...
...
@@ -73,6 +74,8 @@ public class DownloadTracker implements DownloadManager.Listener {
private
final
DefaultDownloadIndex
downloadIndex
;
private
final
Handler
actionFileIOHandler
;
@Nullable
private
StartDownloadDialogHelper
startDownloadDialogHelper
;
public
DownloadTracker
(
Context
context
,
DataSource
.
Factory
dataSourceFactory
,
DefaultDownloadIndex
downloadIndex
)
{
this
.
context
=
context
.
getApplicationContext
();
...
...
@@ -117,8 +120,12 @@ public class DownloadTracker implements DownloadManager.Listener {
getDownloadHelper
(
uri
,
extension
,
renderersFactory
).
getRemoveAction
();
startServiceWithAction
(
removeAction
);
}
else
{
new
StartDownloadDialogHelper
(
fragmentManager
,
getDownloadHelper
(
uri
,
extension
,
renderersFactory
),
name
);
if
(
startDownloadDialogHelper
!=
null
)
{
startDownloadDialogHelper
.
release
();
}
startDownloadDialogHelper
=
new
StartDownloadDialogHelper
(
fragmentManager
,
getDownloadHelper
(
uri
,
extension
,
renderersFactory
),
name
);
}
}
...
...
@@ -230,6 +237,11 @@ public class DownloadTracker implements DownloadManager.Listener {
downloadHelper
.
prepare
(
this
);
}
public
void
release
()
{
downloadHelper
.
release
();
startDownloadDialogHelper
=
null
;
}
// DownloadHelper.Callback implementation.
@Override
...
...
@@ -303,7 +315,7 @@ public class DownloadTracker implements DownloadManager.Listener {
@Override
public
void
onDismiss
(
DialogInterface
dialogInterface
)
{
downloadHelper
.
release
();
release
();
}
}
}
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