lamphuong223/range-seekbar


Android slider widget for selecting a range of values.

Download


Step 1. Add the JitPack repository to your build file

Add it in your root settings.gradle at the end of repositories:

	dependencyResolutionManagement {
		repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
		repositories {
			mavenCentral()
			maven { url 'https://jitpack.io' }
		}
	}

Add it in your settings.gradle.kts at the end of repositories:

	dependencyResolutionManagement {
		repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
		repositories {
			mavenCentral()
			maven { url = uri("https://jitpack.io") }
		}
	}

Add to pom.xml

	<repositories>
		<repository>
		    <id>jitpack.io</id>
		    <url>https://jitpack.io</url>
		</repository>
	</repositories>

Add it in your build.sbt at the end of resolvers:

 
    resolvers += "jitpack" at "https://jitpack.io"
        
    

Add it in your project.clj at the end of repositories:

 
    :repositories [["jitpack" "https://jitpack.io"]]
        
    

Step 2. Add the dependency

	dependencies {
		implementation 'com.github.lamphuong223:range-seekbar:1.0.1'
	}
	dependencies {
		implementation("com.github.lamphuong223:range-seekbar:1.0.1")
	}
	<dependency>
	    <groupId>com.github.lamphuong223</groupId>
	    <artifactId>range-seekbar</artifactId>
	    <version>1.0.1</version>
	</dependency>

                            
    libraryDependencies += "com.github.lamphuong223" % "range-seekbar" % "1.0.1"
        
        

                            
    :dependencies [[com.github.lamphuong223/range-seekbar "1.0.1"]]
        
        

Readme


RangeSeekBar

A slider widget for Android allowing to set a minimum and maximum value on a numerical range.

Download

  • Add it in your root build.gradle at the end of repositories:
allprojects {
        repositories {
            ...
            maven { url "https://jitpack.io" }
        }
    }
  • Add the dependency in your module-level build.gradle
dependencies {
    compile 'com.github.lamphuong223:range-seekbar:1.0.1'
}

Usage

Layout XML

<com.lpphan.rangeseekbar.RangeSeekBar
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    app:tick_count="20"
    app:thumb_color="@color/colorAccent"
    app:thumb_normal_radius="6dp"
    app:thumb_pressed_radius="8dp"/>

Java code

RangeSeekBar seekBar = (RangeSeekBar) findViewById(R.id.seekBar);
seekBar.setTickCount(20);
seekBar.setThumbColor(Color.RED);
seekBar.setThumbNormalRadius(6f);
seekBar.setThumbPressedRadius(8f);
seekBar.setLeftIndex(0);
seekBar.setRightIndex(10);

Initial the RangeSeekBar and setup OnRangeSeekBarChangerListener

seekBar.setOnRangeBarChangeListener(new RangeSeekBar.OnRangeSeekBarChangerListener() {
    @Override
    public void onIndexChange(RangeSeekBar rangeBar, int leftIndex, int rightIndex) {
        Log.d(TAG, "leftIndex: " + leftIndex);
        Log.d(TAG, "rightIndex: " + rightIndex);
    }
});

XML attributes

        tick_count              format = interger   
        thumb_normal_radius     format=  dimen
        thumb_pressed_radius    format=  dimen
        left_index              format=  interger
        right_index             format=  interger
        thumb_color             format=  color

License

Copyright 2016 lamphuong223

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.