Skip to content

Latest commit

 

History

History
162 lines (115 loc) · 6.46 KB

README.md

File metadata and controls

162 lines (115 loc) · 6.46 KB

banner

NiftySliderVersion License APIView documentation | 中文

Getting Started

  1. Maven library dependency
dependencies {
    implementation 'io.github.litao0621:nifty-slider:(latest version)'
    // Added effect for Sliders (Optional Features)
    implementation 'io.github.litao0621:nifty-slider-effect:(latest version)'
}
  1. Add it to the layout file
    <com.litao.slider.NiftySlider
        android:id="@+id/nifty_slider"
        android:layout_width="match_parent"
        android:layout_height="148dp"
        android:padding="16dp"
        android:value="50"
        android:valueFrom="0"
        android:valueTo="100"
        app:trackColor="@color/m3_demo_track_color"
        app:trackColorInactive="@color/m3_demo_track_inactive_color"
        app:thumbColor="@color/m3_demo_thumb_color"
        app:thumbShadowColor="@color/white"
        app:haloColor="@color/m3_demo_halo_color"/>

View more attributes

  1. Registers a callback to be invoked when the slider changes
        binding.niftySlider.setOnValueChangeListener { slider, value, fromUser ->
            //do something with float value
        }
        binding.niftySlider.setOnIntValueChangeListener { slider, value, fromUser ->
            //do something with int value
        }
        binding.niftySlider.setOnSliderTouchListener(object :NiftySlider.OnSliderTouchListener{
            override fun onStartTrackingTouch(slider: NiftySlider) {
                //do something on touch start
            }
            override fun onStopTrackingTouch(slider: NiftySlider) {
                //do something on touch stop
            }
        })

Custom Effects

1. M3 Style

View Sample

2. WeRead Style

View Sample

3. Color Pick Style

View Sample

4. Custom Thumb Drawable Style

View Sample

5. Lottie Animation style

View Sample

6. Tiktok Style

View Sample

7. BiliBili Style

View Sample

8. YouTube video preview style

View Sample

9. YouTube graph style

View Sample

10. Effect with issues #13

View Sample

11. Vertical Mode

View Sample

Contributing

You are welcome to send push requests (Just remember to add you name to the contributers list) or raise issues

Donate

If you feel this library has helped you, you can click the Star button to support the author. You can also buy the author a cup of coffee.Thanks very much.:smiley:

DEMO

Demo APK download

License

Copyright 2023 litao

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.