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