-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove Presenters in favor of viewmodels
- Loading branch information
1 parent
d017468
commit ecc1a67
Showing
26 changed files
with
281 additions
and
280 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 0 additions & 33 deletions
33
app/src/main/kotlin/com/yohaq/titan/presenters/base/BasePresenter.kt
This file was deleted.
Oops, something went wrong.
16 changes: 0 additions & 16 deletions
16
app/src/main/kotlin/com/yohaq/titan/presenters/base/Presenter.kt
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 0 additions & 19 deletions
19
app/src/main/kotlin/com/yohaq/titan/ui/createExerciseScreen/CreateExercisePresenter.kt
This file was deleted.
Oops, something went wrong.
7 changes: 0 additions & 7 deletions
7
app/src/main/kotlin/com/yohaq/titan/ui/createExerciseScreen/CreateExerciseView.kt
This file was deleted.
Oops, something went wrong.
37 changes: 37 additions & 0 deletions
37
app/src/main/kotlin/com/yohaq/titan/ui/createExerciseScreen/CreateExerciseViewModel.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package com.yohaq.titan.ui.createExerciseScreen | ||
|
||
import com.jakewharton.rxrelay.PublishRelay | ||
import com.yohaq.titan.data.interactors.CreateExerciseInteractor | ||
import rx.Observable | ||
import rx.functions.Action1 | ||
import javax.inject.Inject | ||
|
||
/** | ||
* Created by yousufhaque on 6/8/16. | ||
*/ | ||
class CreateExerciseViewModel | ||
@Inject | ||
constructor(private val createExerciseInteractor: CreateExerciseInteractor) { | ||
|
||
val onNameUpdate : Action1<CharSequence> | ||
val onCreateExercise : Action1<Unit> | ||
|
||
val nameObservable : Observable<CharSequence> | ||
val createExerciseObservable : Observable<Unit> | ||
|
||
init { | ||
val nameRelay = PublishRelay.create<CharSequence>() | ||
val createExerciseRelay = PublishRelay.create<Unit>() | ||
|
||
onNameUpdate = nameRelay.asAction() | ||
onCreateExercise = createExerciseRelay.asAction() | ||
|
||
nameObservable = nameRelay.asObservable() | ||
createExerciseObservable = createExerciseRelay.asObservable() | ||
} | ||
|
||
|
||
fun createExercise(name: String) { | ||
createExerciseInteractor.createExercise(name) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 0 additions & 19 deletions
19
app/src/main/kotlin/com/yohaq/titan/ui/createWorkoutScreen/CreateWorkoutPresenter.kt
This file was deleted.
Oops, something went wrong.
7 changes: 0 additions & 7 deletions
7
app/src/main/kotlin/com/yohaq/titan/ui/createWorkoutScreen/CreateWorkoutView.kt
This file was deleted.
Oops, something went wrong.
51 changes: 51 additions & 0 deletions
51
app/src/main/kotlin/com/yohaq/titan/ui/createWorkoutScreen/CreateWorkoutViewModel.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
package com.yohaq.titan.ui.createWorkoutScreen | ||
|
||
import com.jakewharton.rxrelay.PublishRelay | ||
import com.yohaq.titan.data.interactors.CreateWorkoutInteractor | ||
import com.yohaq.titan.data.models.Exercise | ||
import com.yohaq.titan.data.models.WorkoutSet | ||
import rx.Observable | ||
import rx.functions.Action1 | ||
import java.util.* | ||
import javax.inject.Inject | ||
|
||
/** | ||
* Created by yousufhaque on 6/8/16. | ||
*/ | ||
class CreateWorkoutViewModel | ||
@Inject constructor(private val createWorkoutInteractor: CreateWorkoutInteractor) { | ||
|
||
val onDateUpdate : Action1<Date> | ||
val onExerciseUpdate : Action1<Exercise> | ||
val onSetListUpdate: Action1<List<WorkoutSet>> | ||
val onCreateWorkout: Action1<Unit> | ||
|
||
private val dateObservable : Observable<Date> | ||
private val exerciseObservable : Observable<Exercise> | ||
private val setListObservable : Observable<List<WorkoutSet>> | ||
private val createWorkoutObservable : Observable<Unit> | ||
|
||
init { | ||
val dateRelay = PublishRelay.create<Date>() | ||
val exerciseRelay = PublishRelay.create<Exercise>() | ||
val setListRelay = PublishRelay.create<List<WorkoutSet>>() | ||
val createWorkoutRelay = PublishRelay.create<Unit>() | ||
|
||
onDateUpdate = dateRelay.asAction() | ||
onExerciseUpdate = exerciseRelay.asAction() | ||
onSetListUpdate = setListRelay.asAction() | ||
onCreateWorkout = createWorkoutRelay.asAction() | ||
|
||
|
||
dateObservable = dateRelay.asObservable() | ||
exerciseObservable = exerciseRelay.asObservable() | ||
setListObservable = setListRelay.asObservable() | ||
createWorkoutObservable = createWorkoutRelay.asObservable() | ||
|
||
} | ||
|
||
|
||
fun createWorkout(dateCreated: Date, exercise: Exercise, sets: List<WorkoutSet>) { | ||
createWorkoutInteractor.createWorkout(dateCreated, exercise, sets) | ||
} | ||
} |
Oops, something went wrong.