A UI slider widget for android

Related tags

Layout PodSLider
Overview

PodSlider


Android Arsenal Release Awesome

Sample:

Sample Gif Sample Gif

A slider view.

This project is an attempt to port the svg pod slider created by Chris Gannon to android. see CodePen

version 1.2.0 Update:

  • Major enhancements in how animations are done.
  • Added a ease out elastic effect(a wobble effect just before the circles stop).

Gradle:

Add it to your project build.gradle with:

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

and to your module's build.gradle dependencies block add the dependency to the library:

P.S Check Jitpack badge at the top of the readme for the latest version name.

dependencies {
    compile 'com.github.bhargavms:PodSLider:X.X.X'
}

Usage

Xml Attributes

app:mainSliderColor="@color/mainPodSlider" <!-- the color of the main rounded rectangular bar. -->
app:numberOfPods="2" <!-- the number of small circles (i.e pods) in the slider.-->
app:podColor="#4CAF50" <!-- the color of the pod when its not selected.-->
app:selectedPodColor="#fff" <!-- the color of the pod when its selected.-->

Setting a click listener

PodSlider podSlider = (PodSlider) findViewById(R.id.pod_slider);
podSlider.setPodClickListener(new OnPodClickListener() {
    @Override
    public void onPodClick(int position) {
        Log.d("PodPosition", "position = " + position);
    }
});

To set Currently selected Pod

podSlider.setCurrentlySelectedPod(1);
// if you want to change selected pod and also animate
// then use the below method, But please remember to use this only after
// the view has been rendered (i.e donot use this in onCreate()/onCreateView()
// this will cause the large and medium circle to be drawn at (0, height/2)
podSlider.setcurrentlySelectedPodAndAnimate(1);

To set up with a ViewPager

By default, the widget uses the String returned by the viewpager adapter's getPageTitle(int) method, to disable it just set pager.usePageTitle(false) as false, before setting up with viewPager

ViewPager pager = (ViewPager) findViewById(R.id.pager);
PodSlider pagerSlider = (PodSlider) findViewById(R.id.pager_slider);
PodPagerAdapter adapter = new PodPagerAdapter(getSupportFragmentManager());
pager.setAdapter(adapter);
pagerSlider.setUpWithViewPager(pager);

To change the number of pods programatically

podSlider.setNumberOfPods(4);

To set custom text

// Use this after setting number of pods and make sure the length of texts 
// array is equal to or greater than `numberOfPods` that you set using `setNumberOfPods()`
podSlider.setPodTexts(new String[]{"A", "B", "C", "D", "E", "F", "G", "H", "I", "J"});

(ideally use single character don't ever have texts with more than 1 char looks ugly)

To set Drawables

Drawable access = getResources().getDrawable(R.drawable.ic_accessibility_black_24dp);
Drawable account = getResources().getDrawable(R.drawable.ic_account_circle_black_24dp);
Drawable car = getResources().getDrawable(R.drawable.ic_directions_car_black_24dp);
// Use this after setting number of pods and make sure the length 
// of drawables array is equal to or greater than `numberOfPods`
// that you set using `setNumberOfPods()`
podSlider.setPodDrawables(
        new Drawable[]{
                access, account, car,
                access, account, car,
                access, account, car,
                access
        }, PodSlider.DrawableSize.FIT_POD_CIRCLE
);

I have not added (and do not plan to in the near future) support for passing in drawable resource Ids, loading the drawable from resource/creating it from bitmaps or whatever is left to you, if you want further customization on deciding the size of the drawable please open an issue, based on the amount of traction it receives I might decide to implement it.

LICENSE: (Apache 2.0)

Copyright [2016] [Bhargav M S]

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.
You might also like...
A very simple arc layout library for Android
A very simple arc layout library for Android

ArcLayout A very simple arc layout library for Android. Try out the sample application on the Play Store. Usage (For a working implementation of this

Android layout that simulates physics using JBox2D
Android layout that simulates physics using JBox2D

PhysicsLayout Android layout that simulates physics using JBox2D. Simply add views, enable physics, and watch them fall! See it in action with the sam

Android component which presents a dismissible view from the bottom of the screen
Android component which presents a dismissible view from the bottom of the screen

BottomSheet BottomSheet is an Android component which presents a dismissible view from the bottom of the screen. BottomSheet can be a useful replaceme

This library provides a simple way to add a draggable sliding up panel (popularized by Google Music and Google Maps) to your Android application. Brought to you by Umano.
This library provides a simple way to add a draggable sliding up panel (popularized by Google Music and Google Maps) to your Android application. Brought to you by Umano.

Note: we are not actively responding to issues right now. If you find a bug, please submit a PR. Android Sliding Up Panel This library provides a simp

Allows the easy creation of animated transition effects when the state of Android UI has changed
Allows the easy creation of animated transition effects when the state of Android UI has changed

android-transition Android-Transition allows the easy creation of view transitions that reacts to user inputs. The library is designed to be general e

Stale Android Toasts made tasty.
Stale Android Toasts made tasty.

FrenchToast Stale Android Toasts made tasty. Android Toasts are amazing, but they have a few major drawbacks: You cannot control when they show up as

waveview for android
waveview for android

中文介绍 WaveView A view to display wave effect. Screenshot Integration implementation 'com.gelitenight.waveview:waveview:1.0.0' Setter methods: setWaveS

An Android demo of a foldable layout implementation. Engineered by Vincent Brison.
An Android demo of a foldable layout implementation. Engineered by Vincent Brison.

Foldable Layout This code is a showcase of a foldable animation I created for Worldline. The code is fully written with java APIs from the Android SDK

Flexbox for Android
Flexbox for Android

FlexboxLayout FlexboxLayout is a library project which brings the similar capabilities of CSS Flexible Box Layout Module to Android. Installation Add

Releases(1.2.0)
  • 1.2.0(Jul 19, 2016)

  • 1.1.6(Jul 15, 2016)

    • Added support for custom text via the setPodTexts(String[] texts) method. Use this after setting number of pods and make sure the length of texts array is equal to or greater than numberOfPods
      • By default the numbering in the pods start from 1.
      • Added support for passing in drawables via the setPodDrawables(Drawables[] drawables) method. Use this after setting number of pods and make sure the length of drawables array is equal to or greater than numberOfPods
      • Also you can specify 3 sizes for the drawables i.e FIT_POD_CIRCLE FIT_MEDIUM_CIRCLE FIT_LARGE_CIRCLE
      • For code examples look below
    Source code(tar.gz)
    Source code(zip)
    library-unspecified.aar(40.54 KB)
  • 1.1.5(Jul 5, 2016)

  • 1.1.4(Jul 5, 2016)

  • 1.1.3(Jul 5, 2016)

    • Fixed a bug where, if you set the number of pods (with view width wrap_content) after onMeasure for the view is called, the slider wasn't expanding based on the number of pods.
    • Changed the min sdk version of the library from 16 to 11.
    Source code(tar.gz)
    Source code(zip)
  • 1.1.2(Jul 4, 2016)

  • 1.1.1(Jul 4, 2016)

Owner
Bhargav Mogra
Passionate coder, with a love for beautiful UI
Bhargav Mogra
Android library used to create an awesome Android UI based on a draggable element similar to the last YouTube graphic component.

Draggable Panel DEPRECATED. This project is not maintained anymore. Draggable Panel is an Android library created to build a draggable user interface

Pedro Vicente Gómez Sánchez 3k Jan 5, 2023
Bubbles for Android is an Android library to provide chat heads capabilities on your apps. With a fast way to integrate with your development.

Bubbles for Android Bubbles for Android is an Android library to provide chat heads capabilities on your apps. With a fast way to integrate with your

Txus Ballesteros 1.5k Jan 2, 2023
Android library used to create an awesome Android UI based on a draggable element similar to the last YouTube New graphic component.

Please switch to DragView, for the best support, thank you DraggablePanel Download allprojects { repositories { ... maven { url 'https://jitp

Hoàng Anh Tuấn 103 Oct 12, 2022
FixedHeaderTableLayout is a powerful Android library for displaying complex data structures and rendering tabular data composed of rows, columns and cells with scrolling and zooming features. FixedHeaderTableLayout is similar in construction and use as to Android's TableLayout

FixedHeaderTableLayout is a powerful Android library for displaying complex data structures and rendering tabular data composed of rows, columns and cells with scrolling and zooming features. FixedHeaderTableLayout is similar in construction and use as to Android's TableLayout

null 33 Dec 8, 2022
A wave view of android,can be used as progress bar.

WaveView ![Gitter](https://badges.gitter.im/Join Chat.svg) A wave view of android,can be used as progress bar. Screenshot APK demo.apk What can be use

Kai Wang 1.3k Dec 28, 2022
An Android Layout which has a same function like https://github.com/romaonthego/RESideMenu

ResideLayout An Android Layout which has a same function like https://github.com/romaonthego/RESideMenu. Can be used on Android 1.6(I haven't try it.)

Yang Hui 392 Oct 12, 2022
An Android library that help you to build app with swipe back gesture.

SwipeBackLayout An Android library that help you to build app with swipe back gesture. Demo Apk GooglePlay Requirement The latest android-support-v4.j

ike_w0ng 6.1k Dec 29, 2022
TileView is a subclass of android.view.ViewGroup that asynchronously displays, pans and zooms tile-based images. Plugins are available for features like markers, hotspots, and path drawing.

This project isn't maintained anymore. It is now recommended to use https://github.com/peterLaurence/MapView. MapView is maintained by Peter, one of o

Mike Dunn 1.5k Nov 21, 2022
Ultra Pull to Refresh for Android. Support all the views.

Welcome to follow me on GitHub or Twitter GitHub: https://github.com/liaohuqiu Twitter: https://twitter.com/liaohuqiu 中文版文档 Wanna auto-load-more? This

Huqiu Liao 9.6k Jan 5, 2023
SwipeBack is an android library that can finish a activity by using gesture.

SwipeBack SwipeBack is a android library that can finish a activity by using gesture. You can set the swipe direction,such as left,top,right and botto

Eric 1.7k Nov 21, 2022