Step 1. Add the JitPack repository to your build file
Add it in your root settings.gradle at the end of repositories:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
mavenCentral()
maven { url 'https://jitpack.io' }
}
}
Add it in your settings.gradle.kts at the end of repositories:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
mavenCentral()
maven { url = uri("https://jitpack.io") }
}
}
Add to pom.xml
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
Add it in your build.sbt at the end of resolvers:
resolvers += "jitpack" at "https://jitpack.io"
Add it in your project.clj at the end of repositories:
:repositories [["jitpack" "https://jitpack.io"]]
Step 2. Add the dependency
dependencies {
implementation 'com.github.ceryle:radiorealbutton:v1.4.9'
}
dependencies {
implementation("com.github.ceryle:radiorealbutton:v1.4.9")
}
<dependency>
<groupId>com.github.ceryle</groupId>
<artifactId>radiorealbutton</artifactId>
<version>v1.4.9</version>
</dependency>
libraryDependencies += "com.github.ceryle" % "radiorealbutton" % "v1.4.9"
:dependencies [[com.github.ceryle/radiorealbutton "v1.4.9"]]
I stopped developing this library for a long time ago. I thought about revising it recently but I think there is no need for it anymore due to Jetpack Compose. As an alternative to this, I recommend you to use this library made with Jetpack Compose by Zack Klippenstein: https://gist.github.com/zach-klippenstein/7ae8874db304f957d6bb91263e292117
Thank you all for your support.

Radio Real Button is a substitute of the Radio Button. Its purpose is to give more elegant view for Android users.
<br />
<br />
<br />
<br />
<br />

Add it to your build.gradle with:
allprojects {
repositories {
maven { url "https://jitpack.io" }
}
}
and:
dependencies {
compile 'com.github.ceryle:RadioRealButton:v2.1.1'
}
Default scaling value is now 1 as it has to be.
| Option Name | Format | Description |
| ----------------- | ----------- | --------------------------------------------------------- |
| drawable | integer | set drawable to button |
| drawablePadding | dimension | set padding between text and drawable |
| drawableTint | color | set drawable tint by giving a color code or reference |
| drawableWidth | dimension | change drawable's width |
| drawableHeight | dimension | change drawable's height |
| drawableGravity | integer | set drawable position relative to text |
| text | string | set button's text |
| textColor | color | change button's text color |
| textSize | dimension | change button's text size |
| textTypeface | integer | default typefaces offered by android itself |
| textTypefacePath | string | give your typeface by giving its path |
| textFillSpace | boolean | when enabled, it pushes drawable to edges of the button |
| textStyle | integer | default styles offered by android itself |
| textGravity | integer | give text gravity(not layout_gravity) |
| ripple | boolean | set it true for default ripple |
| rippleColor | color | give any color to achieve colorful ripples |
| backgroundColor | color | give background color by giving a color code or reference |
| checked | boolean | its usage is the same as radio button |
| Option Name | Format | Description |
| ------------------------- | ----------- | ----------------------------- |
| radius | integer | set radius to make radio real button group rounder |
| borderSize | dimension | adds border to group with the given size |
| borderColor | dimension | changes border color |
| backgroundColor | color | give background color by giving a color code or reference |
| enableDeselection | color | enable deselection to un-check a button |
| dividerSize | dimension | set divider size for the line between buttons |
| dividerPadding | dimension | gives padding to divider's top and bottom |
| dividerColor | color | give color code or reference |
| dividerRadius | dimension | give dimension to make divider's corners rounder |
| selectorDividerSize | dimension | set selector divider size for the line between buttons |
| selectorDividerPadding | dimension | gives padding to selector divider's top and bottom |
| selectorDividerColor | color | give color code or reference |
| selectorDividerRadius | dimension | give dimension to make selector divider's corners rounder |
| bottomLineColor | color | set bottom line color |
| bottomLineSize | dimension | set bottom line height |
| bottomLineBringToFront | boolean | if it is true, it brings bottomLine on top of selector |
| bottomLineRadius | dimension | give dimension to make bottomLine's corners rounder |
| selectorTop | boolean | align selector to top |
| selectorBottom | boolean | align selector to bottom |
| selectorColor | color | set color of selector |
| selectorSize | dimension | set height of selector |
| selectorRadius | dimension | give dimension to make selector's corners rounder |
| selectorBringToFront | boolean | if it is true, it brings selector on top of everything |
| selectorAboveOfBottomLine | boolean | if it is true, it brings selector above of bottom line |
| selectorFullSize | boolean | selector fills space up to button's height |
| checkedPosition | integer | check a button by a position number |
| checkedButton | reference | check a button by button's unique id |
| animate | boolean | set animation on bottom moving view |
| animateSelector | integer | gives interpolator to selector |
| animateSelector_delay | integer | gives delay to selector's animation when it enters |
| animateSelector_duration | integer | animation duration of selector in ms |
| animateDrawables_scale | float | adjust drawable's size when it is checked |
| animateDrawables_enter | integer | enter animation on drawable when button is checked |
| animateDrawables_enterDuration | integer | enter animation duration of drawable in ms |
| animateDrawables_exit | integer | exit animation on drawable when other button is checked |
| animateDrawables_exitDuration | integer | exit animation duration of drawable in ms |
| animateTexts_scale | float | adjust text's size when it is checked |
| animateTexts_enter | integer | enter animation on text when button is checked |
| animateTexts_enterDuration | integer | enter animation duration of text in ms |
| animateTexts_exit | integer | exit animation on text when other button is checked |
| animateTexts_exitDuration | integer | exit animation duration of text in ms |
| animateDrawables_tintColorFrom | color | initial color for drawable's tint color transition animation |
| animateDrawables_tintColorTo | color | final color for drawable's tint color transition animation |
| animateDrawables_tintColor_duration | integer | total animation duration of drawable's tint transition in ms |
| animateTexts_textColorFrom | color | initial color for text's text color transition animation |
| animateTexts_textColorTo | color | final color for text's text color transition animation |
| animateTexts_textColor_duration | integer | total animation duration of text's text color in ms |
<co.ceryle.radiorealbutton.RadioRealButtonGroup
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:rrbg_animateDrawables_enter="overshoot"
app:rrbg_animateTexts_enter="overshoot"
app:rrbg_dividerColor="@color/black"
app:rrbg_dividerSize="1dp"
app:rrbg_radius="10dp"
app:rrbg_selectorColor="@color/red_700"
app:rrbg_selectorSize="6dp">
<co.ceryle.radiorealbutton.RadioRealButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:rrb_drawable="@mipmap/ic_launcher"
app:rrb_drawableHeight="36dp"
app:rrb_drawablePadding="8dp"
app:rrb_drawableWidth="36dp"
app:rrb_ripple="true"
app:rrb_rippleColor="@color/black"
app:rrb_text="Button 1"
app:rrb_textColor="@color/black"/>
<co.ceryle.radiorealbutton.RadioRealButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:rrb_drawable="@mipmap/ic_launcher"
app:rrb_drawableGravity="right"
app:rrb_drawableHeight="36dp"
app:rrb_drawablePadding="8dp"
app:rrb_drawableWidth="36dp"
app:rrb_ripple="true"
app:rrb_rippleColor="@color/black"
app:rrb_text="Button 2"
app:rrb_textColor="@color/black"/>
</co.ceryle.radiorealbutton.RadioRealButtonGroup>
final RadioRealButton button1 = (RadioRealButton) findViewById(R.id.button1);
final RadioRealButton button2 = (RadioRealButton) findViewById(R.id.button2);
RadioRealButtonGroup group = (RadioRealButtonGroup) findViewById(R.id.group);
// onClickButton listener detects any click performed on buttons by touch
group.setOnClickedButtonListener(new RadioRealButtonGroup.OnClickedButtonListener() {
@Override
public void onClickedButton(RadioRealButton button, int position) {
Toast.makeText(MainActivity.this, "Clicked! Position: " + position, Toast.LENGTH_SHORT).show();
}
});
// onPositionChanged listener detects if there is any change in position
group.setOnPositionChangedListener(new RadioRealButtonGroup.OnPositionChangedListener() {
@Override
public void onPositionChanged(RadioRealButton button, int position) {
Toast.makeText(MainActivity.this, "Position Changed! Position: " + position, Toast.LENGTH_SHORT).show();
}
});
// onLongClickedButton detects long clicks which are made on any button in group.
// return true if you only want to detect long click, nothing else
// return false if you want to detect long click and change position when you release
group.setOnLongClickedButtonListener(new RadioRealButtonGroup.OnLongClickedButtonListener() {
@Override
public boolean onLongClickedButton(RadioRealButton button, int position) {
Toast.makeText(MainActivity.this, "Long Clicked! Position: " + position, Toast.LENGTH_SHORT).show();
return false;
}
});
This project is licensed under the Apache License Version 2.0 - see the LICENSE.md file for details