Back to project page Joetz-Android-V2.
The source code is released under:
GNU General Public License
If you think the Android project Joetz-Android-V2 listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.example.jens.myapplication.main; /* w w w . j a v a 2 s . c o m*/ import android.content.Context; import android.support.annotation.DrawableRes; /** * Created by Jens on 13/11/2014. */ public class NavMenuItem implements NavDrawerItem { public static final int ITEM_TYPE = 1 ; private int id ; private String label ; private int icon ; private int selectedIcon; private boolean updateActionBarTitle ; private NavMenuItem() { } /*public static NavMenuItem create( int id, String label, String icon, String selectedIcon, boolean updateActionBarTitle, Context context ) { NavMenuItem item = new NavMenuItem(); item.setId(id); item.setLabel(label); item.setIcon(context.getResources().getIdentifier( icon, "drawable", context.getPackageName())); item.setSelectedIcon(context.getResources().getIdentifier( selectedIcon, "drawable", context.getPackageName())); item.setUpdateActionBarTitle(updateActionBarTitle); return item; }*/ public static NavMenuItem create( int id, String label, @DrawableRes int icon, @DrawableRes int selectedIcon, boolean updateActionBarTitle, Context context ) { NavMenuItem item = new NavMenuItem(); item.setId(id); item.setLabel(label); //item.setIcon(context.getResources().getIdentifier( icon, "drawable", context.getPackageName())); //item.setSelectedIcon(context.getResources().getIdentifier( selectedIcon, "drawable", context.getPackageName())); item.setIcon(icon); item.setSelectedIcon(selectedIcon); item.setUpdateActionBarTitle(updateActionBarTitle); return item; } @Override public int getType() { return ITEM_TYPE; } public int getId() { return id; } public void setId(int id) { this.id = id; } public String getLabel() { return label; } public void setLabel(String label) { this.label = label; } public int getIcon() { return icon; } public void setIcon(int icon) { this.icon = icon; } public int getSelectedIcon() { return selectedIcon; } public void setSelectedIcon(int selectedIcon) { this.selectedIcon = selectedIcon; } @Override public boolean isEnabled() { return true; } @Override public boolean updateActionBarTitle() { return this.updateActionBarTitle; } public void setUpdateActionBarTitle(boolean updateActionBarTitle) { this.updateActionBarTitle = updateActionBarTitle; } }