parent
6a676c2fad
commit
6765229d37
14 changed files with 249 additions and 30 deletions
|
@ -5,7 +5,7 @@ import javax.inject.Inject
|
|||
import javax.inject.Singleton
|
||||
|
||||
/**
|
||||
* Used to communicate the selected subject from the subject overview to the task overview of that subject.
|
||||
* Used to communicate the selected subject from the subject overview other screens.
|
||||
* Because this is a singleton-class the view-models of both screens observe the same data.
|
||||
*/
|
||||
@Singleton
|
||||
|
@ -15,4 +15,6 @@ class SelectedSubject @Inject constructor() {
|
|||
fun set(subject: Subject) {
|
||||
this.subject = subject
|
||||
}
|
||||
|
||||
fun isSet() = this::subject.isInitialized
|
||||
}
|
21
app/src/main/java/be/ugent/sel/studeez/data/SelectedTask.kt
Normal file
21
app/src/main/java/be/ugent/sel/studeez/data/SelectedTask.kt
Normal file
|
@ -0,0 +1,21 @@
|
|||
package be.ugent.sel.studeez.data
|
||||
|
||||
import be.ugent.sel.studeez.data.local.models.task.Task
|
||||
import javax.inject.Inject
|
||||
import javax.inject.Singleton
|
||||
|
||||
/**
|
||||
* Used to communicate the selected task from the task overview other screens.
|
||||
* Because this is a singleton-class the view-models of both screens observe the same data.
|
||||
*/
|
||||
@Singleton
|
||||
class SelectedTask @Inject constructor() {
|
||||
private lateinit var task: Task
|
||||
|
||||
operator fun invoke() = task
|
||||
fun set(task: Task) {
|
||||
this.task = task
|
||||
}
|
||||
|
||||
fun isSet() = this::task.isInitialized
|
||||
}
|
Reference in a new issue