All Projects → MAXDeliveryNG → Slideview

MAXDeliveryNG / Slideview

Licence: mit
An awesome sliding button library for Android.

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to Slideview

Vue Flux
Image slider which comes with 20 cool transitions
Stars: ✭ 359 (-47.44%)
Mutual labels:  slider
Before after
A flutter package which makes it easier to display the difference between two images.
Stars: ✭ 453 (-33.67%)
Mutual labels:  slider
React Compound Slider
◾️ React Compound Slider | A small React slider with no opinion on markup or styles
Stars: ✭ 553 (-19.03%)
Mutual labels:  slider
Tiny Slider
Vanilla javascript slider for all purposes.
Stars: ✭ 4,298 (+529.28%)
Mutual labels:  slider
Vue Slick Carousel
🚥Vue Slick Carousel with True SSR Written for ⚡Faster Luxstay
Stars: ✭ 447 (-34.55%)
Mutual labels:  slider
Banner Slider
Banner slider is an easy to use library for implement image sliders in android apps.
Stars: ✭ 482 (-29.43%)
Mutual labels:  slider
Discreteslider
A slider (SeekBar) with amazing value label.
Stars: ✭ 351 (-48.61%)
Mutual labels:  slider
React Native Onboarding Swiper
🛳 Delightful onboarding for your React-Native app
Stars: ✭ 596 (-12.74%)
Mutual labels:  slider
Bxslider 4
Responsive jQuery content slider
Stars: ✭ 4,208 (+516.11%)
Mutual labels:  slider
Vue Swiper
✅ 轻量、高性能轮播插件。目前支持 无缝衔接自动轮播、无限轮播、手势轮播
Stars: ✭ 548 (-19.77%)
Mutual labels:  slider
Vue Gallery
📷 Responsive and customizable image and video gallery, carousel and lightbox, optimized for both mobile and desktop web browsers.
Stars: ✭ 405 (-40.7%)
Mutual labels:  slider
Islider
如丝般高性能H5全屏滑动组件
Stars: ✭ 444 (-34.99%)
Mutual labels:  slider
React Range
🎚️Range input with a slider. Accessible. Bring your own styles and markup.
Stars: ✭ 545 (-20.2%)
Mutual labels:  slider
Stepslider
StepSlider its custom implementation of slider such as UISlider for preset integer values.
Stars: ✭ 391 (-42.75%)
Mutual labels:  slider
Hooper
🎠 A customizable accessible carousel slider optimized for Vue
Stars: ✭ 561 (-17.86%)
Mutual labels:  slider
React Smooth Range Input
🎚 React beautiful input range slider
Stars: ✭ 356 (-47.88%)
Mutual labels:  slider
Flutter Intro Slider
Simple and configurable app introduction slider for Flutter
Stars: ✭ 461 (-32.5%)
Mutual labels:  slider
React Slider
Accessible, CSS agnostic, slider component for React.
Stars: ✭ 627 (-8.2%)
Mutual labels:  slider
Simple Slider
🎠 The 1kb JavaScript Carousel
Stars: ✭ 583 (-14.64%)
Mutual labels:  slider
Emojislider
🤯 A slider widget rich in emoji and highly customisable.
Stars: ✭ 549 (-19.62%)
Mutual labels:  slider

SlideView

A simple, yet awesome sliding button for Android.

CircleCI JitPack Android Arsenal License Min SDK

Preview

SlideView SlideView2

Get the sample apk here

Setup

Gradle

Add this to your project level build.gradle:

allprojects {
 repositories {
    jcenter()
    maven { url "https://jitpack.io" }
 }
}

Add this to your app build.gradle:

dependencies {
	implementation 'com.github.MAXDeliveryNG:slideview:1.1.0'
}

Usage

The SlideView is very easy to use. Just add it to your layout like any other view.

From version 1.1.0, all SlideView's attributes are prefixed "sv_", this is to avoid conflicting with attributes in other libraries or attributes defined by users.

Via XML

Here's a basic implementation.

 <ng.max.slideview.SlideView
        android:id="@+id/slideView"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        app:sv_buttonBackgroundColor="@color/button_bg_color"
        app:sv_buttonImage="@drawable/button_img"
        app:sv_slideBackgroundColor="@color/slide_bg_color"
        app:sv_slideText="@string/slide_text"
        app:sv_slideTextColor="@color/slide_text_color" />

Here's an example with all the view attributes.

<ng.max.slideview.SlideView
        android:id="@+id/slideView"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        app:sv_buttonBackgroundColor="@color/button_bg_color"
        app:sv_buttonImage="@drawable/button_img"
        app:sv_slideBackgroundColor="@color/slide_bg_color"
        app:sv_slideText="@string/slide_text"
        app:sv_slideTextColor="@color/slide_text_color"
        app:sv_slideTextSize="16sp"
        app:sv_animateSlideText="true"
        app:sv_reverseSlide="false"
        app:sv_strokeColor="@color/slide_stroke_color"
        app:sv_buttonImageDisabled="@drawable/button_img_disabled" />

Attributes information

Attribute name Description Default value
slideBackgroundColor The slide background color #3F51B5
buttonBackgroundColor The slide button background color #FFFFFF
slideTextColor The color of the slide label #FFFFFF
buttonImage The drawable on the button double chevron icon
slideText The slide label none
slideTextSize The label's size 16sp
animateSlideText If true, the label fades out while the slide is in progress true
strokeColor If set, a stroke is drawn around the slide background none
reverseSlide If true, the SlideView is reversed false
buttonImageDisabled The drawable to be used as the button image when the SlideView is disabled the default drawable

Note: All color attributes can be replaced with a ColorStateList so the SlideView can use the appropriate colors for the enabled and disabled states. See the sample module for examples.

Listening for slide actions on the SlideView

You can set a listener to be notified when the user slides across the SlideView. An example is shown below.

SlideView slideView = (SlideView) findViewById(R.id.slideView);
slideView.setOnSlideCompleteListener(new SlideView.OnSlideCompleteListener() {
            @Override
            public void onSlideComplete(SlideView slideView) {
                // vibrate the device
                Vibrator vibrator = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE);
                vibrator.vibrate(100);

                // go to a new activity
                startActivity(new Intent(MainActivity.this, NewActivity.class));
            }
        });

Setting the view attributes via code

For convenience, many of the SlideView attributes can be set via code.

 // set the label
 setText(CharSequence text); 
 
 // set the text size
 setTextSize(int size);
 
 // set the drawable for the button
 setButtonImage(Drawable image);
 
 // set the label color
 setTextColor(@ColorInt int color) ;
 
 // set the label color with a ColorStateList
 setTextColor(ColorStateList colors);
 
 // set the button drawable for disabled state
 setButtonImageDisabled(Drawable image);
 
 // set the button background color
 setButtonBackgroundColor(ColorStateList color);
 
 // set the slide background color
 setSlideBackgroundColor(ColorStateList color);
 

Note: for the methods that take a ColorStateList, you can easily use a single color by converting it to a ColorStateList with the method ColorStateList.valueOf(int color);

Caveat

The view height is currently fixed so you should use wrap_content when defining the view height in your layout.

Author

Kizito Nwose

Contributing

If you find any bugs, please feel free to fix it and send a pull request or open an issue.

License

Copyright (c) 2017 MAXDeliveryNG

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].