Skip to content

Commit

Permalink
[Button] Updated spring specs for responsive touch.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 660117556
  • Loading branch information
pekingme authored and drchen committed Aug 7, 2024
1 parent b36919f commit 5bcae74
Showing 1 changed file with 3 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -204,9 +204,8 @@ interface OnPressedChangeListener {

private static final int DEF_STYLE_RES = R.style.Widget_MaterialComponents_Button;

private static final float TOGGLE_BUTTON_SPRING_DAMPING = 0.8f;
private static final float DEFAULT_BUTTON_CORNER_SPRING_DAMPING = 0.5f;
private static final float DEFAULT_BUTTON_SPRING_STIFFNESS = 800;
private static final float DEFAULT_BUTTON_CORNER_SPRING_DAMPING = 0.8f;
private static final float DEFAULT_BUTTON_SPRING_STIFFNESS = 380;

@NonNull private final MaterialButtonHelper materialButtonHelper;

Expand Down Expand Up @@ -283,8 +282,7 @@ public MaterialButton(@NonNull Context context, @Nullable AttributeSet attrs, in

private SpringForce createSpringForce() {
return new SpringForce()
.setDampingRatio(
isCheckable() ? TOGGLE_BUTTON_SPRING_DAMPING : DEFAULT_BUTTON_CORNER_SPRING_DAMPING)
.setDampingRatio(DEFAULT_BUTTON_CORNER_SPRING_DAMPING)
.setStiffness(DEFAULT_BUTTON_SPRING_STIFFNESS);
}

Expand Down

0 comments on commit 5bcae74

Please sign in to comment.