Last active
June 23, 2016 11:59
-
-
Save msama/6483209 to your computer and use it in GitHub Desktop.
A checkable Android LinearLayout. This is useful for custom list rows.
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
package com.ahuralab.shakeacocktail.layouts; | |
import android.content.Context; | |
import android.util.AttributeSet; | |
import android.widget.Checkable; | |
import android.widget.LinearLayout; | |
/** | |
* Allow custom list rows to be checked. | |
* | |
* @author msama ([email protected]) on 08/09/13. | |
* @author psaeedi on 08/09/13. | |
*/ | |
public class CheckableLinearLayout extends LinearLayout implements Checkable { | |
private boolean checked; | |
public CheckableLinearLayout(Context context) { | |
super(context); | |
} | |
public CheckableLinearLayout(Context context, AttributeSet attrs) { | |
super(context, attrs); | |
} | |
public CheckableLinearLayout(Context context, AttributeSet attrs, int defStyle) { | |
super(context, attrs, defStyle); | |
} | |
@Override | |
public void setChecked(boolean checked) { | |
this.checked = checked; | |
} | |
@Override | |
public boolean isChecked() { | |
return checked; | |
} | |
@Override | |
public void toggle() { | |
setChecked(!checked); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment