EsSeekBar
EsRangeBar
allprojects {
repositories {
google()
jcenter()
maven { url 'https://jitpack.io' }
}
android {
...
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
...
}
dependencies {
implementation 'com.github.EsmaeelNabil:EsIndicatorSeekBar:0.2.4'
}
<com.esmaeel.indicatorseekbar.EsSeekBar
android:id="@+id/_seekbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<com.esmaeel.rangeindicatorseekbar.EsRangeBar
android:id="@+id/_rangebar"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
//Simple EsSeekBar
_seekbar.doTheMagicIn(this,::seekBarListener)
//Simple EsRangeBar
_rangebar.doTheMagicIn(this,::rangeBarListener)
}
- write a function for the
EsSeekBar
that takes anInt
. - path it like this
doTheMagicIn(this,::seekBarListener)
. - here it is
Your Listener is up and ready!
. - now i guess you know how to make one for
EsRangeBar
Yes? , Pravo :)
private fun seekBarListener(progress: Int) {
textView.text = " progress = $progress "
}
private fun rangeBarListener(startRange: Int, endRange: Int) {
textView.text = " start = $startRange end = $endRange"
}
_seekbar.doTheMagicIn(this,::seekBarListener
,indicatorPrefix = "KM"
,prefixPositionStart = false)
_seekbar.doTheMagicIn(this,::seekBarListener
,indicatorBackground = EsSeekBar.WHITE
,indicatorPrefix = "$"
,prefixPositionStart = true)
_seekbar.doTheMagicIn(this,::rangeBarListener
,indicatorBackground = EsSeekBar.CUSTOM_LAYOUT
,indicatorLayoutResource = R.layout.indicator_black
,indicatorPrefix = "KM"
,prefixPositionStart = false)
_rangebar.doTheMagicIn(this,::rangeBarListener
,indicatorBackground = EsSeekBar.WHITE
,indicatorPrefix = "KM"
,prefixPositionStart = false)
_rangebar.doTheMagicIn(this,::rangeBarListener
,indicatorBackground = EsSeekBar.CUSTOM_LAYOUT
,indicatorLayoutResource = R.layout.indicator_black
,indicatorPrefix = "KM"
,prefixPositionStart = false)
https://www.linkedin.com/pulse/indicator-seekbar-android-kotlin-esmaeel-napil/