Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ramotion/fluid-slider-android
:octocat:💧 A slider widget with a popup bubble displaying the precise value selected. Android library made by @Ramotion
https://github.com/ramotion/fluid-slider-android
android kotlin library
Last synced: 3 days ago
JSON representation
:octocat:💧 A slider widget with a popup bubble displaying the precise value selected. Android library made by @Ramotion
- Host: GitHub
- URL: https://github.com/ramotion/fluid-slider-android
- Owner: Ramotion
- License: mit
- Created: 2017-11-14T09:59:52.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2020-07-09T21:18:15.000Z (over 4 years ago)
- Last Synced: 2024-12-13T14:04:50.211Z (10 days ago)
- Topics: android, kotlin, library
- Language: Kotlin
- Homepage: https://www.ramotion.com/agency/app-development/
- Size: 7.15 MB
- Stars: 1,425
- Watchers: 38
- Forks: 147
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
FLUID SLIDER [KOTLIN]
A slider widget with a popup bubble displaying the precise value selected
___
We specialize in the designing and coding of custom UI for Mobile Apps and Websites.
Stay tuned for the latest updates:
Inspired by [Virgil Pana](https://dribbble.com/virgilpana) [shot](https://dribbble.com/shots/3868232-Fluid-Slider)
[![Twitter](https://img.shields.io/badge/[email protected]?style=flat)](http://twitter.com/Ramotion)
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/92bd2e49f7e543cd8748c670b9e52ca7)](https://www.codacy.com/app/dvg4000/fluid-slider-android?utm_source=github.com&utm_medium=referral&utm_content=Ramotion/fluid-slider-android&utm_campaign=Badge_Grade)
[![Donate](https://img.shields.io/badge/Donate-PayPal-blue.svg)](https://paypal.me/Ramotion)## Requirements
- Android 4.1 Jelly Bean (API lvl 16) or greater
- Your favorite IDE## Installation
​
Just download the package from [here](http://central.maven.org/maven2/com/ramotion/fluidslider/fluid-slider/0.3.1/fluid-slider-0.3.1.aar) and add it to your project classpath, or just use the maven repo:Gradle:
```groovy
implementation 'com.ramotion.fluidslider:fluid-slider:0.3.1'
```
SBT:
```scala
libraryDependencies += "com.ramotion.fluidslider" % "fluid-slider" % "0.3.1"
```
Maven:
```xmlcom.ramotion.fluidslider
fluid-slider
0.3.1
aar```
## Basic usage
Place the `FluidSlider` in your layout.
To track the current position of the slider, set the `positionListener`, as shown below:
```
val slider = findViewById(R.id.fluidSlider)
slider.positionListener = { p -> Log.d("MainActivity", "current position is: $p" )}
```You can also track the beginning and completion of the movement of the slider, using the following properties:
`beginTrackingListener` and` endTrackingListener`. Example below:
```
slider.beginTrackingListener = { /* action on slider touched */ }
slider.endTrackingListener = { /* action on slider released */ }
```Here is simple example, how to change `FluidSlider` range.
```kotlin
// Kotlin
val max = 45
val min = 10
val total = max - minval slider = findViewById(R.id.fluidSlider)
slider.positionListener = { pos -> slider.bubbleText = "${min + (total * pos).toInt()}" }
slider.position = 0.3f
slider.startText ="$min"
slider.endText = "$max"// Java
final FluidSlider slider = findViewById(R.id.fluidSlider);
slider.setBeginTrackingListener(new Function0() {
@Override
public Unit invoke() {
Log.d("D", "setBeginTrackingListener");
return Unit.INSTANCE;
}
});slider.setEndTrackingListener(new Function0() {
@Override
public Unit invoke() {
Log.d("D", "setEndTrackingListener");
return Unit.INSTANCE;
}
});// Or Java 8 lambda
slider.setPositionListener(pos -> {
final String value = String.valueOf( (int)((1 - pos) * 100) );
slider.setBubbleText(value);
return Unit.INSTANCE;
});
```Here are the attributes you can specify through XML or related setters:
* `bar_color` - Color of slider.
* `bubble_color` - Color of circle "bubble" inside bar.
* `bar_text_color` - Color of `start` and `end` texts of slider.
* `bubble_text_color` - Color of text inside "bubble".
* `start_text` - Start (left) text of slider.
* `end_text` - End (right) text of slider.
* `text_size` - Text size.
* `duration` - Duration of "bubble" rise in milliseconds.
* `initial_position` - Initial positon of "bubble" in range form `0.0` to `1.0`.
* `size` - Height of slider. Can be `small` (40dp) and `normal` (56dp).This library is a part of a selection of our best UI open-source projects.
## Third Party Bindings
### React Native
You may now use this library with [React Native](https://github.com/facebook/react-native) via the module [here](https://github.com/prscX/react-native-fluidic-slider)## 🗂 Check this library on other language:
## 📄 License
Fluid Slider Android is released under the MIT license.
See [LICENSE](./LICENSE) for details.This library is a part of a selection of our best UI open-source projects
If you use the open-source library in your project, please make sure to credit and backlink to www.ramotion.com
## 📱 Get the Showroom App for Android to give it a try
Try this UI component and more like this in our Android app. Contact us if interested.