Skip to content

Commit ae68654

Browse files
pubiqqkendrickumstattd
authored andcommitted
[Chip] Get default minTouchTargetSize from material attributes
Resolves #4545 - 8d3f96b by pubiqq <[email protected]> PiperOrigin-RevId: 760679794
1 parent 1dc3923 commit ae68654

File tree

1 file changed

+2
-6
lines changed
  • lib/java/com/google/android/material/chip

1 file changed

+2
-6
lines changed

lib/java/com/google/android/material/chip/Chip.java

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@
7878
import com.google.android.material.chip.ChipDrawable.Delegate;
7979
import com.google.android.material.internal.MaterialCheckable;
8080
import com.google.android.material.internal.ThemeEnforcement;
81-
import com.google.android.material.internal.ViewUtils;
81+
import com.google.android.material.resources.MaterialAttributes;
8282
import com.google.android.material.resources.MaterialResources;
8383
import com.google.android.material.resources.TextAppearance;
8484
import com.google.android.material.resources.TextAppearanceFontCallback;
@@ -148,9 +148,6 @@ public class Chip extends AppCompatCheckBox
148148

149149
private static final String NAMESPACE_ANDROID = "http://schemas.android.com/apk/res/android";
150150

151-
/** Value taken from Android Accessibility Guide */
152-
private static final int MIN_TOUCH_TARGET_DP = 48;
153-
154151
@Nullable private ChipDrawable chipDrawable;
155152
@Nullable private InsetDrawable insetBackgroundDrawable;
156153
//noinspection NewApi
@@ -330,8 +327,7 @@ private void initMinTouchTarget(Context context, @Nullable AttributeSet attrs, i
330327
DEF_STYLE_RES);
331328
ensureMinTouchTargetSize = a.getBoolean(R.styleable.Chip_ensureMinTouchTargetSize, false);
332329

333-
float defaultMinTouchTargetSize =
334-
(float) Math.ceil(ViewUtils.dpToPx(getContext(), MIN_TOUCH_TARGET_DP));
330+
float defaultMinTouchTargetSize = MaterialAttributes.resolveMinimumAccessibleTouchTarget(context);
335331
minTouchTargetSize =
336332
(int)
337333
Math.ceil(

0 commit comments

Comments
 (0)