Adds missed change tracking to EditMonsterViewModel.

This commit is contained in:
2021-05-30 00:11:14 -07:00
parent 84467dbb0d
commit bc115efba8

View File

@@ -287,9 +287,11 @@ public class EditMonsterViewModel extends ViewModel {
}
public void setHasShield(boolean hasShield) {
if (!Objects.equals(mHasShield.getValue(), hasShield)) {
mHasShield.setValue(hasShield);
mHasChanges.setValue(true);
}
}
public boolean getHasShieldValueAsBoolean() {
return mHasShield.getValue();
@@ -300,9 +302,11 @@ public class EditMonsterViewModel extends ViewModel {
}
public void setShieldBonus(int shieldBonus) {
if (!Objects.equals(mShieldBonus.getValue(), shieldBonus)) {
mShieldBonus.setValue(shieldBonus);
mHasChanges.setValue(true);
}
}
public void setShieldBonus(String shieldBonus) {
Integer parsedValue = StringHelper.parseInt(shieldBonus);
@@ -314,9 +318,11 @@ public class EditMonsterViewModel extends ViewModel {
}
public void setCustomArmor(String customArmor) {
if (!Objects.equals(mCustomArmor.getValue(), customArmor)) {
mCustomArmor.setValue(customArmor);
mHasChanges.setValue(true);
}
}
public String getShieldBonusValueAsString() {
return mShieldBonus.getValue().toString();