Skip to content

Commit c641750

Browse files
authored
Change the getButtonDrawable method to use the compat version of its counterpart. (#529)
The method doesn't exist in API level 21.
1 parent a8c8b6e commit c641750

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

flexbox/src/androidTest/java/com/google/android/flexbox/FlexboxHelperTest.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ package com.google.android.flexbox
1919
import android.view.View
2020
import android.widget.CheckBox
2121
import android.widget.TextView
22+
import androidx.core.widget.CompoundButtonCompat
2223
import androidx.test.rule.ActivityTestRule
2324
import androidx.test.runner.AndroidJUnit4
2425
import com.google.android.flexbox.test.FlexboxTestActivity
@@ -428,7 +429,7 @@ class FlexboxHelperTest {
428429

429430
// CompoundButton will use its ButtonDrawable minWidth to determine its size when
430431
// no minimum width is set on it.
431-
val drawableMinWidth = view1.buttonDrawable!!.minimumWidth
432+
val drawableMinWidth = CompoundButtonCompat.getButtonDrawable(view1)!!.minimumWidth
432433
val expectedTextWidth = containerWidth - drawableMinWidth
433434
assertThat(view1.measuredWidth, `is`(drawableMinWidth))
434435
assertThat(view2.measuredWidth, `is`(expectedTextWidth))

0 commit comments

Comments
 (0)