Search in sources :

Example 1 with AbsNavDrawerItem

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;
}
Also used : AbsNavDrawerItem(butter.droid.ui.main.navigation.NavigationDrawerFragment.AbsNavDrawerItem) ProviderNavDrawerItem(butter.droid.ui.main.navigation.NavigationDrawerFragment.ProviderNavDrawerItem) PreferencesActivity(butter.droid.ui.preferences.PreferencesActivity) ArrayList(java.util.ArrayList) HeaderNavDrawerItem(butter.droid.ui.main.navigation.NavigationDrawerFragment.HeaderNavDrawerItem) ScreenNavDrawerItem(butter.droid.ui.main.navigation.NavigationDrawerFragment.ScreenNavDrawerItem) ProviderWrapper(butter.droid.base.manager.internal.provider.model.ProviderWrapper)

Example 2 with AbsNavDrawerItem

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);
        }
    }
}
Also used : AbsNavDrawerItem(butter.droid.ui.main.navigation.NavigationDrawerFragment.AbsNavDrawerItem)

Aggregations

AbsNavDrawerItem (butter.droid.ui.main.navigation.NavigationDrawerFragment.AbsNavDrawerItem)2 ProviderWrapper (butter.droid.base.manager.internal.provider.model.ProviderWrapper)1 HeaderNavDrawerItem (butter.droid.ui.main.navigation.NavigationDrawerFragment.HeaderNavDrawerItem)1 ProviderNavDrawerItem (butter.droid.ui.main.navigation.NavigationDrawerFragment.ProviderNavDrawerItem)1 ScreenNavDrawerItem (butter.droid.ui.main.navigation.NavigationDrawerFragment.ScreenNavDrawerItem)1 PreferencesActivity (butter.droid.ui.preferences.PreferencesActivity)1 ArrayList (java.util.ArrayList)1