Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(406)

Side by Side Diff: chrome/android/java/src/org/chromium/chrome/browser/widget/ProgressAnimationLinear.java

Issue 1279873003: [Android] Add progress bar linear animation option. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 package org.chromium.chrome.browser.widget;
6
7 /**
8 * Progress bar animation logic that has linear speed.
9 */
10 class ProgressAnimationLinear implements ToolbarProgressBar.AnimationLogic {
11 // The speed unit is progress per second where 0 <= progress <= 1.
12 private static final float NORMAL_SPEED = 0.5f;
13 private static final float FINISHING_SPEED = 2.0f;
14
15 private float mProgress;
16
17 @Override
18 public void reset() {
19 mProgress = 0.0f;
20 }
21
22 @Override
23 public float updateProgress(float targetProgress, float frameTimeSec, int re solution) {
24 assert mProgress <= targetProgress;
25
26 mProgress = Math.min(targetProgress, mProgress
27 + frameTimeSec * (targetProgress == 1.0f ? FINISHING_SPEED : NOR MAL_SPEED));
28 return mProgress;
29 }
30 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698