https://github.com/hantrungkien/bubble-picker
An easy-to-use animation which can be used for content picking for Android
https://github.com/hantrungkien/bubble-picker
android-bubble bubble bubble-layout bubble-picker
Last synced: over 1 year ago
JSON representation
An easy-to-use animation which can be used for content picking for Android
- Host: GitHub
- URL: https://github.com/hantrungkien/bubble-picker
- Owner: hantrungkien
- License: apache-2.0
- Created: 2018-07-19T09:22:27.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2018-09-05T09:37:35.000Z (almost 8 years ago)
- Last Synced: 2025-03-26T11:21:16.396Z (over 1 year ago)
- Topics: android-bubble, bubble, bubble-layout, bubble-picker
- Language: Kotlin
- Homepage:
- Size: 13.8 MB
- Stars: 25
- Watchers: 1
- Forks: 9
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Bubble-Picker
[](https://opensource.org/licenses/Apache-2.0)
[](http://developer.android.com/index.html)
[](https://jitpack.io/#hantrungkien/Bubble-Picker)
Read how we did it [on Medium](https://medium.com/@igalata13/how-to-create-a-bubble-selection-animation-on-android-627044da4854#.ajonc010b)

## Requirements
- Android SDK 16+
## Usage
Add to your root build.gradle:
```Groovy
allprojects {
repositories {
...
maven { url "https://jitpack.io" }
}
}
```
Add the dependency:
```Groovy
dependencies {
implementation 'com.github.hantrungkien:Bubble-Picker:v1.0.5.2'
}
```
## How to use this library
This library was developed and extended based on https://github.com/igalata/Bubble-Picker
## Please review Activity in the Sample for both cases
- [Sync Data](https://github.com/hantrungkien/Bubble-Picker/blob/master/app/src/main/java/com/kienht/bubble_picker/SyncActivity.kt)
- [Async Data](https://github.com/hantrungkien/Bubble-Picker/blob/master/app/src/main/java/com/kienht/bubble_picker/AsyncActivity.kt)
## Now:
- We can set Picker Item selected always is true
```
picker.isAlwaysSelected = false
//or
mBubblePicker.setAlwaysSelected(true);
```
- We can set swipe move speed value (default = 1.5f)
```
picker.swipeMoveSpeed = 2f
//or
mBubblePicker.setSwipeMoveSpeed(2f);
```
- [Android-Universal-Image-Loader](https://github.com/nostra13/Android-Universal-Image-Loader): Load image from url
```
pickerItem.setIsUseImgUrl(true);
pickerItem.setImgUrl(...)
//use Drawable
pickerItem.setIsUseImgUrl(false);
pickerItem.setImgDrawable(...)
```
Add `BubblePicker` to your xml layout
```xml
```
Specify the `BubblePickerListener` to get notified about events
Kotlin
```kotlin
picker.listener = object : BubblePickerListener {
override fun onBubbleSelected(item: PickerItem) {
}
override fun onBubbleDeselected(item: PickerItem) {
}
}
```
Java
```java
picker.setListener(new BubblePickerListener() {
@Override
public void onBubbleSelected(@NotNull PickerItem item) {
}
@Override
public void onBubbleDeselected(@NotNull PickerItem item) {
}
});
```
To get all selected items use `picker.selectedItems` variable in Kotlin or `picker.getSelectedItems()` method in Java.
For more usage examples please review the sample app
## Thanks
A special thanks go to [Mr. Lopspower](https://github.com/igalata)
## Known iOS versions of the animation
* https://github.com/Ronnel/BubblePicker
* https://github.com/efremidze/Magnetic
## LICENCE
Copyright 2018 Kien Han Trung
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.