mirror of
https://github.com/sudoxnym/habitica-android.git
synced 2026-07-20 04:44:14 +00:00
fix stable display
This commit is contained in:
parent
5d66e1b538
commit
89b0debaf8
3 changed files with 18 additions and 7 deletions
|
|
@ -146,12 +146,18 @@ public class InventoryRepositoryImpl extends ContentRepositoryImpl<InventoryLoca
|
|||
.map(user1 -> {
|
||||
localRepository.executeTransaction(realm -> {
|
||||
if (user != null) {
|
||||
user1.getItems().setUserId(user.getId());
|
||||
Items items = realm.copyToRealmOrUpdate(user1.getItems());
|
||||
user1.getStats().setUserId(user.getId());
|
||||
Stats stats = realm.copyToRealmOrUpdate(user1.getStats());
|
||||
user.setItems(items);
|
||||
user.setStats(stats);
|
||||
if (user1.getItems() != null) {
|
||||
user1.getItems().setUserId(user.getId());
|
||||
Items items = realm.copyToRealmOrUpdate(user1.getItems());
|
||||
user.setItems(items);
|
||||
} else {
|
||||
item.setOwned(item.getOwned()-1);
|
||||
}
|
||||
if (user.getStats() != null) {
|
||||
user1.getStats().setUserId(user.getId());
|
||||
Stats stats = realm.copyToRealmOrUpdate(user1.getStats());
|
||||
user.setStats(stats);
|
||||
}
|
||||
}
|
||||
});
|
||||
return user;
|
||||
|
|
|
|||
|
|
@ -154,6 +154,7 @@ public class RealmInventoryLocalRepository extends RealmContentLocalRepository i
|
|||
|
||||
@Override
|
||||
public Observable<RealmResults<Mount>> getOwnedMounts(String animalType, String animalGroup) {
|
||||
animalGroup = animalGroup.replace("pets", "mounts").replace("Pets", "Mounts");
|
||||
return realm.where(Mount.class)
|
||||
.equalTo("animalGroup", animalGroup)
|
||||
.equalTo("animal", animalType)
|
||||
|
|
|
|||
|
|
@ -108,7 +108,11 @@ public class Mount extends RealmObject implements Animal {
|
|||
}
|
||||
|
||||
public boolean getOwned() {
|
||||
return owned;
|
||||
if (owned == null) {
|
||||
return false;
|
||||
} else {
|
||||
return owned;
|
||||
}
|
||||
}
|
||||
|
||||
public void setOwned(@Nullable Boolean owned) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue