diff --git a/app/src/main/java/com/example/sprout/refactor/viewmodel/BaseViewModel.java b/app/src/main/java/com/example/sprout/refactor/viewmodel/BaseViewModel.java index c2b107c..b2c0c75 100644 --- a/app/src/main/java/com/example/sprout/refactor/viewmodel/BaseViewModel.java +++ b/app/src/main/java/com/example/sprout/refactor/viewmodel/BaseViewModel.java @@ -4,6 +4,13 @@ import android.arch.lifecycle.LifecycleObserver; import android.arch.lifecycle.OnLifecycleEvent; +import com.example.sprout.refactor.messengers.NavigationMessage; +import com.example.sprout.refactor.messengers.NavigationMessenger; +import com.example.sprout.refactor.messengers.ToastMessage; +import com.example.sprout.refactor.messengers.ToastMessenger; + +import io.reactivex.Observable; + /** * Base ViewModel * @@ -11,6 +18,9 @@ */ public abstract class BaseViewModel implements LifecycleObserver { + protected ToastMessenger toastMessanger = new ToastMessenger(); + protected NavigationMessenger navigationMessenger = new NavigationMessenger(); + @OnLifecycleEvent(Lifecycle.Event.ON_CREATE) public void onCreate() { } @@ -34,4 +44,13 @@ @OnLifecycleEvent(Lifecycle.Event.ON_DESTROY) public void onDestroy() { } + + + public Observable getToastMessanger() { + return toastMessanger.getObservable(); + } + + public Observable getNavigationMessenger() { + return navigationMessenger.getObservable(); + } }