mirror of
https://github.com/sudoxnym/habitica-android.git
synced 2026-07-15 02:31:57 +00:00
parent
5a3b6757c9
commit
2ce1269e6a
2 changed files with 51 additions and 40 deletions
|
|
@ -486,19 +486,31 @@ public class MainActivity extends BaseActivity implements HabitRPGUserCallback.O
|
|||
accountHeader.updateProfile(profile);
|
||||
|
||||
IDrawerItem item = drawer.getDrawerItem(MainDrawerBuilder.SIDEBAR_SKILLS);
|
||||
if (user.getStats().getLvl() < MIN_LEVEL_FOR_SKILLS && item.isEnabled()) {
|
||||
IDrawerItem newItem = new PrimaryDrawerItem()
|
||||
.withName(this.getString(R.string.sidebar_skills))
|
||||
.withEnabled(false)
|
||||
.withBadge(this.getString(R.string.unlock_lvl_11))
|
||||
.withIdentifier(MainDrawerBuilder.SIDEBAR_SKILLS);
|
||||
drawer.updateItem(newItem);
|
||||
} else if (user.getStats().getLvl() >= MIN_LEVEL_FOR_SKILLS && !item.isEnabled()) {
|
||||
IDrawerItem newItem = new PrimaryDrawerItem()
|
||||
.withName(this.getString(R.string.sidebar_skills))
|
||||
.withIdentifier(MainDrawerBuilder.SIDEBAR_SKILLS);
|
||||
drawer.updateItem(newItem);
|
||||
if (user.getPreferences().getDisableClasses()) {
|
||||
if (item != null) {
|
||||
drawer.removeItem(MainDrawerBuilder.SIDEBAR_SKILLS);
|
||||
}
|
||||
} else {
|
||||
IDrawerItem newItem = item;
|
||||
if (user.getStats().getLvl() < MIN_LEVEL_FOR_SKILLS && item.isEnabled()) {
|
||||
newItem = new PrimaryDrawerItem()
|
||||
.withName(this.getString(R.string.sidebar_skills))
|
||||
.withEnabled(false)
|
||||
.withBadge(this.getString(R.string.unlock_lvl_11))
|
||||
.withIdentifier(MainDrawerBuilder.SIDEBAR_SKILLS);
|
||||
} else if (user.getStats().getLvl() >= MIN_LEVEL_FOR_SKILLS && !item.isEnabled()) {
|
||||
newItem = new PrimaryDrawerItem()
|
||||
.withName(this.getString(R.string.sidebar_skills))
|
||||
.withIdentifier(MainDrawerBuilder.SIDEBAR_SKILLS);
|
||||
}
|
||||
if (item == null) {
|
||||
drawer.addItemAtPosition(newItem, 1);
|
||||
} else {
|
||||
drawer.updateItem(newItem);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -249,38 +249,37 @@ public class TasksFragment extends BaseMainFragment implements OnCheckedChangeLi
|
|||
if (user.getFlags().getArmoireEnabled())
|
||||
itemKeys.add("armoire");
|
||||
|
||||
contentCache.GetItemDataList(itemKeys, new ContentCache.GotContentEntryCallback<List<ItemData>>() {
|
||||
@Override
|
||||
public void GotObject(List<ItemData> obj) {
|
||||
ArrayList<Task> buyableItems = new ArrayList<>();
|
||||
contentCache.GetItemDataList(itemKeys, obj -> {
|
||||
ArrayList<Task> buyableItems = new ArrayList<>();
|
||||
if (!isAdded()) {
|
||||
return;
|
||||
}
|
||||
for (ItemData item : obj) {
|
||||
Task reward = new Task();
|
||||
reward.text = item.text;
|
||||
reward.notes = item.notes;
|
||||
reward.value = item.value;
|
||||
reward.setType("reward");
|
||||
reward.specialTag = "item";
|
||||
reward.setId(item.key);
|
||||
|
||||
for (ItemData item : obj) {
|
||||
Task reward = new Task();
|
||||
reward.text = item.text;
|
||||
reward.notes = item.notes;
|
||||
reward.value = item.value;
|
||||
reward.setType("reward");
|
||||
reward.specialTag = "item";
|
||||
reward.setId(item.key);
|
||||
|
||||
if (item.key.equals("armoire")) {
|
||||
if (user.getFlags().getArmoireEmpty()) {
|
||||
reward.notes = getResources().getString(R.string.armoireNotesEmpty);
|
||||
} else {
|
||||
long gearCount = new Select().count()
|
||||
.from(ItemData.class)
|
||||
.where(Condition.CombinedCondition.begin(Condition.column("klass").eq("armoire"))
|
||||
.and(Condition.column("owned").isNull())
|
||||
).count();
|
||||
reward.notes = getResources().getString(R.string.armoireNotesFull, gearCount);
|
||||
}
|
||||
if (item.key.equals("armoire")) {
|
||||
if (user.getFlags().getArmoireEmpty()) {
|
||||
reward.notes = getResources().getString(R.string.armoireNotesEmpty);
|
||||
} else {
|
||||
long gearCount = new Select().count()
|
||||
.from(ItemData.class)
|
||||
.where(Condition.CombinedCondition.begin(Condition.column("klass").eq("armoire"))
|
||||
.and(Condition.column("owned").isNull())
|
||||
).count();
|
||||
reward.notes = getResources().getString(R.string.armoireNotesFull, gearCount);
|
||||
}
|
||||
|
||||
buyableItems.add(reward);
|
||||
}
|
||||
|
||||
callBack.GotAdditionalItems(buyableItems);
|
||||
buyableItems.add(reward);
|
||||
}
|
||||
|
||||
callBack.GotAdditionalItems(buyableItems);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -450,7 +449,7 @@ public class TasksFragment extends BaseMainFragment implements OnCheckedChangeLi
|
|||
|
||||
@Subscribe
|
||||
public void onEvent(final TaskSaveEvent event) {
|
||||
Task task = (Task) event.task;
|
||||
Task task = event.task;
|
||||
if (event.created) {
|
||||
this.mAPIHelper.createNewTask(task, new TaskCreationCallback());
|
||||
updateTags(event.task.getTags());
|
||||
|
|
|
|||
Loading…
Reference in a new issue