OptionButton - OneUIProject/OneUI-Design-Library GitHub Wiki

de.dlyt.yanndroid.oneui.widget.OptionButton

Create lists inside DrawerLayout without using RecyclerView with OptionButton.

<de.dlyt.yanndroid.oneui.widget.OptionButton
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    app:icon="..."
    app:text="..."
    app:selected="..."
    app:counter="..."
    app:counterEnabled="..." />

app:icon="..." attribute is the button icon, and app:text="..." the text. app:selected="..." is to show the OptionButton as selected (colored and bold text), it's false by default. app:counterEnabled="..." and app:counter="..." can customize a counter at the end of the view, which is disabled by default. Make sure to enable the app:counterEnabled attribute or it won't show up.

Methods

Set/get the icon and text.

public void setIcon(Drawable icon)
public String getText()
public void setText(String text)

Manage the counter.

public Integer getCounter()
public void setCounter(Integer integer)
public void setCounterEnabled(Boolean enabled)
public void toggleCounterEnabled()
public Boolean isCounterEnabled()

Control the state (colored, bold text).

public void setButtonSelected(Boolean selected)
public void toggleButtonSelected()
public Boolean isButtonSelected()

Enable/disable the OptionButton.

public void setButtonEnabled(Boolean enabled)