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

Unified Diff: chrome/android/shell/java/src/org/chromium/chrome/shell/ChromeShellToolbar.java

Issue 1256343004: [Android] Add phone progress bar animation behind a flag. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: telemetry_perf_unittest fix attempt #1 Created 5 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: chrome/android/shell/java/src/org/chromium/chrome/shell/ChromeShellToolbar.java
diff --git a/chrome/android/shell/java/src/org/chromium/chrome/shell/ChromeShellToolbar.java b/chrome/android/shell/java/src/org/chromium/chrome/shell/ChromeShellToolbar.java
index c40f71935789b2b94e1fbb6905b34150f44a9cfc..8fd48ddcab4f0983f0ba554eb71a5fdef9103f31 100644
--- a/chrome/android/shell/java/src/org/chromium/chrome/shell/ChromeShellToolbar.java
+++ b/chrome/android/shell/java/src/org/chromium/chrome/shell/ChromeShellToolbar.java
@@ -36,20 +36,24 @@ import org.chromium.content.common.ContentSwitches;
public class ChromeShellToolbar extends LinearLayout {
private final Runnable mUpdateProgressRunnable = new Runnable() {
+ private boolean mIsStarted = false;
+
@Override
public void run() {
mStopReloadButton.setImageResource(
mLoading ? R.drawable.btn_close : R.drawable.btn_toolbar_reload);
- // Note: We have an assertion in setProgress that checks if it's started.
- // Calling mProgressBar.start(); here is not ideal as it could be redundant.
- // But currently we didn't hook loading start/end events in Chrome shell and
- // anyways we will be deleting Chrome shell soon, so will leave as it is.
- mProgressBar.start();
if (mProgress == 100.0f) {
- if (mProgressBar.getProgress() != 1.0f) mProgressBar.setProgress(1.0f);
- mProgressBar.finish(true);
+ if (mIsStarted) {
+ if (mProgressBar.getProgress() != 1.0f) mProgressBar.setProgress(1.0f);
+ mProgressBar.finish(true);
+ mIsStarted = false;
+ }
} else {
+ if (!mIsStarted) {
+ mProgressBar.start();
+ mIsStarted = true;
+ }
mProgressBar.setProgress(mProgress / 100.0f);
}
}
@@ -137,6 +141,7 @@ public class ChromeShellToolbar extends LinearLayout {
super.onFinishInflate();
mProgressBar = (ToolbarProgressBar) findViewById(R.id.progress);
+ mProgressBar.initializeAnimation();
initializeUrlField();
initializeTabSwitcherButton();
initializeMenuButton();

Powered by Google App Engine
This is Rietveld 408576698