Skip to content

Commit

Permalink
[Chip] Use minTouchTargetSize from material attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
pubiqq committed Jan 20, 2025
1 parent 690bbfc commit 9e5ed6e
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions lib/java/com/google/android/material/chip/Chip.java
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
import com.google.android.material.chip.ChipDrawable.Delegate;
import com.google.android.material.internal.MaterialCheckable;
import com.google.android.material.internal.ThemeEnforcement;
import com.google.android.material.internal.ViewUtils;
import com.google.android.material.resources.MaterialAttributes;
import com.google.android.material.resources.MaterialResources;
import com.google.android.material.resources.TextAppearance;
import com.google.android.material.resources.TextAppearanceFontCallback;
Expand Down Expand Up @@ -147,9 +147,6 @@ public class Chip extends AppCompatCheckBox

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

/** Value taken from Android Accessibility Guide */
private static final int MIN_TOUCH_TARGET_DP = 48;

@Nullable private ChipDrawable chipDrawable;
@Nullable private InsetDrawable insetBackgroundDrawable;
//noinspection NewApi
Expand Down Expand Up @@ -329,8 +326,7 @@ private void initMinTouchTarget(Context context, @Nullable AttributeSet attrs, i
DEF_STYLE_RES);
ensureMinTouchTargetSize = a.getBoolean(R.styleable.Chip_ensureMinTouchTargetSize, false);

float defaultMinTouchTargetSize =
(float) Math.ceil(ViewUtils.dpToPx(getContext(), MIN_TOUCH_TARGET_DP));
float defaultMinTouchTargetSize = MaterialAttributes.resolveMinimumAccessibleTouchTarget(context);
minTouchTargetSize =
(int)
Math.ceil(
Expand Down

0 comments on commit 9e5ed6e

Please sign in to comment.