MCPcopy Index your code
hub / github.com/Jaouan/CompoundLayout

github.com/Jaouan/CompoundLayout @1.0.1

Chat with this repo
repository ↗ · DeepWiki ↗ · release 1.0.1 ↗ · + Follow
84 symbols 164 edges 10 files 42 documented · 50%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Android - CompoundLayout

Release Android Arsenal API

It's an Android library that allows you to use Layout as RadioButton or CheckBox. The librarie is Android 14+ compatible. Gradient effect is only Android 21+ compatible.

The demo below is inspired by Cris Samson's gradient hover animation.

demo

Installation

Gradle

repositories {
    maven { url "https://jitpack.io" }
}
compile 'com.github.jaouan:compoundlayout:1.0.0'

Usage

General

CompoundLayout checked state can be changed programmatically using method myCompoundLayout.setChecked(). Checked state can be retrieved using myCompoundLayout.isChecked(), and can be listened using myCompoundLayout.setOnCheckedChangeListener().

Layout as CheckBox

<com.jaouan.compoundlayout.CompoundLayout
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:background="@drawable/a_beautiful_selector"
    app:checked="true" > 

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Lorem ipsum" />

</com.jaouan.compoundlayout.CompoundLayout>

Layout as RadioButton

Basic
<com.jaouan.compoundlayout.RadioLayoutGroup
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    app:orientation="horizontal"> 

    <com.jaouan.compoundlayout.RadioLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:background="@drawable/a_beautiful_selector"
        app:checked="true"> 

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Lorem ipsum" />

    </com.jaouan.compoundlayout.RadioLayout>

    <com.jaouan.compoundlayout.RadioLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:background="@drawable/a_beautiful_selector">

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Lorem ipsum" />

    </com.jaouan.compoundlayout.RadioLayout>

</com.jaouan.compoundlayout.RadioLayoutGroup>
Gradient effect (Android 21+ only)
<com.jaouan.compoundlayout.RadioLayoutGroup
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    app:orientation="horizontal" > 

    <com.jaouan.compoundlayout.GradientRadioLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        app:checked="true"
        app:angle="45"
        app:colorA="#AAFFA726"
        app:colorB="#AAEC407A">

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Lorem ipsum" />

    </com.jaouan.compoundlayout.GradientRadioLayout>


    <com.jaouan.compoundlayout.CircleGradientRadioLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        app:angle="70"
        app:colorA="#AAFFA726"
        app:colorB="#AAEC407A">

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Lorem ipsum" />

    </com.jaouan.compoundlayout.CircleGradientRadioLayout>

</com.jaouan.compoundlayout.RadioLayoutGroup>

You can use myGradientRadioLayout.setColorA(), myGradientRadioLayout.setColorB() and myGradientRadioLayout.setAngle() to configure the gradient effect programmatically.

License

Apache License Version 2.0

Extension points exported contracts — how you extend this code

OnCheckedChangeListener (Interface)
Interface definition for a callback to be invoked when the checked radio button changed in this group. [2 implementers]
compoundlayout/src/main/java/com/jaouan/compoundlayout/RadioLayoutGroup.java
OnCheckedChangeListener (Interface)
On checked change callback interface. [2 implementers]
compoundlayout/src/main/java/com/jaouan/compoundlayout/CompoundLayout.java

Core symbols most depended-on inside this repo

isChecked
called by 8
compoundlayout/src/main/java/com/jaouan/compoundlayout/CompoundLayout.java
bindCompoundListener
called by 5
app/src/main/java/com/jaouan/compoundlayout/example/MainActivity.java
setCheckedStateForView
called by 5
compoundlayout/src/main/java/com/jaouan/compoundlayout/RadioLayoutGroup.java
setCheckedId
called by 4
compoundlayout/src/main/java/com/jaouan/compoundlayout/RadioLayoutGroup.java
initialize
called by 4
compoundlayout/src/main/java/com/jaouan/compoundlayout/CompoundLayout.java
setChecked
called by 4
compoundlayout/src/main/java/com/jaouan/compoundlayout/CompoundLayout.java
initialize
called by 4
compoundlayout/src/main/java/com/jaouan/compoundlayout/GradientRadioLayout.java
updateGradientParameters
called by 4
compoundlayout/src/main/java/com/jaouan/compoundlayout/GradientRadioLayout.java

Shape

Method 68
Class 14
Interface 2

Languages

Java100%

Modules by API surface

compoundlayout/src/main/java/com/jaouan/compoundlayout/RadioLayoutGroup.java27 symbols
compoundlayout/src/main/java/com/jaouan/compoundlayout/CompoundLayout.java20 symbols
compoundlayout/src/main/java/com/jaouan/compoundlayout/GradientRadioLayout.java14 symbols
app/src/main/java/com/jaouan/compoundlayout/example/MainActivity.java7 symbols
compoundlayout/src/main/java/com/jaouan/compoundlayout/CircleGradientRadioLayout.java5 symbols
compoundlayout/src/main/java/com/jaouan/compoundlayout/RadioLayout.java3 symbols
compoundlayout/src/test/java/com/jaouan/compoundlayout/ExampleUnitTest.java2 symbols
compoundlayout/src/androidTest/java/com/jaouan/compoundlayout/ApplicationTest.java2 symbols
app/src/test/java/com/jaouan/compoundlayout/example/ExampleUnitTest.java2 symbols
app/src/androidTest/java/com/jaouan/compoundlayout/example/ApplicationTest.java2 symbols

For agents

$ claude mcp add CompoundLayout \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact