mirror of
https://github.com/samsonjs/media.git
synced 2026-04-11 12:15:47 +00:00
Added cancellation check for MediaBrowserFuture in demo session app
When app is deployed with device's screen being off, MainActivity's onStart is called swiftly by its onStop. The onStop method cancels the browserFuture task which in turn "completes" the task. Upon task "completion", pushRoot() runs and then throws error as it calls get() a cancelled task.
PiperOrigin-RevId: 492416445
(cherry picked from commit 64603cba8d)
This commit is contained in:
parent
8618263b99
commit
c4f1c047ca
1 changed files with 1 additions and 1 deletions
|
|
@ -38,7 +38,7 @@ import com.google.common.util.concurrent.ListenableFuture
|
|||
class MainActivity : AppCompatActivity() {
|
||||
private lateinit var browserFuture: ListenableFuture<MediaBrowser>
|
||||
private val browser: MediaBrowser?
|
||||
get() = if (browserFuture.isDone) browserFuture.get() else null
|
||||
get() = if (browserFuture.isDone && !browserFuture.isCancelled) browserFuture.get() else null
|
||||
|
||||
private lateinit var mediaListAdapter: FolderMediaItemArrayAdapter
|
||||
private lateinit var mediaListView: ListView
|
||||
|
|
|
|||
Loading…
Reference in a new issue