You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+6-4Lines changed: 6 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,10 +9,12 @@ A container of toggle buttons, supports multiple / single selection and button c
9
9
10
10
```
11
11
dependencies {
12
-
compile 'com.nex3z:toggle-button-group:0.2.3'
12
+
compile 'com.nex3z:toggle-button-group:1.0.0'
13
13
}
14
14
```
15
15
16
+
There has been a lot of changes since the 1.0.0 version, old versions can be found in the [release page](https://github.com/nex3z/ToggleButtonGroup/releases).
You can implement custom toggle button in two ways,
141
143
142
-
- Implement [ToggleButton](https://github.com/nex3z/ToggleButtonGroup/blob/master/togglebuttongroup/src/main/java/com/nex3z/togglebuttongroup/button/ToggleButton.java) interface, as [CustomToggleButton](https://github.com/nex3z/ToggleButtonGroup/blob/master/sample/src/main/java/com/nex3z/togglebuttongroup/sample/CustomToggleButton.java) in the sample, or
144
+
- Implement [`ToggleButton`](https://github.com/nex3z/ToggleButtonGroup/blob/master/togglebuttongroup/src/main/java/com/nex3z/togglebuttongroup/button/ToggleButton.java) interface, as [`CustomToggleButton`](https://github.com/nex3z/ToggleButtonGroup/blob/master/sample/src/main/java/com/nex3z/togglebuttongroup/sample/CustomToggleButton.java) in the sample, or
143
145
144
-
- Extend [CompoundToggleButton](https://github.com/nex3z/ToggleButtonGroup/blob/master/togglebuttongroup/src/main/java/com/nex3z/togglebuttongroup/button/CompoundToggleButton.java) class, like [CustomCompoundToggleButton](https://github.com/nex3z/ToggleButtonGroup/blob/master/sample/src/main/java/com/nex3z/togglebuttongroup/sample/CustomCompoundToggleButton.java).
146
+
- Extend [`CompoundToggleButton`](https://github.com/nex3z/ToggleButtonGroup/blob/master/togglebuttongroup/src/main/java/com/nex3z/togglebuttongroup/button/CompoundToggleButton.java) class, like [`CustomCompoundToggleButton`](https://github.com/nex3z/ToggleButtonGroup/blob/master/sample/src/main/java/com/nex3z/togglebuttongroup/sample/CustomCompoundToggleButton.java).
145
147
146
-
If you choose to implement `ToggleButton`, besides the [Checkable](https://developer.android.com/reference/android/widget/Checkable.html) interface, you also need to implement the `setOnCheckedChangeListener()`, which allows [ToggleButtonGroup](https://github.com/nex3z/ToggleButtonGroup/blob/master/togglebuttongroup/src/main/java/com/nex3z/togglebuttongroup/ToggleButtonGroup.java) to listen to changes of any checked states. You need to handle the click event on the button and toggle its checked state properly, as `ToggleButtonGroup` will not toggle the button when it's being clicked.
148
+
If you choose to implement `ToggleButton`, besides the [`Checkable`](https://developer.android.com/reference/android/widget/Checkable.html) interface, you also need to implement the `setOnCheckedChangeListener()`, which allows [`ToggleButtonGroup`](https://github.com/nex3z/ToggleButtonGroup/blob/master/togglebuttongroup/src/main/java/com/nex3z/togglebuttongroup/ToggleButtonGroup.java) to listen to changes of any checked states. You need to handle the click event on the button and toggle its checked state properly, as `ToggleButtonGroup` will not toggle the button when it's being clicked.
147
149
148
150
`CompoundToggleButton` implements `ToggleButton` and notifies `ToggleButtonGroup` of any checked state changes. But you still need to handle the click event on the button, as `CompoundToggleButton` wouldn't know which part of it should trigger the "toggle" operation. Add an `OnClickListener` on the "trigger view" and call `toggle()` is just enough.
0 commit comments