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,8 +287,10 @@ public class EditMonsterViewModel extends ViewModel {
} }
public void setHasShield(boolean hasShield) { public void setHasShield(boolean hasShield) {
mHasShield.setValue(hasShield); if (!Objects.equals(mHasShield.getValue(), hasShield)) {
mHasChanges.setValue(true); mHasShield.setValue(hasShield);
mHasChanges.setValue(true);
}
} }
public boolean getHasShieldValueAsBoolean() { public boolean getHasShieldValueAsBoolean() {
@@ -300,8 +302,10 @@ public class EditMonsterViewModel extends ViewModel {
} }
public void setShieldBonus(int shieldBonus) { public void setShieldBonus(int shieldBonus) {
mShieldBonus.setValue(shieldBonus); if (!Objects.equals(mShieldBonus.getValue(), shieldBonus)) {
mHasChanges.setValue(true); mShieldBonus.setValue(shieldBonus);
mHasChanges.setValue(true);
}
} }
public void setShieldBonus(String shieldBonus) { public void setShieldBonus(String shieldBonus) {
@@ -314,8 +318,10 @@ public class EditMonsterViewModel extends ViewModel {
} }
public void setCustomArmor(String customArmor) { public void setCustomArmor(String customArmor) {
mCustomArmor.setValue(customArmor); if (!Objects.equals(mCustomArmor.getValue(), customArmor)) {
mHasChanges.setValue(true); mCustomArmor.setValue(customArmor);
mHasChanges.setValue(true);
}
} }
public String getShieldBonusValueAsString() { public String getShieldBonusValueAsString() {