X-Git-Url: https://git.mdrn.pl/wl-app.git/blobdiff_plain/48b2fe9f7c2dc3d9aeaaa6dbfb27c7da4f3235ff..269195b3729c1bdc22e9053ee4ebca667ea8549d:/Android/app/src/main/java/com/moiseum/wolnelektury/components/CheckableRelativeLayout.java diff --git a/Android/app/src/main/java/com/moiseum/wolnelektury/components/CheckableRelativeLayout.java b/Android/app/src/main/java/com/moiseum/wolnelektury/components/CheckableRelativeLayout.java new file mode 100644 index 0000000..5a19829 --- /dev/null +++ b/Android/app/src/main/java/com/moiseum/wolnelektury/components/CheckableRelativeLayout.java @@ -0,0 +1,40 @@ +package com.moiseum.wolnelektury.components; + +import android.content.Context; +import android.util.AttributeSet; +import android.widget.Checkable; +import android.widget.RelativeLayout; + +/** + * Relative layout for handling checking/selecting action. + */ +public class CheckableRelativeLayout extends RelativeLayout implements Checkable { + + public CheckableRelativeLayout(Context context) { + super(context); + } + + public CheckableRelativeLayout(Context context, AttributeSet attrs) { + super(context, attrs); + } + + public CheckableRelativeLayout(Context context, AttributeSet attrs, int defStyleAttr) { + super(context, attrs, defStyleAttr); + } + + @Override + public void setChecked(boolean checked) { + super.setSelected(checked); + } + + @Override + public boolean isChecked() { + return super.isSelected(); + } + + @Override + public void toggle() { + super.setSelected(!isSelected()); + } +} +