a custom SecondaryDrawerItem of Mike Penz's MaterialDrawer that takes different name upon disable state
July 18, 2016 ยท View on GitHub
import android.support.annotation.StringRes;
import com.mikepenz.materialdrawer.holder.StringHolder; import com.mikepenz.materialdrawer.model.SecondaryDrawerItem;
/** Created by Anglev on 18/7/2016. */
public class CustomWithNameDisabledSecondaryItem extends SecondaryDrawerItem {
private StringHolder mWithDisableName;
public CustomWithNameDisabledSecondaryItem withDisabledName (@StringRes int nameRes) {
mWithDisableName = new StringHolder(nameRes);
return this;
}
@Override
public CustomWithNameDisabledSecondaryItem withName (@StringRes int nameRes) {
if(!this.isEnabled()){
this.name = mWithDisableName;
}
return this;
}
}