diff --git a/component/viewer/src/main/java/one/nem/lacerta/component/viewer/SharedViewModel.java b/component/viewer/src/main/java/one/nem/lacerta/component/viewer/SharedViewModel.java new file mode 100644 index 00000000..c5364f63 --- /dev/null +++ b/component/viewer/src/main/java/one/nem/lacerta/component/viewer/SharedViewModel.java @@ -0,0 +1,19 @@ +package one.nem.lacerta.component.viewer; + +import androidx.lifecycle.MutableLiveData; +import androidx.lifecycle.ViewModel; + +public class SharedViewModel extends ViewModel { + + private final MutableLiveData currentFragmentPosition = new MutableLiveData<>(); + + public void setCurrentFragmentPosition(int position) { + currentFragmentPosition.setValue(position); + } + + public int getCurrentFragmentPosition() { + assert currentFragmentPosition.getValue() != null; + return currentFragmentPosition.getValue(); + } + +}