diff options
| author | Jeff Brown <jeffbrown@google.com> | 2012-05-11 12:24:35 -0700 |
|---|---|---|
| committer | Jeff Brown <jeffbrown@google.com> | 2012-05-11 12:32:56 -0700 |
| commit | 8a90e6e3174083f274538567d851f98478fc83e9 (patch) | |
| tree | 2ac01015731bac0d759c8e7b6526ffa4874a369b /core/java/android | |
| parent | 2f0957607411b99810226ad38d59cf18718b86d0 (diff) | |
| download | frameworks_base-8a90e6e3174083f274538567d851f98478fc83e9.zip frameworks_base-8a90e6e3174083f274538567d851f98478fc83e9.tar.gz frameworks_base-8a90e6e3174083f274538567d851f98478fc83e9.tar.bz2 | |
Minor refactoring before starting on velocity tracker changes.
Bug: 6413587
Change-Id: I5eba2bb57193bff78cb3740de5f87aca0b31d154
Diffstat (limited to 'core/java/android')
| -rw-r--r-- | core/java/android/view/VelocityTracker.java | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/core/java/android/view/VelocityTracker.java b/core/java/android/view/VelocityTracker.java index 1c35e31..f703e34 100644 --- a/core/java/android/view/VelocityTracker.java +++ b/core/java/android/view/VelocityTracker.java @@ -298,6 +298,24 @@ public final class VelocityTracker implements Poolable<VelocityTracker> { return estimate(time, yCoeff); } + /** + * Gets the X coefficient with the specified index. + * @param index The index of the coefficient to return. + * @return The X coefficient, or 0 if the index is greater than the degree. + */ + public float getXCoeff(int index) { + return index <= degree ? xCoeff[index] : 0; + } + + /** + * Gets the Y coefficient with the specified index. + * @param index The index of the coefficient to return. + * @return The Y coefficient, or 0 if the index is greater than the degree. + */ + public float getYCoeff(int index) { + return index <= degree ? yCoeff[index] : 0; + } + private float estimate(float time, float[] c) { float a = 0; float scale = 1; |
