Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
VLC-Android
Manage
Activity
Members
Labels
Plan
Issues
529
Issue boards
Milestones
Wiki
Code
Merge requests
13
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
VideoLAN
VLC-Android
Commits
fe9a5792
Commit
fe9a5792
authored
6 years ago
by
Geoffrey Métais
Browse files
Options
Downloads
Patches
Plain Diff
Parent coroutine job in ViewModels
parent
621a7ee5
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
vlc-android/src/org/videolan/vlc/viewmodels/ScopedModel.kt
+8
-1
8 additions, 1 deletion
vlc-android/src/org/videolan/vlc/viewmodels/ScopedModel.kt
with
8 additions
and
1 deletion
vlc-android/src/org/videolan/vlc/viewmodels/ScopedModel.kt
+
8
−
1
View file @
fe9a5792
...
...
@@ -3,9 +3,16 @@ package org.videolan.vlc.viewmodels
import
android.arch.lifecycle.ViewModel
import
kotlinx.coroutines.experimental.CoroutineScope
import
kotlinx.coroutines.experimental.Dispatchers
import
kotlinx.coroutines.experimental.Job
import
kotlinx.coroutines.experimental.android.Main
open
class
ScopedModel
:
ViewModel
(),
CoroutineScope
{
override
val
coroutineContext
=
Dispatchers
.
Main
.
immediate
protected
val
job
=
Job
()
override
val
coroutineContext
=
Dispatchers
.
Main
.
immediate
+
job
override
fun
onCleared
()
{
super
.
onCleared
()
job
.
cancel
()
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment