Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Slider] Get default minTouchTargetSize from material attributes #4546

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions lib/java/com/google/android/material/slider/BaseSlider.java
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@
import androidx.annotation.ColorInt;
import androidx.annotation.ColorRes;
import androidx.annotation.DimenRes;
import androidx.annotation.Dimension;
import androidx.annotation.DrawableRes;
import androidx.annotation.IntDef;
import androidx.annotation.IntRange;
Expand All @@ -99,6 +98,7 @@
import com.google.android.material.internal.ViewOverlayImpl;
import com.google.android.material.internal.ViewUtils;
import com.google.android.material.motion.MotionUtils;
import com.google.android.material.resources.MaterialAttributes;
import com.google.android.material.resources.MaterialResources;
import com.google.android.material.shape.MaterialShapeDrawable;
import com.google.android.material.shape.ShapeAppearanceModel;
Expand Down Expand Up @@ -286,9 +286,6 @@ abstract class BaseSlider<
private static final float RIGHT_LABEL_PIVOT_X = -0.2f;
private static final float RIGHT_LABEL_PIVOT_Y = 0.5f;

@Dimension(unit = Dimension.DP)
private static final int MIN_TOUCH_TARGET_DP = 48;

@NonNull private final Paint inactiveTrackPaint;
@NonNull private final Paint activeTrackPaint;
@NonNull private final Paint thumbPaint;
Expand Down Expand Up @@ -536,8 +533,7 @@ private void processAttributes(Context context, AttributeSet attrs, int defStyle
setValues(valueFrom);
stepSize = a.getFloat(R.styleable.Slider_android_stepSize, 0.0f);

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