mirror of
https://github.com/lacerta-doc/Lacerta.git
synced 2024-11-22 16:03:15 +00:00
共有ビューモデル実装
This commit is contained in:
parent
b756eea9bb
commit
6d17811ada
|
@ -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<Integer> currentFragmentPosition = new MutableLiveData<>();
|
||||
|
||||
public void setCurrentFragmentPosition(int position) {
|
||||
currentFragmentPosition.setValue(position);
|
||||
}
|
||||
|
||||
public int getCurrentFragmentPosition() {
|
||||
assert currentFragmentPosition.getValue() != null;
|
||||
return currentFragmentPosition.getValue();
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user