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

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: Modified code as suggested. 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..ed9e570f8a0b2b6f8b3f85da2c98e0e685ad4cbd 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 = true;
/**
* @param context The Context the view is running in.
@@ -90,10 +90,13 @@ 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);
+ } else {
+ mStopReloadButton.setImageResource(R.drawable.btn_reload_normal);
+ postDelayed(mClearProgressRunnable, COMPLETED_PROGRESS_TIMEOUT_MS);
+ }
}
/**
@@ -182,18 +185,15 @@ public class ChromeShellToolbar extends LinearLayout {
}
private void initializeStopReloadButton() {
- mStopButton = (ImageButton)findViewById(R.id.stop);
- mStopButton.setOnClickListener(new OnClickListener() {
+ mStopReloadButton = (ImageButton)findViewById(R.id.stop_reload_button);
+ mStopReloadButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
- mTab.getContentViewCore().stopLoading();
- }
- });
- mReloadButton = (ImageButton)findViewById(R.id.reload);
- mReloadButton.setOnClickListener(new OnClickListener() {
- @Override
- public void onClick(View v) {
- mTab.getContentViewCore().reload(true);
+ if (mLoading) {
+ mTab.getContentViewCore().stopLoading();
+ } else {
+ mTab.getContentViewCore().reload(true);
+ }
}
});
}
« no previous file with comments | « chrome/android/java/res/drawable-mdpi/btn_reload_normal.png ('k') | chrome/android/shell/res/drawable/btn_reload_normal.png » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698