diff options
| author | Neil Fuller <nfuller@google.com> | 2014-10-02 10:14:18 +0000 |
|---|---|---|
| committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2014-10-02 10:14:19 +0000 |
| commit | 0c1faf43aecadc37b78c4ad6cb669eb351d21385 (patch) | |
| tree | 86aed0f37ba91b3b137978b412889b2057a4898e /core/java/android/widget/StackView.java | |
| parent | 316296511bf12c4e14dfb6f54731d1a515114abf (diff) | |
| parent | 33253a4baa6279f81a73425b49dfb6abe5f5416e (diff) | |
Merge "Switch from FloatMath -> Math and Math.hypot where possible"
Diffstat (limited to 'core/java/android/widget/StackView.java')
| -rw-r--r-- | core/java/android/widget/StackView.java | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/core/java/android/widget/StackView.java b/core/java/android/widget/StackView.java index 68536604bf67..7df0a31e5448 100644 --- a/core/java/android/widget/StackView.java +++ b/core/java/android/widget/StackView.java @@ -1043,10 +1043,8 @@ public class StackView extends AdapterViewAnimator { if (mView != null) { final LayoutParams viewLp = (LayoutParams) mView.getLayoutParams(); - float d = (float) Math.sqrt(Math.pow(viewLp.horizontalOffset, 2) + - Math.pow(viewLp.verticalOffset, 2)); - float maxd = (float) Math.sqrt(Math.pow(mSlideAmount, 2) + - Math.pow(0.4f * mSlideAmount, 2)); + float d = (float) Math.hypot(viewLp.horizontalOffset, viewLp.verticalOffset); + float maxd = (float) Math.hypot(mSlideAmount, 0.4f * mSlideAmount); if (velocity == 0) { return (invert ? (1 - d / maxd) : d / maxd) * DEFAULT_ANIMATION_DURATION; |
