Stepper Touch for Android based on MaterialUp submission
Switch branches/tags
Clone or download
DanielMartinus Merge pull request #16 from JavaCafe01/master
Added a quick example for Java
Latest commit 252f99b May 18, 2018
Permalink
Failed to load latest commit information.
app Update version name Jul 14, 2017
gradle/wrapper Init commit Mar 19, 2017
library Update version name Jul 14, 2017
media Update README.md and add play store url Mar 20, 2017
.gitignore ignore idea folder Mar 19, 2017
LICENSE Initial commit Mar 19, 2017
README.md Change titles May 18, 2018
build.gradle Update gradle Apr 29, 2017
gradle.properties Init commit Mar 19, 2017
gradlew Init commit Mar 19, 2017
gradlew.bat Init commit Mar 19, 2017
settings.gradle Init commit Mar 19, 2017

README.md

Stepper-Touch

Twitter API Awesome Kotlin Badge

Stepper Touch for Android based on a Material Up showcase designed by Oleg Frolov

In the latest version of the support library (25.3.0) a new class SpringAnimation was made available. I wanted to test this out and not long after that I found Stepper Touch, a concept made in FramerJS, on Material Up. I took this oppertunity to play with SpringAnimations.

Try it yourself:

Gradle

  • Step 1. Add the JitPack repository to your build file
allprojects {
    repositories {
        ...
        maven { url 'https://jitpack.io' }
    }
}
  • Step 2. Add the dependency
dependencies {
	compile 'com.github.DanielMartinus:Stepper-Touch:0.6'
}

Implement

<nl.dionsegijn.steppertouch.StepperTouch
        android:id="@+id/stepperTouch"
        android:layout_width="100dp"
        android:layout_height="40dp" />

Kotlin

val stepperTouch = findViewById(R.id.stepperTouch) as StepperTouch
stepperTouch.stepper.setMin(0)
stepperTouch.stepper.setMax(3)
stepperTouch.stepper.addStepCallback(object : OnStepCallback {
	override fun onStep(value: Int, positive: Boolean) {
    	Toast.makeText(applicationContext, value.toString(), Toast.LENGTH_SHORT).show()
	}
})

Java

StepperTouch stepperTouch = (StepperTouch) findViewById(R.id.stepperTouch);
stepperTouch.stepper.setMin(0);
stepperTouch.stepper.setMax(3);
stepperTouch.stepper.addStepCallback(new OnStepCallback() {
    @Override
    public void onStep(int value, boolean positive) {
        Toast.makeText(getApplicationContext(), value + "", Toast.LENGTH_SHORT).show();
    }
});

You are able to further customize or set initial values with styled attributes:

Add res-auto to your xml layout if you haven't yet

xmlns:app="http://schemas.android.com/apk/res-auto"

After that the following attributes will become available:

app:stepperBackgroundColor=""
app:stepperButtonColor=""
app:stepperActionsColor=""
app:stepperActionsDisabledColor=""
app:stepperTextColor=""
app:stepperTextSize=""