2020-11-06 11:26:50 +01:00
|
|
|
package com.mobeta.android.dslv;
|
|
|
|
|
|
|
|
import android.content.Context;
|
|
|
|
import android.util.AttributeSet;
|
|
|
|
import android.widget.Checkable;
|
|
|
|
import android.widget.LinearLayout;
|
|
|
|
|
|
|
|
public class CheckableLinearLayout extends LinearLayout implements Checkable {
|
|
|
|
|
2023-07-22 21:23:27 +02:00
|
|
|
private static final int CHECKABLE_CHILD_INDEX = 0;
|
2020-11-06 11:26:50 +01:00
|
|
|
private Checkable child;
|
|
|
|
|
|
|
|
public CheckableLinearLayout(Context context, AttributeSet attrs) {
|
|
|
|
super(context, attrs);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
protected void onFinishInflate() {
|
|
|
|
super.onFinishInflate();
|
|
|
|
child = (Checkable) getChildAt(CHECKABLE_CHILD_INDEX);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean isChecked() {
|
|
|
|
return child.isChecked();
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void setChecked(boolean checked) {
|
|
|
|
child.setChecked(checked);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void toggle() {
|
|
|
|
child.toggle();
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|