Correct GesturePreviewTrail.getWidth() implementation

Bug: 7981153
Change-Id: I20785b7f82329ce6f19c883e77a9716772cda290
main
Tadashi G. Takaoka 2013-01-18 17:37:21 +09:00 committed by Android Git Automerger
parent 89a1755627
commit 2763fc22ce
2 changed files with 2 additions and 4 deletions

View File

@ -100,7 +100,7 @@
<fraction name="center_suggestion_percentile">36%</fraction> <fraction name="center_suggestion_percentile">36%</fraction>
<!-- Gesture preview trail parameters --> <!-- Gesture preview trail parameters -->
<dimen name="gesture_preview_trail_start_width">12.6dp</dimen> <dimen name="gesture_preview_trail_start_width">10.0dp</dimen>
<dimen name="gesture_preview_trail_end_width">2.5dp</dimen> <dimen name="gesture_preview_trail_end_width">2.5dp</dimen>
<!-- Gesture floating preview text parameters --> <!-- Gesture floating preview text parameters -->
<dimen name="gesture_floating_preview_text_size">24dp</dimen> <dimen name="gesture_floating_preview_text_size">24dp</dimen>

View File

@ -131,10 +131,8 @@ final class GesturePreviewTrail {
* @return the width of a gesture trail * @return the width of a gesture trail
*/ */
private static float getWidth(final int elapsedTime, final Params params) { private static float getWidth(final int elapsedTime, final Params params) {
final int deltaTime = params.mTrailLingerDuration - elapsedTime;
final float deltaWidth = params.mTrailStartWidth - params.mTrailEndWidth; final float deltaWidth = params.mTrailStartWidth - params.mTrailEndWidth;
return Math.max( return params.mTrailStartWidth - (deltaWidth * elapsedTime) / params.mTrailLingerDuration;
(deltaTime * deltaWidth) / params.mTrailLingerDuration, params.mTrailEndWidth);
} }
private final RoundedLine mRoundedLine = new RoundedLine(); private final RoundedLine mRoundedLine = new RoundedLine();