Last active
July 18, 2016 10:26
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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