👍 1. Fix #103. Determin whether state change is triggered manully using
isPressedin OnCheckedChangeListener is supported. 🚚 2. Remove targetSdkVersion declaration.
- Upgrate compileSdkVersion to 29.
- 修复 #103。支持在OnCheckedChangeListener中使用
- Re-clarify the meaning of some params. ⚡️ 2. Update the measurement of SwitchButton and the logic becomes more clear, especially the text part. 👍 3. Support config SwitchButton's size by setting a exact width and height. There are now TWO mainly method to control it's size.
- 🛠 Fixed #65.
- ⚡️ Update text layout, tests looks like center.
- 🛠 Fixed #64. Respect to clickable and focusable attributes.
- Support #49. By default SwitchButton found accentColor of your theme for tintColor. (accentColor is used for controls according to Material Design guideline. )
- 🛠 fixed #49.
- 👌 Support operation without onCheckedChanged callback.
- Add text feature. You can set text for either checked or unchecked status with kswTextOn and kswTextOff attrs. And you can set the margin of text in horizontal direction using kswTextMarginH attr.
- For additional, you can set small icons now by using SpannableString with setText() method in code.
- Thanks @lpmfilho
- 🛠 Fix #40
- 🛠 Fix SwitchButtonMD style bug in RecyclerView and add page for test. Fix bug in setCheckedImmediately() in onCheckedChanged() method. *(setChecked in onChecked)**
- setClickable(boolean) support.
- Bug fix.
- ✂ Remove shadow of MD style to support under 5.0.
- Reconstructe the whole library.
- 🛠 Fix issue #22 by change the attributes' name to prevent conflict;
- 🛠 Fix issue #19.
- 🛠 Fix stretch bug while using higher API. *Add Gradle support. *Built in Android Studio.
- 🛠 Fix rendering bug on some devices. *Fix states bug.
- With calling the method setChecked(boolean, false);, you can change the status without invoking the listener.
- 🛠 Fix shrink bug in Android 5.0 (the problem is same like it is in Android 4.4, which has been fixed in 1.2.4). *More available to setup Material Design style SwitchButton using @style/MD in xml layout. *Fix Demo Project bug
- fix shrink bug(that will cause the content out of bounds not disapper, on Android 4.4)
- upload .pad resource, whitch I forgot to upload before.(My fault.)
- bug fix
- ⬆️ upgrade demo apk
- more clear way to use
Since the animation ran on sub thread, "toggle" and "setChecked" methods may mot execute as you wish what cause the checked status change immediately.
This problem may be solved, but I declared 2 methods to deal with the situation whether you want it happen immediately.
If you want to set the checked status immediately, just call setChecked(boolean checked); method like CheckBox. And slideToChecked(boolean checked); method for slow one with slide animation.
When toggle, call toggle(); with change the status immediately and toggle(false); for slow one.
- ➕ Add StateList support for all resources and enable/disable, pressed has been tested in Demo.
- New Style with Material Design, preview below.
- ➕ Add "shrink" feature. This makes you can draw your image resources out size the view bounds, in the other word, shrink the size of view and make the experience stay the same.
🆕 New Style with Material Design:
To use shrink feature, you can easily add these attributes in your xml file. It is recommended that set these values positive.
- insetLeft: left size for shrinking
- insetRight: right size for shrinking
- insetTop: top size for shrinking
- insetBottom: bottom size for shrinking
- 🛠 Fix lots of bugs.
- 💅 Change the default style
- ➕ Add iOS7 style, you can just use like how the demo did
- ⚡️ Update demo, it becomes more convenient, effective and beautiful
- ➕ Add new attribute: measureFactor, you can custom the factor between width and height now. It is convenient to config the rest space of background. Learn more in the demo.
- 💅 Update the logic of thumbMargin, it can work well with negative margins now (iOS style just using this trick).
🆕 new default style and demo apk looks like this:
➕ Add an attr of radius, now you can change the radius when configure the button's face!