Add method for updating "checked" state of compound button in bottom sheet menu item
This commit is contained in:
parent
8e00c3f91a
commit
5744a981d7
1 changed files with 8 additions and 1 deletions
|
@ -17,6 +17,8 @@ public class BottomSheetItemWithCompoundButton extends BottomSheetItemWithDescri
|
|||
private boolean checked;
|
||||
private ColorStateList buttonTintList;
|
||||
|
||||
private CompoundButton compoundButton;
|
||||
|
||||
public BottomSheetItemWithCompoundButton(View customView,
|
||||
@LayoutRes int layoutId,
|
||||
Object tag,
|
||||
|
@ -45,10 +47,15 @@ public class BottomSheetItemWithCompoundButton extends BottomSheetItemWithDescri
|
|||
this.buttonTintList = buttonTintList;
|
||||
}
|
||||
|
||||
public void setChecked(boolean checked) {
|
||||
this.checked = checked;
|
||||
compoundButton.setChecked(checked);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void inflate(OsmandApplication app, ViewGroup container, boolean nightMode) {
|
||||
super.inflate(app, container, nightMode);
|
||||
CompoundButton compoundButton = (CompoundButton) view.findViewById(R.id.compound_button);
|
||||
compoundButton = (CompoundButton) view.findViewById(R.id.compound_button);
|
||||
compoundButton.setChecked(checked);
|
||||
CompoundButtonCompat.setButtonTintList(compoundButton, buttonTintList);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue