mirror of
https://github.com/sudoxnym/habitica-android.git
synced 2026-07-13 17:51:57 +00:00
fix pet count calculation
This commit is contained in:
parent
b3f7405d90
commit
b6ebd58d11
1 changed files with 5 additions and 18 deletions
|
|
@ -119,7 +119,7 @@ public class FullProfileActivity extends BaseActivity {
|
||||||
|
|
||||||
apiHelper.apiService.GetMember(this.userId)
|
apiHelper.apiService.GetMember(this.userId)
|
||||||
.compose(apiHelper.configureApiCallObserver())
|
.compose(apiHelper.configureApiCallObserver())
|
||||||
.subscribe(habitRPGUser -> updateView(habitRPGUser),
|
.subscribe(this::updateView,
|
||||||
throwable -> {
|
throwable -> {
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -223,27 +223,14 @@ public class FullProfileActivity extends BaseActivity {
|
||||||
|
|
||||||
addLevelAttributes(stats, user);
|
addLevelAttributes(stats, user);
|
||||||
|
|
||||||
petCount.setText(countEntries(user.getItems().getPets()) + "");
|
petCount.setText(String.valueOf(countEntries(user.getItems().getPets())));
|
||||||
mountCount.setText(countEntriesBool(user.getItems().getMounts()) + "");
|
mountCount.setText(String.valueOf(countEntries(user.getItems().getMounts())));
|
||||||
}
|
}
|
||||||
|
|
||||||
private int countEntries(HashMap<String, Integer> hashMap) {
|
private int countEntries(HashMap<String, ?> hashMap) {
|
||||||
int _count = 0;
|
int _count = 0;
|
||||||
|
|
||||||
for (Map.Entry<String, Integer> e : hashMap.entrySet()) {
|
for (Map.Entry<String, ?> e : hashMap.entrySet()) {
|
||||||
if (e.getValue() == -1)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
_count += e.getValue();
|
|
||||||
}
|
|
||||||
|
|
||||||
return _count;
|
|
||||||
}
|
|
||||||
|
|
||||||
private int countEntriesBool(HashMap<String, Boolean> hashMap) {
|
|
||||||
int _count = 0;
|
|
||||||
|
|
||||||
for (Map.Entry<String, Boolean> e : hashMap.entrySet()) {
|
|
||||||
if (e.getValue() == null)
|
if (e.getValue() == null)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue