From 6d17811ada4a7dba85f403c3344417dc8b991e24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=82=8D=E3=82=80=E3=81=AD=E3=81=93?= Date: Mon, 29 Jan 2024 11:30:40 +0900 Subject: [PATCH] =?UTF-8?q?=E5=85=B1=E6=9C=89=E3=83=93=E3=83=A5=E3=83=BC?= =?UTF-8?q?=E3=83=A2=E3=83=87=E3=83=AB=E5=AE=9F=E8=A3=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../component/viewer/SharedViewModel.java | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 component/viewer/src/main/java/one/nem/lacerta/component/viewer/SharedViewModel.java 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(); + } + +}