Stable navigation menu, refactoring

This commit is contained in:
M66B
2019-02-26 17:44:15 +00:00
parent 3573d75ce9
commit 274c9dd471
4 changed files with 119 additions and 99 deletions

View File

@@ -30,7 +30,7 @@ public class DrawerAdapter extends ArrayAdapter<DrawerItem> {
}
if (tv != null) {
tv.setText(item.getTitle());
tv.setText(item.getTitle(getContext()));
tv.setTextColor(Helper.resolveColor(getContext(),
item.getHighlight() ? R.attr.colorUnread : android.R.attr.textColorSecondary));
@@ -39,6 +39,17 @@ public class DrawerAdapter extends ArrayAdapter<DrawerItem> {
return row;
}
@Override
public boolean hasStableIds() {
return true;
}
@Override
public long getItemId(int position) {
DrawerItem item = getItem(position);
return (item == null ? 0 : item.getId());
}
@Override
public boolean isEnabled(int position) {
DrawerItem item = getItem(position);