mirror of
https://github.com/sudoxnym/habitica-android.git
synced 2026-07-13 17:51:57 +00:00
show number of available stat points in menu. Fixes #869
This commit is contained in:
parent
3f7f370d91
commit
d4ff2dfa62
2 changed files with 17 additions and 11 deletions
|
|
@ -717,4 +717,5 @@
|
||||||
<string name="classless">Classless</string>
|
<string name="classless">Classless</string>
|
||||||
<string name="class_equipment_shop_dialog">This item is only available to a specific class.\nYou can change your class from Settings.</string>
|
<string name="class_equipment_shop_dialog">This item is only available to a specific class.\nYou can change your class from Settings.</string>
|
||||||
<string name="class_gear_disclaimer">You can only purchase gear for your current class</string>
|
<string name="class_gear_disclaimer">You can only purchase gear for your current class</string>
|
||||||
|
<string name="available_stats" formatted="false">%d points</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
||||||
|
|
@ -477,25 +477,30 @@ public class MainActivity extends BaseActivity implements TutorialView.OnTutoria
|
||||||
drawer.removeItem(MainDrawerBuilder.INSTANCE.getSIDEBAR_SKILLS());
|
drawer.removeItem(MainDrawerBuilder.INSTANCE.getSIDEBAR_SKILLS());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
IDrawerItem newItem;
|
PrimaryDrawerItem newItem = new PrimaryDrawerItem()
|
||||||
|
.withName(this.getString(R.string.sidebar_skills))
|
||||||
|
.withIdentifier(MainDrawerBuilder.INSTANCE.getSIDEBAR_SKILLS());
|
||||||
if (user.getStats().getLvl() < MIN_LEVEL_FOR_SKILLS && !hasSpecialItems) {
|
if (user.getStats().getLvl() < MIN_LEVEL_FOR_SKILLS && !hasSpecialItems) {
|
||||||
newItem = new PrimaryDrawerItem()
|
newItem = newItem.withEnabled(false).withBadge(this.getString(R.string.unlock_lvl_11));
|
||||||
.withName(this.getString(R.string.sidebar_skills))
|
|
||||||
.withEnabled(false)
|
|
||||||
.withBadge(this.getString(R.string.unlock_lvl_11))
|
|
||||||
.withIdentifier(MainDrawerBuilder.INSTANCE.getSIDEBAR_SKILLS());
|
|
||||||
} else {
|
|
||||||
newItem = new PrimaryDrawerItem()
|
|
||||||
.withName(this.getString(R.string.sidebar_skills))
|
|
||||||
.withIdentifier(MainDrawerBuilder.INSTANCE.getSIDEBAR_SKILLS());
|
|
||||||
}
|
}
|
||||||
if (item == null) {
|
if (item == null) {
|
||||||
drawer.addItemAtPosition(newItem, 1);
|
drawer.addItemAtPosition(newItem, 1);
|
||||||
} else {
|
} else {
|
||||||
drawer.updateItem(newItem);
|
drawer.updateItem(newItem);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
IDrawerItem statsItem = drawer.getDrawerItem(MainDrawerBuilder.INSTANCE.getSIDEBAR_STATS());
|
||||||
|
PrimaryDrawerItem newStatsItem = new PrimaryDrawerItem()
|
||||||
|
.withName(this.getString(R.string.sidebar_skills))
|
||||||
|
.withIdentifier(MainDrawerBuilder.INSTANCE.getSIDEBAR_SKILLS());
|
||||||
|
if (user.getStats() != null && user.getStats().lvl >= 0 && user.getStats().points > 0) {
|
||||||
|
newStatsItem = newStatsItem.withBadge(this.getString(R.string.available_stats, user.getStats().points));
|
||||||
|
}
|
||||||
|
if (statsItem == null) {
|
||||||
|
drawer.addItemAtPosition(newStatsItem, 2);
|
||||||
|
} else {
|
||||||
|
drawer.updateItem(newStatsItem);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue