use of butter.droid.ui.main.navigation.NavigationDrawerFragment.AbsNavDrawerItem in project butter-android by butterproject.
the class NavigationDrawerPresenterImpl method getNavigationItems.
private List<NavigationDrawerFragment.AbsNavDrawerItem> getNavigationItems() {
List<AbsNavDrawerItem> navItems = new ArrayList<>();
navItems.add(new HeaderNavDrawerItem());
ProviderWrapper[] providers = providerManager.getProviders();
for (int i = 0; i < providers.length; i++) {
final ProviderWrapper provider = providers[i];
navItems.add(new ProviderNavDrawerItem(provider.getDisplayName(), provider.getIcon(), i));
}
navItems.add(new ScreenNavDrawerItem(R.string.preferences, R.drawable.ic_nav_settings, PreferencesActivity.class));
navItems.get(selectedPosition).setSelected(true);
return navItems;
}
use of butter.droid.ui.main.navigation.NavigationDrawerFragment.AbsNavDrawerItem in project butter-android by butterproject.
the class NavigationAdapter method onBindItemViewHolder.
private void onBindItemViewHolder(ItemRowHolder viewHolder, int position) {
AbsNavDrawerItem item = getItem(position);
// if(item.isSwitch()) {
// if(item.showProgress()) {
// viewHolder.checkbox.setVisibility(View.INVISIBLE);
// viewHolder.progressBar.setVisibility(View.VISIBLE);
// } else {
// viewHolder.checkbox.setVisibility(View.VISIBLE);
// viewHolder.progressBar.setVisibility(View.INVISIBLE);
// }
// viewHolder.checkbox.setChecked(item.getSwitchValue());
// } else {
// viewHolder.checkbox.setVisibility(View.INVISIBLE);
// viewHolder.progressBar.setVisibility(View.INVISIBLE);
// }
viewHolder.title.setText(item.getTitle());
boolean isSelected = item.isSelected();
viewHolder.title.setTextColor(isSelected ? checkedColor : normalColor);
viewHolder.itemView.setBackgroundResource(isSelected ? checkedBackgroundRes : normalBackgroundRes);
if (item.getIcon() > 0) {
viewHolder.icon.setImageResource(item.getIcon());
if (isSelected) {
viewHolder.icon.setColorFilter(checkedColor, PorterDuff.Mode.SRC_IN);
} else {
viewHolder.icon.setColorFilter(normalColor, PorterDuff.Mode.SRC_IN);
}
}
}
Aggregations