mirror of
https://github.com/sudoxnym/habitica-android.git
synced 2026-05-18 11:49:01 +00:00
disable skills menu item when it's not available.
This commit is contained in:
parent
1b1b27c9fd
commit
186afb05f4
2 changed files with 18 additions and 0 deletions
|
|
@ -197,4 +197,5 @@
|
|||
<string name="coming_soon">Coming Soon</string>
|
||||
<string name="chat_flag_confirmation">Are you sure you want to report this message for violation?</string>
|
||||
<string name="flag_confirm">Flag Message</string>
|
||||
<string name="unlock_lvl_10">Unlock at lvl 10</string>
|
||||
</resources>
|
||||
|
|
@ -47,6 +47,8 @@ import com.magicmicky.habitrpgwrapper.lib.models.tasks.Task;
|
|||
import com.magicmicky.habitrpgwrapper.lib.models.tasks.TaskTag;
|
||||
import com.mikepenz.materialdrawer.AccountHeader;
|
||||
import com.mikepenz.materialdrawer.Drawer;
|
||||
import com.mikepenz.materialdrawer.model.PrimaryDrawerItem;
|
||||
import com.mikepenz.materialdrawer.model.interfaces.IDrawerItem;
|
||||
import com.mikepenz.materialdrawer.model.interfaces.IProfile;
|
||||
import com.raizlabs.android.dbflow.runtime.transaction.BaseTransaction;
|
||||
import com.raizlabs.android.dbflow.runtime.transaction.TransactionListener;
|
||||
|
|
@ -418,6 +420,21 @@ public class MainActivity extends AppCompatActivity implements HabitRPGUserCallb
|
|||
}
|
||||
});
|
||||
accountHeader.updateProfile(profile);
|
||||
|
||||
IDrawerItem item = drawer.getDrawerItem(MainDrawerBuilder.SIDEBAR_SKILLS);
|
||||
if (user.getStats().getLvl() < 11 && item.isEnabled()) {
|
||||
IDrawerItem newItem = new PrimaryDrawerItem()
|
||||
.withName(this.getString(R.string.sidebar_skills))
|
||||
.withEnabled(false)
|
||||
.withBadge(this.getString(R.string.unlock_lvl_10))
|
||||
.withIdentifier(MainDrawerBuilder.SIDEBAR_SKILLS);
|
||||
drawer.updateItem(newItem);
|
||||
} else if (user.getStats().getLvl() >= 11 && !item.isEnabled()) {
|
||||
IDrawerItem newItem = new PrimaryDrawerItem()
|
||||
.withName(this.getString(R.string.sidebar_skills))
|
||||
.withIdentifier(MainDrawerBuilder.SIDEBAR_SKILLS);
|
||||
drawer.updateItem(newItem);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
Loading…
Reference in a new issue