Skip to content

Repository files navigation

Demo Preview

Usage

Step 1. Add the JitPack repository to your build file

allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}

Step 2. Add the dependency

dependencies {
compile 'com.github.BangBangArmy:TabSwitchHelper:0.0.8'
}

Step 3. like shown below

TabSwitchHelpertabSwitchHelper = newTabSwitchHelper();
//init method is deprecatedtabSwitchHelper.add(this, R.id.rb_1, R.id.rb_2, R.id.rb_3, R.id.rb_4);
tabSwitchHelper.checked(R.id.rb_1);
tabSwitchHelper.setListener(newTabSwitchHelper.OnTabStateChangedListener() {
@OverridepublicvoidafterTabStateChanged(CompoundButtonbutton, booleanisChecked) {
Toast.makeText(MainActivity.this, button.getText(), Toast.LENGTH_SHORT).show();
}
@OverridepublicbooleanbeforeTabStateChanged(CompoundButtonbutton, booleanisChecked) {
if (button.getId() == R.id.rb_4) {
Toast.makeText(MainActivity.this, "event was intercepted", Toast.LENGTH_SHORT).show();
returntrue;
}
returnfalse;
}
});

License

MIT

About

Easily switch different view layer of the state of the CompoundButton.

Topics

Resources

Stars

1 star

Watchers

2 watching

Forks

Releases

Packages

Contributors

Languages