Skip to content

Commit

Permalink
fix(MaterialSliderHelper): return float value, not double.
Browse files Browse the repository at this point in the history
  • Loading branch information
asafkorem committed Sep 27, 2023
1 parent 4401837 commit 8881a1f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import org.joor.Reflect
private const val CLASS_MATERIAL_SLIDER = "com.google.android.material.slider.Slider"

open class MaterialSliderHelper(protected val view: View) {
fun getValueIfSlider(): Double? {
fun getValueIfSlider(): Float? {
if (!isSlider()) {
return null
}
Expand All @@ -17,5 +17,5 @@ open class MaterialSliderHelper(protected val view: View) {

private fun isSlider() = ReflectUtils.isAssignableFrom(view, CLASS_MATERIAL_SLIDER)

private fun getValue() = Reflect.on(view).call("getValue").get() as Double
private fun getValue() = Reflect.on(view).call("getValue").get() as Float
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class MaterialSliderHelperTest {

val uut = MaterialSliderHelper(slider)

assertThat(uut.getValueIfSlider()).isEqualTo(0.2)
assertThat(uut.getValueIfSlider()).isEqualTo(0.2f)
}

@Test
Expand Down

0 comments on commit 8881a1f

Please sign in to comment.