package nl.dionsegijn.steppertouchdemo

import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import android.widget.Toast
import nl.dionsegijn.steppertouch.OnStepCallback
import nl.dionsegijn.steppertouch.StepperTouch


class MainActivity : AppCompatActivity() {

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)

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

        val bottemStepperTouch = findViewById(R.id.bottomStepperTouch) as StepperTouch
        bottemStepperTouch.stepper.setMin(-10)
        bottemStepperTouch.stepper.setMax(10)
        bottemStepperTouch.enableSideTap(true)
    }

}

package nl.dionsegijn.steppertouchdemo

import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import android.widget.Toast
import kotlinx.android.synthetic.main.activity_main.*
import nl.dionsegijn.steppertouch.OnStepCallback
import nl.dionsegijn.steppertouch.StepperTouch


class MainActivity : AppCompatActivity() {

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)

        stepperTouch.stepper.setMin(0)
        stepperTouch.stepper.setMax(5)
        stepperTouch.stepper.addStepCallback(object : OnStepCallback {
            override fun onStep(value: Int, positive: Boolean) {
                Toast.makeText(applicationContext, value.toString(), Toast.LENGTH_SHORT).show()
            }
        })

        bottomStepperTouch.stepper.setMin(-10)
        bottomStepperTouch.stepper.setMax(10)
        bottomStepperTouch.enableSideTap(true)
    }

}

Use kotlin extensions to retrieve the view
Use kotlin extensions to retrieve the view

DanielMartinus/Stepper-Touch