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

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

Issue 914933002: Stop/reload button should hide if url bar is focussed. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review changes Created 5 years, 10 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
« no previous file with comments | « no previous file | chrome/android/shell/java/src/org/chromium/chrome/shell/TabManager.java » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 package org.chromium.chrome.shell; 5 package org.chromium.chrome.shell;
6 6
7 import android.annotation.SuppressLint; 7 import android.annotation.SuppressLint;
8 import android.content.Context; 8 import android.content.Context;
9 import android.content.res.Configuration; 9 import android.content.res.Configuration;
10 import android.util.AttributeSet; 10 import android.util.AttributeSet;
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 private AppMenuButtonHelper mAppMenuButtonHelper; 69 private AppMenuButtonHelper mAppMenuButtonHelper;
70 70
71 private TabManager mTabManager; 71 private TabManager mTabManager;
72 72
73 private SuggestionPopup mSuggestionPopup; 73 private SuggestionPopup mSuggestionPopup;
74 74
75 private ImageButton mStopReloadButton; 75 private ImageButton mStopReloadButton;
76 private ImageButton mAddButton; 76 private ImageButton mAddButton;
77 private int mProgress = 0; 77 private int mProgress = 0;
78 private boolean mLoading = true; 78 private boolean mLoading = true;
79 private boolean mFocus = false;
79 80
80 /** 81 /**
81 * @param context The Context the view is running in. 82 * @param context The Context the view is running in.
82 * @param attrs The attributes of the XML tag that is inflating the view. 83 * @param attrs The attributes of the XML tag that is inflating the view.
83 */ 84 */
84 public ChromeShellToolbar(Context context, AttributeSet attrs) { 85 public ChromeShellToolbar(Context context, AttributeSet attrs) {
85 super(context, attrs); 86 super(context, attrs);
86 // When running performance benchmark, we don't want to observe the tab 87 // When running performance benchmark, we don't want to observe the tab
87 // invalidation which would interfere with browser's processing content 88 // invalidation which would interfere with browser's processing content
88 // frame. See crbug.com/394976. 89 // frame. See crbug.com/394976.
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 mUrlTextView.clearFocus(); 172 mUrlTextView.clearFocus();
172 setKeyboardVisibilityForUrl(false); 173 setKeyboardVisibilityForUrl(false);
173 tab.getView().requestFocus(); 174 tab.getView().requestFocus();
174 return true; 175 return true;
175 } 176 }
176 }); 177 });
177 mUrlTextView.setOnFocusChangeListener(new OnFocusChangeListener() { 178 mUrlTextView.setOnFocusChangeListener(new OnFocusChangeListener() {
178 @Override 179 @Override
179 public void onFocusChange(View v, boolean hasFocus) { 180 public void onFocusChange(View v, boolean hasFocus) {
180 setKeyboardVisibilityForUrl(hasFocus); 181 setKeyboardVisibilityForUrl(hasFocus);
181 mStopReloadButton.setVisibility(hasFocus ? GONE : VISIBLE); 182 mFocus = hasFocus;
183 updateToolBarButtonState();
182 if (!hasFocus && mTab != null) { 184 if (!hasFocus && mTab != null) {
183 mUrlTextView.setText(mTab.getWebContents().getUrl()); 185 mUrlTextView.setText(mTab.getWebContents().getUrl());
184 mSuggestionPopup.dismissPopup(); 186 mSuggestionPopup.dismissPopup();
185 } 187 }
186 } 188 }
187 }); 189 });
188 mUrlTextView.setOnKeyListener(new OnKeyListener() { 190 mUrlTextView.setOnKeyListener(new OnKeyListener() {
189 @Override 191 @Override
190 public boolean onKey(View v, int keyCode, KeyEvent event) { 192 public boolean onKey(View v, int keyCode, KeyEvent event) {
191 if (keyCode == KeyEvent.KEYCODE_BACK) { 193 if (keyCode == KeyEvent.KEYCODE_BACK) {
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 mAddButton = (ImageButton) findViewById(R.id.add_button); 251 mAddButton = (ImageButton) findViewById(R.id.add_button);
250 mAddButton.setOnClickListener(new OnClickListener() { 252 mAddButton.setOnClickListener(new OnClickListener() {
251 @Override 253 @Override
252 public void onClick(View v) { 254 public void onClick(View v) {
253 mTabManager.createNewTab(); 255 mTabManager.createNewTab();
254 } 256 }
255 }); 257 });
256 } 258 }
257 259
258 /** 260 /**
259 * Shows or hides the add and the stop/reload button . 261 * Shows or hides the add and the stop/reload button .
Bernhard Bauer 2015/02/12 11:49:11 Nit: remove the space before the period.
260 * @param visibility The visibility status of the add button. 262 * @param visibility The visibility status of the add button.
Bernhard Bauer 2015/02/12 11:49:11 Javadoc comment is now outdated.
261 */ 263 */
262 public void showAddButton(boolean visibility) { 264 public void updateToolBarButtonState() {
263 mAddButton.setVisibility(visibility ? VISIBLE : GONE); 265 boolean tabSwitcherState = mTabManager.isTabSwitcherVisible();
264 mStopReloadButton.setVisibility(visibility ? GONE : VISIBLE); 266 mAddButton.setVisibility(tabSwitcherState ? VISIBLE : GONE);
267 mStopReloadButton.setVisibility(tabSwitcherState || mFocus ? GONE : VISI BLE);
265 } 268 }
266 269
267 /** 270 /**
268 * @return Current tab that is shown by ChromeShell. 271 * @return Current tab that is shown by ChromeShell.
269 */ 272 */
270 public ChromeShellTab getCurrentTab() { 273 public ChromeShellTab getCurrentTab() {
271 return mTab; 274 return mTab;
272 } 275 }
273 276
274 /** 277 /**
(...skipping 21 matching lines...) Expand all
296 public void onLoadProgressChanged(Tab tab, int progress) { 299 public void onLoadProgressChanged(Tab tab, int progress) {
297 if (tab == mTab) ChromeShellToolbar.this.onLoadProgressChanged(progr ess); 300 if (tab == mTab) ChromeShellToolbar.this.onLoadProgressChanged(progr ess);
298 } 301 }
299 302
300 @Override 303 @Override
301 public void onUpdateUrl(Tab tab, String url) { 304 public void onUpdateUrl(Tab tab, String url) {
302 if (tab == mTab) ChromeShellToolbar.this.onUpdateUrl(url); 305 if (tab == mTab) ChromeShellToolbar.this.onUpdateUrl(url);
303 } 306 }
304 } 307 }
305 } 308 }
OLDNEW
« no previous file with comments | « no previous file | chrome/android/shell/java/src/org/chromium/chrome/shell/TabManager.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698