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

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

Issue 546383002: Follow up CL for issue:541713002 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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
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 1161c24ace81062bf0d71cfcdedf436e396268df..17cd9ba467b77c82b4b48377429a0bbd5c9197b7 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
@@ -52,8 +52,8 @@ public class ChromeShellToolbar extends LinearLayout {
private SuggestionPopup mSuggestionPopup;
- private ImageButton mStopButton;
- private ImageButton mReloadButton;
+ private ImageButton mStopReloadButton;
+ private boolean mLoading;
/**
* @param context The Context the view is running in.
@@ -90,10 +90,12 @@ public class ChromeShellToolbar extends LinearLayout {
private void onLoadProgressChanged(int progress) {
removeCallbacks(mClearProgressRunnable);
mProgressDrawable.setLevel(100 * progress);
- boolean isLoading = progress != 100;
- mStopButton.setVisibility(isLoading ? VISIBLE : GONE);
- mReloadButton.setVisibility(isLoading ? GONE : VISIBLE);
- if (!isLoading) postDelayed(mClearProgressRunnable, COMPLETED_PROGRESS_TIMEOUT_MS);
+ mLoading = progress != 100;
+ if (mLoading) mStopReloadButton.setImageResource(R.drawable.btn_stop_normal);
Bernhard Bauer 2014/09/08 07:58:42 If one branch of if-else uses braces, the other on
ankit 2014/09/08 09:23:08 Done.
+ else {
+ mStopReloadButton.setImageResource(R.drawable.btn_reload_normal);
+ postDelayed(mClearProgressRunnable, COMPLETED_PROGRESS_TIMEOUT_MS);
+ }
}
/**
@@ -182,18 +184,12 @@ public class ChromeShellToolbar extends LinearLayout {
}
private void initializeStopReloadButton() {
- mStopButton = (ImageButton)findViewById(R.id.stop);
- mStopButton.setOnClickListener(new OnClickListener() {
- @Override
- public void onClick(View v) {
- mTab.getContentViewCore().stopLoading();
- }
- });
- mReloadButton = (ImageButton)findViewById(R.id.reload);
- mReloadButton.setOnClickListener(new OnClickListener() {
+ mStopReloadButton = (ImageButton)findViewById(R.id.stop_reload_button);
+ mStopReloadButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
- mTab.getContentViewCore().reload(true);
+ if (mLoading) mTab.getContentViewCore().stopLoading();
Bernhard Bauer 2014/09/08 07:58:42 Putting the if-statement and the body on the same
ankit 2014/09/08 09:23:08 Done.
+ else mTab.getContentViewCore().reload(true);
}
});
}

Powered by Google App Engine
This is Rietveld 408576698