Michael Kolb | 11d1978 | 2011-03-20 10:17:40 -0700 | [diff] [blame] | 1 | /* |
John Reck | 0f602f3 | 2011-07-07 15:38:43 -0700 | [diff] [blame] | 2 | * Copyright (C) 2011 The Android Open Source Project |
Michael Kolb | 11d1978 | 2011-03-20 10:17:40 -0700 | [diff] [blame] | 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
Michael Kolb | 11d1978 | 2011-03-20 10:17:40 -0700 | [diff] [blame] | 16 | package com.android.browser; |
| 17 | |
John Reck | e1a03a3 | 2011-09-14 17:04:16 -0700 | [diff] [blame] | 18 | import android.app.Activity; |
Michael Kolb | 11d1978 | 2011-03-20 10:17:40 -0700 | [diff] [blame] | 19 | import android.content.Context; |
Michael Kolb | 2814a36 | 2011-05-19 15:49:41 -0700 | [diff] [blame] | 20 | import android.content.res.Resources; |
| 21 | import android.graphics.drawable.Drawable; |
John Reck | 0f602f3 | 2011-07-07 15:38:43 -0700 | [diff] [blame] | 22 | import android.util.AttributeSet; |
Michael Kolb | 017ffab | 2011-07-11 15:26:47 -0700 | [diff] [blame] | 23 | import android.view.Menu; |
Michael Kolb | 017ffab | 2011-07-11 15:26:47 -0700 | [diff] [blame] | 24 | import android.view.MenuItem; |
Michael Kolb | 11d1978 | 2011-03-20 10:17:40 -0700 | [diff] [blame] | 25 | import android.view.View; |
Michael Kolb | 017ffab | 2011-07-11 15:26:47 -0700 | [diff] [blame] | 26 | import android.view.ViewConfiguration; |
Michael Kolb | 2814a36 | 2011-05-19 15:49:41 -0700 | [diff] [blame] | 27 | import android.webkit.WebView; |
Michael Kolb | 11d1978 | 2011-03-20 10:17:40 -0700 | [diff] [blame] | 28 | import android.widget.ImageView; |
Michael Kolb | 017ffab | 2011-07-11 15:26:47 -0700 | [diff] [blame] | 29 | import android.widget.PopupMenu; |
| 30 | import android.widget.PopupMenu.OnDismissListener; |
John Reck | 42229bc | 2011-08-19 13:26:43 -0700 | [diff] [blame] | 31 | import android.widget.PopupMenu.OnMenuItemClickListener; |
Michael Kolb | 11d1978 | 2011-03-20 10:17:40 -0700 | [diff] [blame] | 32 | |
Michael Kolb | 305b1c5 | 2011-06-21 16:16:22 -0700 | [diff] [blame] | 33 | import com.android.browser.UrlInputView.StateListener; |
Michael Kolb | 305b1c5 | 2011-06-21 16:16:22 -0700 | [diff] [blame] | 34 | |
John Reck | 0f602f3 | 2011-07-07 15:38:43 -0700 | [diff] [blame] | 35 | public class NavigationBarPhone extends NavigationBarBase implements |
John Reck | 42229bc | 2011-08-19 13:26:43 -0700 | [diff] [blame] | 36 | StateListener, OnMenuItemClickListener, OnDismissListener { |
Michael Kolb | 11d1978 | 2011-03-20 10:17:40 -0700 | [diff] [blame] | 37 | |
Michael Kolb | c16c595 | 2011-03-29 15:37:03 -0700 | [diff] [blame] | 38 | private ImageView mStopButton; |
Michael Kolb | 94ec527 | 2011-08-31 16:23:57 -0700 | [diff] [blame] | 39 | private ImageView mMagnify; |
| 40 | private ImageView mClearButton; |
Michael Kolb | 0b12912 | 2012-06-04 16:31:58 -0700 | [diff] [blame] | 41 | private ImageView mVoiceButton; |
Michael Kolb | 2814a36 | 2011-05-19 15:49:41 -0700 | [diff] [blame] | 42 | private Drawable mStopDrawable; |
| 43 | private Drawable mRefreshDrawable; |
Michael Kolb | 30adae6 | 2011-07-29 13:37:05 -0700 | [diff] [blame] | 44 | private String mStopDescription; |
| 45 | private String mRefreshDescription; |
John Reck | 8ac4290 | 2011-06-29 16:14:34 -0700 | [diff] [blame] | 46 | private View mTabSwitcher; |
Michael Kolb | 305b1c5 | 2011-06-21 16:16:22 -0700 | [diff] [blame] | 47 | private View mComboIcon; |
| 48 | private View mTitleContainer; |
Michael Kolb | 017ffab | 2011-07-11 15:26:47 -0700 | [diff] [blame] | 49 | private View mMore; |
Michael Kolb | 305b1c5 | 2011-06-21 16:16:22 -0700 | [diff] [blame] | 50 | private Drawable mTextfieldBgDrawable; |
Michael Kolb | 8441d4b | 2011-07-18 14:50:21 -0700 | [diff] [blame] | 51 | private PopupMenu mPopupMenu; |
John Reck | 5889190 | 2011-08-11 17:48:53 -0700 | [diff] [blame] | 52 | private boolean mOverflowMenuShowing; |
Michael Kolb | 017ffab | 2011-07-11 15:26:47 -0700 | [diff] [blame] | 53 | private boolean mNeedsMenu; |
John Reck | 419f6b4 | 2011-08-16 16:10:51 -0700 | [diff] [blame] | 54 | private View mIncognitoIcon; |
Michael Kolb | 11d1978 | 2011-03-20 10:17:40 -0700 | [diff] [blame] | 55 | |
John Reck | 0f602f3 | 2011-07-07 15:38:43 -0700 | [diff] [blame] | 56 | public NavigationBarPhone(Context context) { |
| 57 | super(context); |
| 58 | } |
| 59 | |
| 60 | public NavigationBarPhone(Context context, AttributeSet attrs) { |
| 61 | super(context, attrs); |
| 62 | } |
| 63 | |
| 64 | public NavigationBarPhone(Context context, AttributeSet attrs, int defStyle) { |
| 65 | super(context, attrs, defStyle); |
Michael Kolb | 11d1978 | 2011-03-20 10:17:40 -0700 | [diff] [blame] | 66 | } |
| 67 | |
| 68 | @Override |
John Reck | 0f602f3 | 2011-07-07 15:38:43 -0700 | [diff] [blame] | 69 | protected void onFinishInflate() { |
| 70 | super.onFinishInflate(); |
Michael Kolb | c16c595 | 2011-03-29 15:37:03 -0700 | [diff] [blame] | 71 | mStopButton = (ImageView) findViewById(R.id.stop); |
Michael Kolb | 11d1978 | 2011-03-20 10:17:40 -0700 | [diff] [blame] | 72 | mStopButton.setOnClickListener(this); |
Michael Kolb | 94ec527 | 2011-08-31 16:23:57 -0700 | [diff] [blame] | 73 | mClearButton = (ImageView) findViewById(R.id.clear); |
| 74 | mClearButton.setOnClickListener(this); |
Michael Kolb | 0b12912 | 2012-06-04 16:31:58 -0700 | [diff] [blame] | 75 | mVoiceButton = (ImageView) findViewById(R.id.voice); |
| 76 | mVoiceButton.setOnClickListener(this); |
Michael Kolb | 94ec527 | 2011-08-31 16:23:57 -0700 | [diff] [blame] | 77 | mMagnify = (ImageView) findViewById(R.id.magnify); |
John Reck | 8ac4290 | 2011-06-29 16:14:34 -0700 | [diff] [blame] | 78 | mTabSwitcher = findViewById(R.id.tab_switcher); |
| 79 | mTabSwitcher.setOnClickListener(this); |
Michael Kolb | 017ffab | 2011-07-11 15:26:47 -0700 | [diff] [blame] | 80 | mMore = findViewById(R.id.more); |
| 81 | mMore.setOnClickListener(this); |
Michael Kolb | 305b1c5 | 2011-06-21 16:16:22 -0700 | [diff] [blame] | 82 | mComboIcon = findViewById(R.id.iconcombo); |
Michael Kolb | 315d502 | 2011-10-13 12:47:11 -0700 | [diff] [blame] | 83 | mComboIcon.setOnClickListener(this); |
Michael Kolb | 305b1c5 | 2011-06-21 16:16:22 -0700 | [diff] [blame] | 84 | mTitleContainer = findViewById(R.id.title_bg); |
Michael Kolb | 11d1978 | 2011-03-20 10:17:40 -0700 | [diff] [blame] | 85 | setFocusState(false); |
John Reck | 0f602f3 | 2011-07-07 15:38:43 -0700 | [diff] [blame] | 86 | Resources res = getContext().getResources(); |
Michael Kolb | 2814a36 | 2011-05-19 15:49:41 -0700 | [diff] [blame] | 87 | mStopDrawable = res.getDrawable(R.drawable.ic_stop_holo_dark); |
| 88 | mRefreshDrawable = res.getDrawable(R.drawable.ic_refresh_holo_dark); |
Michael Kolb | 30adae6 | 2011-07-29 13:37:05 -0700 | [diff] [blame] | 89 | mStopDescription = res.getString(R.string.accessibility_button_stop); |
| 90 | mRefreshDescription = res.getString(R.string.accessibility_button_refresh); |
Michael Kolb | 305b1c5 | 2011-06-21 16:16:22 -0700 | [diff] [blame] | 91 | mTextfieldBgDrawable = res.getDrawable(R.drawable.textfield_active_holo_dark); |
John Reck | 67f3363 | 2011-06-17 16:23:42 -0700 | [diff] [blame] | 92 | mUrlInput.setContainer(this); |
Michael Kolb | 305b1c5 | 2011-06-21 16:16:22 -0700 | [diff] [blame] | 93 | mUrlInput.setStateListener(this); |
John Reck | 0f602f3 | 2011-07-07 15:38:43 -0700 | [diff] [blame] | 94 | mNeedsMenu = !ViewConfiguration.get(getContext()).hasPermanentMenuKey(); |
John Reck | 419f6b4 | 2011-08-16 16:10:51 -0700 | [diff] [blame] | 95 | mIncognitoIcon = findViewById(R.id.incognito_icon); |
Michael Kolb | 11d1978 | 2011-03-20 10:17:40 -0700 | [diff] [blame] | 96 | } |
| 97 | |
| 98 | @Override |
John Reck | 0f602f3 | 2011-07-07 15:38:43 -0700 | [diff] [blame] | 99 | public void onProgressStarted() { |
| 100 | super.onProgressStarted(); |
| 101 | if (mStopButton.getDrawable() != mStopDrawable) { |
| 102 | mStopButton.setImageDrawable(mStopDrawable); |
Michael Kolb | 30adae6 | 2011-07-29 13:37:05 -0700 | [diff] [blame] | 103 | mStopButton.setContentDescription(mStopDescription); |
John Reck | 0f602f3 | 2011-07-07 15:38:43 -0700 | [diff] [blame] | 104 | if (mStopButton.getVisibility() != View.VISIBLE) { |
| 105 | mComboIcon.setVisibility(View.GONE); |
| 106 | mStopButton.setVisibility(View.VISIBLE); |
Michael Kolb | 305b1c5 | 2011-06-21 16:16:22 -0700 | [diff] [blame] | 107 | } |
John Reck | 0f602f3 | 2011-07-07 15:38:43 -0700 | [diff] [blame] | 108 | } |
| 109 | } |
| 110 | |
| 111 | @Override |
| 112 | public void onProgressStopped() { |
| 113 | super.onProgressStopped(); |
John Reck | 0f602f3 | 2011-07-07 15:38:43 -0700 | [diff] [blame] | 114 | mStopButton.setImageDrawable(mRefreshDrawable); |
Michael Kolb | 30adae6 | 2011-07-29 13:37:05 -0700 | [diff] [blame] | 115 | mStopButton.setContentDescription(mRefreshDescription); |
John Reck | 0f602f3 | 2011-07-07 15:38:43 -0700 | [diff] [blame] | 116 | if (!isEditingUrl()) { |
| 117 | mComboIcon.setVisibility(View.VISIBLE); |
Michael Kolb | 2814a36 | 2011-05-19 15:49:41 -0700 | [diff] [blame] | 118 | } |
Michael Kolb | 5e8f2b9 | 2011-07-19 13:22:32 -0700 | [diff] [blame] | 119 | onStateChanged(mUrlInput.getState()); |
Michael Kolb | 2814a36 | 2011-05-19 15:49:41 -0700 | [diff] [blame] | 120 | } |
| 121 | |
Michael Kolb | 11d1978 | 2011-03-20 10:17:40 -0700 | [diff] [blame] | 122 | /** |
| 123 | * Update the text displayed in the title bar. |
| 124 | * @param title String to display. If null, the new tab string will be |
| 125 | * shown. |
| 126 | */ |
| 127 | @Override |
| 128 | void setDisplayTitle(String title) { |
John Reck | 434e9f8 | 2011-08-10 18:16:52 -0700 | [diff] [blame] | 129 | mUrlInput.setTag(title); |
John Reck | 67f3363 | 2011-06-17 16:23:42 -0700 | [diff] [blame] | 130 | if (!isEditingUrl()) { |
| 131 | if (title == null) { |
| 132 | mUrlInput.setText(R.string.new_tab); |
| 133 | } else { |
John Reck | 434e9f8 | 2011-08-10 18:16:52 -0700 | [diff] [blame] | 134 | mUrlInput.setText(UrlUtils.stripUrl(title), false); |
John Reck | 67f3363 | 2011-06-17 16:23:42 -0700 | [diff] [blame] | 135 | } |
| 136 | mUrlInput.setSelection(0); |
Michael Kolb | 11d1978 | 2011-03-20 10:17:40 -0700 | [diff] [blame] | 137 | } |
| 138 | } |
| 139 | |
| 140 | @Override |
Michael Kolb | 11d1978 | 2011-03-20 10:17:40 -0700 | [diff] [blame] | 141 | public void onClick(View v) { |
| 142 | if (v == mStopButton) { |
John Reck | 0f602f3 | 2011-07-07 15:38:43 -0700 | [diff] [blame] | 143 | if (mTitleBar.isInLoad()) { |
Michael Kolb | 2814a36 | 2011-05-19 15:49:41 -0700 | [diff] [blame] | 144 | mUiController.stopLoading(); |
| 145 | } else { |
| 146 | WebView web = mBaseUi.getWebView(); |
| 147 | if (web != null) { |
Michael Kolb | 305b1c5 | 2011-06-21 16:16:22 -0700 | [diff] [blame] | 148 | stopEditingUrl(); |
Michael Kolb | 2814a36 | 2011-05-19 15:49:41 -0700 | [diff] [blame] | 149 | web.reload(); |
| 150 | } |
| 151 | } |
John Reck | 8ac4290 | 2011-06-29 16:14:34 -0700 | [diff] [blame] | 152 | } else if (v == mTabSwitcher) { |
Michael Kolb | 20be26d | 2011-07-18 16:38:02 -0700 | [diff] [blame] | 153 | ((PhoneUi) mBaseUi).toggleNavScreen(); |
Michael Kolb | 017ffab | 2011-07-11 15:26:47 -0700 | [diff] [blame] | 154 | } else if (mMore == v) { |
John Reck | ef654f1 | 2011-07-12 16:42:08 -0700 | [diff] [blame] | 155 | showMenu(mMore); |
Michael Kolb | 94ec527 | 2011-08-31 16:23:57 -0700 | [diff] [blame] | 156 | } else if (mClearButton == v) { |
| 157 | mUrlInput.setText(""); |
Michael Kolb | 315d502 | 2011-10-13 12:47:11 -0700 | [diff] [blame] | 158 | } else if (mComboIcon == v) { |
| 159 | mUiController.showPageInfo(); |
Michael Kolb | 0b12912 | 2012-06-04 16:31:58 -0700 | [diff] [blame] | 160 | } else if (mVoiceButton == v) { |
| 161 | mUiController.startVoiceRecognizer(); |
Michael Kolb | 11d1978 | 2011-03-20 10:17:40 -0700 | [diff] [blame] | 162 | } else { |
| 163 | super.onClick(v); |
| 164 | } |
| 165 | } |
| 166 | |
John Reck | 5889190 | 2011-08-11 17:48:53 -0700 | [diff] [blame] | 167 | @Override |
Michael Kolb | 017ffab | 2011-07-11 15:26:47 -0700 | [diff] [blame] | 168 | public boolean isMenuShowing() { |
John Reck | 5889190 | 2011-08-11 17:48:53 -0700 | [diff] [blame] | 169 | return super.isMenuShowing() || mOverflowMenuShowing; |
Michael Kolb | 8441d4b | 2011-07-18 14:50:21 -0700 | [diff] [blame] | 170 | } |
| 171 | |
John Reck | ef654f1 | 2011-07-12 16:42:08 -0700 | [diff] [blame] | 172 | void showMenu(View anchor) { |
John Reck | e1a03a3 | 2011-09-14 17:04:16 -0700 | [diff] [blame] | 173 | Activity activity = mUiController.getActivity(); |
| 174 | if (mPopupMenu == null) { |
| 175 | mPopupMenu = new PopupMenu(mContext, anchor); |
| 176 | mPopupMenu.setOnMenuItemClickListener(this); |
| 177 | mPopupMenu.setOnDismissListener(this); |
| 178 | if (!activity.onCreateOptionsMenu(mPopupMenu.getMenu())) { |
| 179 | mPopupMenu = null; |
| 180 | return; |
| 181 | } |
| 182 | } |
Michael Kolb | 8441d4b | 2011-07-18 14:50:21 -0700 | [diff] [blame] | 183 | Menu menu = mPopupMenu.getMenu(); |
John Reck | e1a03a3 | 2011-09-14 17:04:16 -0700 | [diff] [blame] | 184 | if (activity.onPrepareOptionsMenu(menu)) { |
| 185 | mOverflowMenuShowing = true; |
| 186 | mPopupMenu.show(); |
| 187 | } |
Michael Kolb | 8441d4b | 2011-07-18 14:50:21 -0700 | [diff] [blame] | 188 | } |
| 189 | |
Michael Kolb | 017ffab | 2011-07-11 15:26:47 -0700 | [diff] [blame] | 190 | @Override |
| 191 | public void onDismiss(PopupMenu menu) { |
John Reck | 5889190 | 2011-08-11 17:48:53 -0700 | [diff] [blame] | 192 | if (menu == mPopupMenu) { |
| 193 | onMenuHidden(); |
| 194 | } |
Michael Kolb | 017ffab | 2011-07-11 15:26:47 -0700 | [diff] [blame] | 195 | } |
| 196 | |
Michael Kolb | 017ffab | 2011-07-11 15:26:47 -0700 | [diff] [blame] | 197 | private void onMenuHidden() { |
John Reck | 5889190 | 2011-08-11 17:48:53 -0700 | [diff] [blame] | 198 | mOverflowMenuShowing = false; |
Michael Kolb | 017ffab | 2011-07-11 15:26:47 -0700 | [diff] [blame] | 199 | mBaseUi.showTitleBarForDuration(); |
| 200 | } |
| 201 | |
Michael Kolb | 305b1c5 | 2011-06-21 16:16:22 -0700 | [diff] [blame] | 202 | @Override |
John Reck | 434e9f8 | 2011-08-10 18:16:52 -0700 | [diff] [blame] | 203 | public void onFocusChange(View view, boolean hasFocus) { |
| 204 | if (view == mUrlInput) { |
Michael Kolb | 2fc7c16 | 2011-08-31 13:38:24 -0700 | [diff] [blame] | 205 | if (hasFocus && !mUrlInput.getText().toString().equals(mUrlInput.getTag())) { |
| 206 | // only change text if different |
John Reck | 434e9f8 | 2011-08-10 18:16:52 -0700 | [diff] [blame] | 207 | mUrlInput.setText((String) mUrlInput.getTag(), false); |
John Reck | 2edc80c | 2011-11-18 09:27:21 -0800 | [diff] [blame] | 208 | mUrlInput.selectAll(); |
John Reck | 434e9f8 | 2011-08-10 18:16:52 -0700 | [diff] [blame] | 209 | } else { |
| 210 | setDisplayTitle(mUrlInput.getText().toString()); |
| 211 | } |
| 212 | } |
| 213 | super.onFocusChange(view, hasFocus); |
| 214 | } |
| 215 | |
| 216 | @Override |
Michael Kolb | 305b1c5 | 2011-06-21 16:16:22 -0700 | [diff] [blame] | 217 | public void onStateChanged(int state) { |
Michael Kolb | e721cc3 | 2012-06-26 15:26:59 -0700 | [diff] [blame] | 218 | mVoiceButton.setVisibility(View.GONE); |
Michael Kolb | 305b1c5 | 2011-06-21 16:16:22 -0700 | [diff] [blame] | 219 | switch(state) { |
| 220 | case StateListener.STATE_NORMAL: |
| 221 | mComboIcon.setVisibility(View.VISIBLE); |
| 222 | mStopButton.setVisibility(View.GONE); |
Michael Kolb | 94ec527 | 2011-08-31 16:23:57 -0700 | [diff] [blame] | 223 | mClearButton.setVisibility(View.GONE); |
| 224 | mMagnify.setVisibility(View.GONE); |
Michael Kolb | 305b1c5 | 2011-06-21 16:16:22 -0700 | [diff] [blame] | 225 | mTabSwitcher.setVisibility(View.VISIBLE); |
| 226 | mTitleContainer.setBackgroundDrawable(null); |
Michael Kolb | 017ffab | 2011-07-11 15:26:47 -0700 | [diff] [blame] | 227 | mMore.setVisibility(mNeedsMenu ? View.VISIBLE : View.GONE); |
Michael Kolb | 305b1c5 | 2011-06-21 16:16:22 -0700 | [diff] [blame] | 228 | break; |
| 229 | case StateListener.STATE_HIGHLIGHTED: |
| 230 | mComboIcon.setVisibility(View.GONE); |
| 231 | mStopButton.setVisibility(View.VISIBLE); |
Michael Kolb | 94ec527 | 2011-08-31 16:23:57 -0700 | [diff] [blame] | 232 | mClearButton.setVisibility(View.GONE); |
Michael Kolb | e721cc3 | 2012-06-26 15:26:59 -0700 | [diff] [blame] | 233 | if ((mUiController != null) && mUiController.supportsVoice()) { |
| 234 | mVoiceButton.setVisibility(View.VISIBLE); |
| 235 | } |
Michael Kolb | 94ec527 | 2011-08-31 16:23:57 -0700 | [diff] [blame] | 236 | mMagnify.setVisibility(View.GONE); |
Michael Kolb | 305b1c5 | 2011-06-21 16:16:22 -0700 | [diff] [blame] | 237 | mTabSwitcher.setVisibility(View.GONE); |
Michael Kolb | 017ffab | 2011-07-11 15:26:47 -0700 | [diff] [blame] | 238 | mMore.setVisibility(View.GONE); |
Michael Kolb | 305b1c5 | 2011-06-21 16:16:22 -0700 | [diff] [blame] | 239 | mTitleContainer.setBackgroundDrawable(mTextfieldBgDrawable); |
| 240 | break; |
| 241 | case StateListener.STATE_EDITED: |
| 242 | mComboIcon.setVisibility(View.GONE); |
| 243 | mStopButton.setVisibility(View.GONE); |
Michael Kolb | 94ec527 | 2011-08-31 16:23:57 -0700 | [diff] [blame] | 244 | mClearButton.setVisibility(View.VISIBLE); |
| 245 | mMagnify.setVisibility(View.VISIBLE); |
Michael Kolb | 305b1c5 | 2011-06-21 16:16:22 -0700 | [diff] [blame] | 246 | mTabSwitcher.setVisibility(View.GONE); |
Michael Kolb | 017ffab | 2011-07-11 15:26:47 -0700 | [diff] [blame] | 247 | mMore.setVisibility(View.GONE); |
Michael Kolb | 305b1c5 | 2011-06-21 16:16:22 -0700 | [diff] [blame] | 248 | mTitleContainer.setBackgroundDrawable(mTextfieldBgDrawable); |
| 249 | break; |
Michael Kolb | 2814a36 | 2011-05-19 15:49:41 -0700 | [diff] [blame] | 250 | } |
| 251 | } |
John Reck | 419f6b4 | 2011-08-16 16:10:51 -0700 | [diff] [blame] | 252 | |
| 253 | @Override |
| 254 | public void onTabDataChanged(Tab tab) { |
| 255 | super.onTabDataChanged(tab); |
| 256 | mIncognitoIcon.setVisibility(tab.isPrivateBrowsingEnabled() |
| 257 | ? View.VISIBLE : View.GONE); |
| 258 | } |
| 259 | |
John Reck | 42229bc | 2011-08-19 13:26:43 -0700 | [diff] [blame] | 260 | @Override |
| 261 | public boolean onMenuItemClick(MenuItem item) { |
| 262 | return mUiController.onOptionsItemSelected(item); |
| 263 | } |
| 264 | |
Michael Kolb | 11d1978 | 2011-03-20 10:17:40 -0700 | [diff] [blame] | 265 | } |