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

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

Issue 583673002: [Android] Invalidate ChromeShell progress bar during animation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Line break cleanup Created 6 years, 3 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
« no previous file with comments | « base/android/java/src/org/chromium/base/ApiCompatibilityUtils.java ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 12c5e20763ebe3d91b398ba18ec77ce118c11359..85a8a46022c466b8b47d2f32b2ec4a46221377d1 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
@@ -19,6 +19,7 @@ import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.TextView.OnEditorActionListener;
+import org.chromium.base.ApiCompatibilityUtils;
import org.chromium.base.CommandLine;
import org.chromium.chrome.browser.EmptyTabObserver;
import org.chromium.chrome.browser.Tab;
@@ -41,6 +42,20 @@ public class ChromeShellToolbar extends LinearLayout {
}
};
+ private final Runnable mUpdateProgressRunnable = new Runnable() {
+ @Override
+ public void run() {
+ mProgressDrawable.setLevel(100 * mProgress);
+ if (mLoading) {
+ mStopReloadButton.setImageResource(R.drawable.btn_stop_normal);
+ } else {
+ mStopReloadButton.setImageResource(R.drawable.btn_reload_normal);
+ ApiCompatibilityUtils.postOnAnimationDelayed(ChromeShellToolbar.this,
+ mClearProgressRunnable, COMPLETED_PROGRESS_TIMEOUT_MS);
+ }
+ }
+ };
+
private EditText mUrlTextView;
private ClipDrawable mProgressDrawable;
@@ -53,6 +68,7 @@ public class ChromeShellToolbar extends LinearLayout {
private SuggestionPopup mSuggestionPopup;
private ImageButton mStopReloadButton;
+ private int mProgress = 0;
private boolean mLoading = true;
/**
@@ -89,14 +105,10 @@ public class ChromeShellToolbar extends LinearLayout {
private void onLoadProgressChanged(int progress) {
removeCallbacks(mClearProgressRunnable);
nyquist 2014/09/18 21:43:23 Should this stay here or move to the other update
jdduke (slow) 2014/09/18 21:59:22 I think it can go there, but then we might have a
- mProgressDrawable.setLevel(100 * progress);
+ removeCallbacks(mUpdateProgressRunnable);
+ mProgress = progress;
mLoading = progress != 100;
- if (mLoading) {
- mStopReloadButton.setImageResource(R.drawable.btn_stop_normal);
- } else {
- mStopReloadButton.setImageResource(R.drawable.btn_reload_normal);
- postDelayed(mClearProgressRunnable, COMPLETED_PROGRESS_TIMEOUT_MS);
- }
+ ApiCompatibilityUtils.postOnAnimation(this, mUpdateProgressRunnable);
}
/**
« no previous file with comments | « base/android/java/src/org/chromium/base/ApiCompatibilityUtils.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698