Skip to content

Instantly share code, notes, and snippets.

@AngleV
Last active July 18, 2016 10:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AngleV/400377184386193c985d905bd97f2d40 to your computer and use it in GitHub Desktop.
Save AngleV/400377184386193c985d905bd97f2d40 to your computer and use it in GitHub Desktop.
a custom SecondaryDrawerItem of Mike Penz's MaterialDrawer that takes different name upon disable state
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;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment