111d1978d8d16004598347abc93918b54a5ef760bMichael Kolb/* 20f602f3933dcd88702fdb514b6611e3066ca7a2bJohn Reck * Copyright (C) 2011 The Android Open Source Project 311d1978d8d16004598347abc93918b54a5ef760bMichael Kolb * 411d1978d8d16004598347abc93918b54a5ef760bMichael Kolb * Licensed under the Apache License, Version 2.0 (the "License"); 511d1978d8d16004598347abc93918b54a5ef760bMichael Kolb * you may not use this file except in compliance with the License. 611d1978d8d16004598347abc93918b54a5ef760bMichael Kolb * You may obtain a copy of the License at 711d1978d8d16004598347abc93918b54a5ef760bMichael Kolb * 811d1978d8d16004598347abc93918b54a5ef760bMichael Kolb * http://www.apache.org/licenses/LICENSE-2.0 911d1978d8d16004598347abc93918b54a5ef760bMichael Kolb * 1011d1978d8d16004598347abc93918b54a5ef760bMichael Kolb * Unless required by applicable law or agreed to in writing, software 1111d1978d8d16004598347abc93918b54a5ef760bMichael Kolb * distributed under the License is distributed on an "AS IS" BASIS, 1211d1978d8d16004598347abc93918b54a5ef760bMichael Kolb * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1311d1978d8d16004598347abc93918b54a5ef760bMichael Kolb * See the License for the specific language governing permissions and 1411d1978d8d16004598347abc93918b54a5ef760bMichael Kolb * limitations under the License. 1511d1978d8d16004598347abc93918b54a5ef760bMichael Kolb */ 1611d1978d8d16004598347abc93918b54a5ef760bMichael Kolbpackage com.android.browser; 1711d1978d8d16004598347abc93918b54a5ef760bMichael Kolb 18e1a03a366ff90ebcd8568a86b84a5917610cf512John Reckimport android.app.Activity; 1911d1978d8d16004598347abc93918b54a5ef760bMichael Kolbimport android.content.Context; 202814a362c21ac219410d9b54e1bd3e8152b845c7Michael Kolbimport android.content.res.Resources; 212814a362c21ac219410d9b54e1bd3e8152b845c7Michael Kolbimport android.graphics.drawable.Drawable; 220f602f3933dcd88702fdb514b6611e3066ca7a2bJohn Reckimport android.util.AttributeSet; 23017ffabc8af29b0cf14fecc6aad4a61acb8373a2Michael Kolbimport android.view.Menu; 24017ffabc8af29b0cf14fecc6aad4a61acb8373a2Michael Kolbimport android.view.MenuItem; 2511d1978d8d16004598347abc93918b54a5ef760bMichael Kolbimport android.view.View; 26017ffabc8af29b0cf14fecc6aad4a61acb8373a2Michael Kolbimport android.view.ViewConfiguration; 272814a362c21ac219410d9b54e1bd3e8152b845c7Michael Kolbimport android.webkit.WebView; 2811d1978d8d16004598347abc93918b54a5ef760bMichael Kolbimport android.widget.ImageView; 29017ffabc8af29b0cf14fecc6aad4a61acb8373a2Michael Kolbimport android.widget.PopupMenu; 30017ffabc8af29b0cf14fecc6aad4a61acb8373a2Michael Kolbimport android.widget.PopupMenu.OnDismissListener; 3142229bcdea8a1623d9ac3fce099793a3767fb14dJohn Reckimport android.widget.PopupMenu.OnMenuItemClickListener; 3211d1978d8d16004598347abc93918b54a5ef760bMichael Kolb 33305b1c51f5e0d48a59d0e7c646b6cd0bc777a5dcMichael Kolbimport com.android.browser.UrlInputView.StateListener; 3411d1978d8d16004598347abc93918b54a5ef760bMichael Kolb 350f602f3933dcd88702fdb514b6611e3066ca7a2bJohn Reckpublic class NavigationBarPhone extends NavigationBarBase implements 3642229bcdea8a1623d9ac3fce099793a3767fb14dJohn Reck StateListener, OnMenuItemClickListener, OnDismissListener { 3711d1978d8d16004598347abc93918b54a5ef760bMichael Kolb 38c16c595136aa7b49927a43ead26241abb1c731caMichael Kolb private ImageView mStopButton; 3994ec527ac5b4d4ca245c878de4eb559658a55d4dMichael Kolb private ImageView mMagnify; 4094ec527ac5b4d4ca245c878de4eb559658a55d4dMichael Kolb private ImageView mClearButton; 410b12912da64ff5b2917d4f50eb91df2e76457d08Michael Kolb private ImageView mVoiceButton; 422814a362c21ac219410d9b54e1bd3e8152b845c7Michael Kolb private Drawable mStopDrawable; 432814a362c21ac219410d9b54e1bd3e8152b845c7Michael Kolb private Drawable mRefreshDrawable; 4430adae6ebf17a724d24066a200432e6b22a4eeffMichael Kolb private String mStopDescription; 4530adae6ebf17a724d24066a200432e6b22a4eeffMichael Kolb private String mRefreshDescription; 468ac4290069aa077f86d9ae67d764157bc48587daJohn Reck private View mTabSwitcher; 47305b1c51f5e0d48a59d0e7c646b6cd0bc777a5dcMichael Kolb private View mComboIcon; 48305b1c51f5e0d48a59d0e7c646b6cd0bc777a5dcMichael Kolb private View mTitleContainer; 49017ffabc8af29b0cf14fecc6aad4a61acb8373a2Michael Kolb private View mMore; 50305b1c51f5e0d48a59d0e7c646b6cd0bc777a5dcMichael Kolb private Drawable mTextfieldBgDrawable; 518441d4bdc99f8e4a84d8292c7c2a6cdf4e562fffMichael Kolb private PopupMenu mPopupMenu; 5258891907e3cf77b72f1107ef5d9f4c984cb176edJohn Reck private boolean mOverflowMenuShowing; 53017ffabc8af29b0cf14fecc6aad4a61acb8373a2Michael Kolb private boolean mNeedsMenu; 54419f6b4136a8fac758e2159f223700b1dfcc20e2John Reck private View mIncognitoIcon; 5511d1978d8d16004598347abc93918b54a5ef760bMichael Kolb 560f602f3933dcd88702fdb514b6611e3066ca7a2bJohn Reck public NavigationBarPhone(Context context) { 570f602f3933dcd88702fdb514b6611e3066ca7a2bJohn Reck super(context); 580f602f3933dcd88702fdb514b6611e3066ca7a2bJohn Reck } 590f602f3933dcd88702fdb514b6611e3066ca7a2bJohn Reck 600f602f3933dcd88702fdb514b6611e3066ca7a2bJohn Reck public NavigationBarPhone(Context context, AttributeSet attrs) { 610f602f3933dcd88702fdb514b6611e3066ca7a2bJohn Reck super(context, attrs); 620f602f3933dcd88702fdb514b6611e3066ca7a2bJohn Reck } 630f602f3933dcd88702fdb514b6611e3066ca7a2bJohn Reck 640f602f3933dcd88702fdb514b6611e3066ca7a2bJohn Reck public NavigationBarPhone(Context context, AttributeSet attrs, int defStyle) { 650f602f3933dcd88702fdb514b6611e3066ca7a2bJohn Reck super(context, attrs, defStyle); 6611d1978d8d16004598347abc93918b54a5ef760bMichael Kolb } 6711d1978d8d16004598347abc93918b54a5ef760bMichael Kolb 6811d1978d8d16004598347abc93918b54a5ef760bMichael Kolb @Override 690f602f3933dcd88702fdb514b6611e3066ca7a2bJohn Reck protected void onFinishInflate() { 700f602f3933dcd88702fdb514b6611e3066ca7a2bJohn Reck super.onFinishInflate(); 71c16c595136aa7b49927a43ead26241abb1c731caMichael Kolb mStopButton = (ImageView) findViewById(R.id.stop); 7211d1978d8d16004598347abc93918b54a5ef760bMichael Kolb mStopButton.setOnClickListener(this); 7394ec527ac5b4d4ca245c878de4eb559658a55d4dMichael Kolb mClearButton = (ImageView) findViewById(R.id.clear); 7494ec527ac5b4d4ca245c878de4eb559658a55d4dMichael Kolb mClearButton.setOnClickListener(this); 750b12912da64ff5b2917d4f50eb91df2e76457d08Michael Kolb mVoiceButton = (ImageView) findViewById(R.id.voice); 760b12912da64ff5b2917d4f50eb91df2e76457d08Michael Kolb mVoiceButton.setOnClickListener(this); 7794ec527ac5b4d4ca245c878de4eb559658a55d4dMichael Kolb mMagnify = (ImageView) findViewById(R.id.magnify); 788ac4290069aa077f86d9ae67d764157bc48587daJohn Reck mTabSwitcher = findViewById(R.id.tab_switcher); 798ac4290069aa077f86d9ae67d764157bc48587daJohn Reck mTabSwitcher.setOnClickListener(this); 80017ffabc8af29b0cf14fecc6aad4a61acb8373a2Michael Kolb mMore = findViewById(R.id.more); 81017ffabc8af29b0cf14fecc6aad4a61acb8373a2Michael Kolb mMore.setOnClickListener(this); 82305b1c51f5e0d48a59d0e7c646b6cd0bc777a5dcMichael Kolb mComboIcon = findViewById(R.id.iconcombo); 83315d502edce27bb4e93e53134f1a43b8f5c45588Michael Kolb mComboIcon.setOnClickListener(this); 84305b1c51f5e0d48a59d0e7c646b6cd0bc777a5dcMichael Kolb mTitleContainer = findViewById(R.id.title_bg); 8511d1978d8d16004598347abc93918b54a5ef760bMichael Kolb setFocusState(false); 860f602f3933dcd88702fdb514b6611e3066ca7a2bJohn Reck Resources res = getContext().getResources(); 872814a362c21ac219410d9b54e1bd3e8152b845c7Michael Kolb mStopDrawable = res.getDrawable(R.drawable.ic_stop_holo_dark); 882814a362c21ac219410d9b54e1bd3e8152b845c7Michael Kolb mRefreshDrawable = res.getDrawable(R.drawable.ic_refresh_holo_dark); 8930adae6ebf17a724d24066a200432e6b22a4eeffMichael Kolb mStopDescription = res.getString(R.string.accessibility_button_stop); 9030adae6ebf17a724d24066a200432e6b22a4eeffMichael Kolb mRefreshDescription = res.getString(R.string.accessibility_button_refresh); 91305b1c51f5e0d48a59d0e7c646b6cd0bc777a5dcMichael Kolb mTextfieldBgDrawable = res.getDrawable(R.drawable.textfield_active_holo_dark); 9267f3363c1fa95aa06b6a90e1f07ad950e4e22a3aJohn Reck mUrlInput.setContainer(this); 93305b1c51f5e0d48a59d0e7c646b6cd0bc777a5dcMichael Kolb mUrlInput.setStateListener(this); 940f602f3933dcd88702fdb514b6611e3066ca7a2bJohn Reck mNeedsMenu = !ViewConfiguration.get(getContext()).hasPermanentMenuKey(); 95419f6b4136a8fac758e2159f223700b1dfcc20e2John Reck mIncognitoIcon = findViewById(R.id.incognito_icon); 9611d1978d8d16004598347abc93918b54a5ef760bMichael Kolb } 9711d1978d8d16004598347abc93918b54a5ef760bMichael Kolb 9811d1978d8d16004598347abc93918b54a5ef760bMichael Kolb @Override 990f602f3933dcd88702fdb514b6611e3066ca7a2bJohn Reck public void onProgressStarted() { 1000f602f3933dcd88702fdb514b6611e3066ca7a2bJohn Reck super.onProgressStarted(); 1010f602f3933dcd88702fdb514b6611e3066ca7a2bJohn Reck if (mStopButton.getDrawable() != mStopDrawable) { 1020f602f3933dcd88702fdb514b6611e3066ca7a2bJohn Reck mStopButton.setImageDrawable(mStopDrawable); 10330adae6ebf17a724d24066a200432e6b22a4eeffMichael Kolb mStopButton.setContentDescription(mStopDescription); 1040f602f3933dcd88702fdb514b6611e3066ca7a2bJohn Reck if (mStopButton.getVisibility() != View.VISIBLE) { 1050f602f3933dcd88702fdb514b6611e3066ca7a2bJohn Reck mComboIcon.setVisibility(View.GONE); 1060f602f3933dcd88702fdb514b6611e3066ca7a2bJohn Reck mStopButton.setVisibility(View.VISIBLE); 107305b1c51f5e0d48a59d0e7c646b6cd0bc777a5dcMichael Kolb } 1082814a362c21ac219410d9b54e1bd3e8152b845c7Michael Kolb } 1092814a362c21ac219410d9b54e1bd3e8152b845c7Michael Kolb } 1102814a362c21ac219410d9b54e1bd3e8152b845c7Michael Kolb 1110f602f3933dcd88702fdb514b6611e3066ca7a2bJohn Reck @Override 1120f602f3933dcd88702fdb514b6611e3066ca7a2bJohn Reck public void onProgressStopped() { 1130f602f3933dcd88702fdb514b6611e3066ca7a2bJohn Reck super.onProgressStopped(); 1140f602f3933dcd88702fdb514b6611e3066ca7a2bJohn Reck mStopButton.setImageDrawable(mRefreshDrawable); 11530adae6ebf17a724d24066a200432e6b22a4eeffMichael Kolb mStopButton.setContentDescription(mRefreshDescription); 1160f602f3933dcd88702fdb514b6611e3066ca7a2bJohn Reck if (!isEditingUrl()) { 1170f602f3933dcd88702fdb514b6611e3066ca7a2bJohn Reck mComboIcon.setVisibility(View.VISIBLE); 1180f602f3933dcd88702fdb514b6611e3066ca7a2bJohn Reck } 1195e8f2b9cf44263ac77a21653eb3c012a98c3587fMichael Kolb onStateChanged(mUrlInput.getState()); 1200f602f3933dcd88702fdb514b6611e3066ca7a2bJohn Reck } 1210f602f3933dcd88702fdb514b6611e3066ca7a2bJohn Reck 12211d1978d8d16004598347abc93918b54a5ef760bMichael Kolb /** 12311d1978d8d16004598347abc93918b54a5ef760bMichael Kolb * Update the text displayed in the title bar. 12411d1978d8d16004598347abc93918b54a5ef760bMichael Kolb * @param title String to display. If null, the new tab string will be 12511d1978d8d16004598347abc93918b54a5ef760bMichael Kolb * shown. 12611d1978d8d16004598347abc93918b54a5ef760bMichael Kolb */ 12711d1978d8d16004598347abc93918b54a5ef760bMichael Kolb @Override 12811d1978d8d16004598347abc93918b54a5ef760bMichael Kolb void setDisplayTitle(String title) { 129434e9f83e13c0758dcdefe214357fc9cc9f104d5John Reck mUrlInput.setTag(title); 13067f3363c1fa95aa06b6a90e1f07ad950e4e22a3aJohn Reck if (!isEditingUrl()) { 13167f3363c1fa95aa06b6a90e1f07ad950e4e22a3aJohn Reck if (title == null) { 13267f3363c1fa95aa06b6a90e1f07ad950e4e22a3aJohn Reck mUrlInput.setText(R.string.new_tab); 13367f3363c1fa95aa06b6a90e1f07ad950e4e22a3aJohn Reck } else { 134434e9f83e13c0758dcdefe214357fc9cc9f104d5John Reck mUrlInput.setText(UrlUtils.stripUrl(title), false); 13567f3363c1fa95aa06b6a90e1f07ad950e4e22a3aJohn Reck } 13667f3363c1fa95aa06b6a90e1f07ad950e4e22a3aJohn Reck mUrlInput.setSelection(0); 13711d1978d8d16004598347abc93918b54a5ef760bMichael Kolb } 13811d1978d8d16004598347abc93918b54a5ef760bMichael Kolb } 13911d1978d8d16004598347abc93918b54a5ef760bMichael Kolb 14011d1978d8d16004598347abc93918b54a5ef760bMichael Kolb @Override 14111d1978d8d16004598347abc93918b54a5ef760bMichael Kolb public void onClick(View v) { 14211d1978d8d16004598347abc93918b54a5ef760bMichael Kolb if (v == mStopButton) { 1430f602f3933dcd88702fdb514b6611e3066ca7a2bJohn Reck if (mTitleBar.isInLoad()) { 1442814a362c21ac219410d9b54e1bd3e8152b845c7Michael Kolb mUiController.stopLoading(); 1452814a362c21ac219410d9b54e1bd3e8152b845c7Michael Kolb } else { 1462814a362c21ac219410d9b54e1bd3e8152b845c7Michael Kolb WebView web = mBaseUi.getWebView(); 1472814a362c21ac219410d9b54e1bd3e8152b845c7Michael Kolb if (web != null) { 148305b1c51f5e0d48a59d0e7c646b6cd0bc777a5dcMichael Kolb stopEditingUrl(); 1492814a362c21ac219410d9b54e1bd3e8152b845c7Michael Kolb web.reload(); 1502814a362c21ac219410d9b54e1bd3e8152b845c7Michael Kolb } 1512814a362c21ac219410d9b54e1bd3e8152b845c7Michael Kolb } 1528ac4290069aa077f86d9ae67d764157bc48587daJohn Reck } else if (v == mTabSwitcher) { 15320be26d3aaa0ba44a0258e6eb490303330109587Michael Kolb ((PhoneUi) mBaseUi).toggleNavScreen(); 154017ffabc8af29b0cf14fecc6aad4a61acb8373a2Michael Kolb } else if (mMore == v) { 155ef654f1dd80f55609060005342fc4f2cde62990cJohn Reck showMenu(mMore); 15694ec527ac5b4d4ca245c878de4eb559658a55d4dMichael Kolb } else if (mClearButton == v) { 15794ec527ac5b4d4ca245c878de4eb559658a55d4dMichael Kolb mUrlInput.setText(""); 158315d502edce27bb4e93e53134f1a43b8f5c45588Michael Kolb } else if (mComboIcon == v) { 159315d502edce27bb4e93e53134f1a43b8f5c45588Michael Kolb mUiController.showPageInfo(); 1600b12912da64ff5b2917d4f50eb91df2e76457d08Michael Kolb } else if (mVoiceButton == v) { 1610b12912da64ff5b2917d4f50eb91df2e76457d08Michael Kolb mUiController.startVoiceRecognizer(); 16211d1978d8d16004598347abc93918b54a5ef760bMichael Kolb } else { 16311d1978d8d16004598347abc93918b54a5ef760bMichael Kolb super.onClick(v); 16411d1978d8d16004598347abc93918b54a5ef760bMichael Kolb } 16511d1978d8d16004598347abc93918b54a5ef760bMichael Kolb } 16611d1978d8d16004598347abc93918b54a5ef760bMichael Kolb 16758891907e3cf77b72f1107ef5d9f4c984cb176edJohn Reck @Override 168017ffabc8af29b0cf14fecc6aad4a61acb8373a2Michael Kolb public boolean isMenuShowing() { 16958891907e3cf77b72f1107ef5d9f4c984cb176edJohn Reck return super.isMenuShowing() || mOverflowMenuShowing; 1708441d4bdc99f8e4a84d8292c7c2a6cdf4e562fffMichael Kolb } 1718441d4bdc99f8e4a84d8292c7c2a6cdf4e562fffMichael Kolb 172ef654f1dd80f55609060005342fc4f2cde62990cJohn Reck void showMenu(View anchor) { 173e1a03a366ff90ebcd8568a86b84a5917610cf512John Reck Activity activity = mUiController.getActivity(); 174e1a03a366ff90ebcd8568a86b84a5917610cf512John Reck if (mPopupMenu == null) { 175e1a03a366ff90ebcd8568a86b84a5917610cf512John Reck mPopupMenu = new PopupMenu(mContext, anchor); 176e1a03a366ff90ebcd8568a86b84a5917610cf512John Reck mPopupMenu.setOnMenuItemClickListener(this); 177e1a03a366ff90ebcd8568a86b84a5917610cf512John Reck mPopupMenu.setOnDismissListener(this); 178e1a03a366ff90ebcd8568a86b84a5917610cf512John Reck if (!activity.onCreateOptionsMenu(mPopupMenu.getMenu())) { 179e1a03a366ff90ebcd8568a86b84a5917610cf512John Reck mPopupMenu = null; 180e1a03a366ff90ebcd8568a86b84a5917610cf512John Reck return; 181e1a03a366ff90ebcd8568a86b84a5917610cf512John Reck } 182e1a03a366ff90ebcd8568a86b84a5917610cf512John Reck } 1838441d4bdc99f8e4a84d8292c7c2a6cdf4e562fffMichael Kolb Menu menu = mPopupMenu.getMenu(); 184e1a03a366ff90ebcd8568a86b84a5917610cf512John Reck if (activity.onPrepareOptionsMenu(menu)) { 185e1a03a366ff90ebcd8568a86b84a5917610cf512John Reck mOverflowMenuShowing = true; 186e1a03a366ff90ebcd8568a86b84a5917610cf512John Reck mPopupMenu.show(); 187e1a03a366ff90ebcd8568a86b84a5917610cf512John Reck } 1888441d4bdc99f8e4a84d8292c7c2a6cdf4e562fffMichael Kolb } 1898441d4bdc99f8e4a84d8292c7c2a6cdf4e562fffMichael Kolb 190017ffabc8af29b0cf14fecc6aad4a61acb8373a2Michael Kolb @Override 191017ffabc8af29b0cf14fecc6aad4a61acb8373a2Michael Kolb public void onDismiss(PopupMenu menu) { 19258891907e3cf77b72f1107ef5d9f4c984cb176edJohn Reck if (menu == mPopupMenu) { 19358891907e3cf77b72f1107ef5d9f4c984cb176edJohn Reck onMenuHidden(); 19458891907e3cf77b72f1107ef5d9f4c984cb176edJohn Reck } 195017ffabc8af29b0cf14fecc6aad4a61acb8373a2Michael Kolb } 196017ffabc8af29b0cf14fecc6aad4a61acb8373a2Michael Kolb 197017ffabc8af29b0cf14fecc6aad4a61acb8373a2Michael Kolb private void onMenuHidden() { 19858891907e3cf77b72f1107ef5d9f4c984cb176edJohn Reck mOverflowMenuShowing = false; 199017ffabc8af29b0cf14fecc6aad4a61acb8373a2Michael Kolb mBaseUi.showTitleBarForDuration(); 200017ffabc8af29b0cf14fecc6aad4a61acb8373a2Michael Kolb } 201017ffabc8af29b0cf14fecc6aad4a61acb8373a2Michael Kolb 202305b1c51f5e0d48a59d0e7c646b6cd0bc777a5dcMichael Kolb @Override 203434e9f83e13c0758dcdefe214357fc9cc9f104d5John Reck public void onFocusChange(View view, boolean hasFocus) { 204434e9f83e13c0758dcdefe214357fc9cc9f104d5John Reck if (view == mUrlInput) { 2052fc7c16e96af8570105af6f6b3c5e1fdefe397f1Michael Kolb if (hasFocus && !mUrlInput.getText().toString().equals(mUrlInput.getTag())) { 2062fc7c16e96af8570105af6f6b3c5e1fdefe397f1Michael Kolb // only change text if different 207434e9f83e13c0758dcdefe214357fc9cc9f104d5John Reck mUrlInput.setText((String) mUrlInput.getTag(), false); 2082edc80c2ccca9030f8013328cc2e37bc374d3d92John Reck mUrlInput.selectAll(); 209434e9f83e13c0758dcdefe214357fc9cc9f104d5John Reck } else { 210434e9f83e13c0758dcdefe214357fc9cc9f104d5John Reck setDisplayTitle(mUrlInput.getText().toString()); 211434e9f83e13c0758dcdefe214357fc9cc9f104d5John Reck } 212434e9f83e13c0758dcdefe214357fc9cc9f104d5John Reck } 213434e9f83e13c0758dcdefe214357fc9cc9f104d5John Reck super.onFocusChange(view, hasFocus); 214434e9f83e13c0758dcdefe214357fc9cc9f104d5John Reck } 215434e9f83e13c0758dcdefe214357fc9cc9f104d5John Reck 216434e9f83e13c0758dcdefe214357fc9cc9f104d5John Reck @Override 217305b1c51f5e0d48a59d0e7c646b6cd0bc777a5dcMichael Kolb public void onStateChanged(int state) { 218e721cc3336e6364475d0b9b0d7a6e46758f0e0b0Michael Kolb mVoiceButton.setVisibility(View.GONE); 219305b1c51f5e0d48a59d0e7c646b6cd0bc777a5dcMichael Kolb switch(state) { 220305b1c51f5e0d48a59d0e7c646b6cd0bc777a5dcMichael Kolb case StateListener.STATE_NORMAL: 221305b1c51f5e0d48a59d0e7c646b6cd0bc777a5dcMichael Kolb mComboIcon.setVisibility(View.VISIBLE); 222305b1c51f5e0d48a59d0e7c646b6cd0bc777a5dcMichael Kolb mStopButton.setVisibility(View.GONE); 22394ec527ac5b4d4ca245c878de4eb559658a55d4dMichael Kolb mClearButton.setVisibility(View.GONE); 22494ec527ac5b4d4ca245c878de4eb559658a55d4dMichael Kolb mMagnify.setVisibility(View.GONE); 225305b1c51f5e0d48a59d0e7c646b6cd0bc777a5dcMichael Kolb mTabSwitcher.setVisibility(View.VISIBLE); 226305b1c51f5e0d48a59d0e7c646b6cd0bc777a5dcMichael Kolb mTitleContainer.setBackgroundDrawable(null); 227017ffabc8af29b0cf14fecc6aad4a61acb8373a2Michael Kolb mMore.setVisibility(mNeedsMenu ? View.VISIBLE : View.GONE); 228305b1c51f5e0d48a59d0e7c646b6cd0bc777a5dcMichael Kolb break; 229305b1c51f5e0d48a59d0e7c646b6cd0bc777a5dcMichael Kolb case StateListener.STATE_HIGHLIGHTED: 230305b1c51f5e0d48a59d0e7c646b6cd0bc777a5dcMichael Kolb mComboIcon.setVisibility(View.GONE); 231305b1c51f5e0d48a59d0e7c646b6cd0bc777a5dcMichael Kolb mStopButton.setVisibility(View.VISIBLE); 23294ec527ac5b4d4ca245c878de4eb559658a55d4dMichael Kolb mClearButton.setVisibility(View.GONE); 233e721cc3336e6364475d0b9b0d7a6e46758f0e0b0Michael Kolb if ((mUiController != null) && mUiController.supportsVoice()) { 234e721cc3336e6364475d0b9b0d7a6e46758f0e0b0Michael Kolb mVoiceButton.setVisibility(View.VISIBLE); 235e721cc3336e6364475d0b9b0d7a6e46758f0e0b0Michael Kolb } 23694ec527ac5b4d4ca245c878de4eb559658a55d4dMichael Kolb mMagnify.setVisibility(View.GONE); 237305b1c51f5e0d48a59d0e7c646b6cd0bc777a5dcMichael Kolb mTabSwitcher.setVisibility(View.GONE); 238017ffabc8af29b0cf14fecc6aad4a61acb8373a2Michael Kolb mMore.setVisibility(View.GONE); 239305b1c51f5e0d48a59d0e7c646b6cd0bc777a5dcMichael Kolb mTitleContainer.setBackgroundDrawable(mTextfieldBgDrawable); 240305b1c51f5e0d48a59d0e7c646b6cd0bc777a5dcMichael Kolb break; 241305b1c51f5e0d48a59d0e7c646b6cd0bc777a5dcMichael Kolb case StateListener.STATE_EDITED: 242305b1c51f5e0d48a59d0e7c646b6cd0bc777a5dcMichael Kolb mComboIcon.setVisibility(View.GONE); 243305b1c51f5e0d48a59d0e7c646b6cd0bc777a5dcMichael Kolb mStopButton.setVisibility(View.GONE); 24494ec527ac5b4d4ca245c878de4eb559658a55d4dMichael Kolb mClearButton.setVisibility(View.VISIBLE); 24594ec527ac5b4d4ca245c878de4eb559658a55d4dMichael Kolb mMagnify.setVisibility(View.VISIBLE); 246305b1c51f5e0d48a59d0e7c646b6cd0bc777a5dcMichael Kolb mTabSwitcher.setVisibility(View.GONE); 247017ffabc8af29b0cf14fecc6aad4a61acb8373a2Michael Kolb mMore.setVisibility(View.GONE); 248305b1c51f5e0d48a59d0e7c646b6cd0bc777a5dcMichael Kolb mTitleContainer.setBackgroundDrawable(mTextfieldBgDrawable); 249305b1c51f5e0d48a59d0e7c646b6cd0bc777a5dcMichael Kolb break; 2502814a362c21ac219410d9b54e1bd3e8152b845c7Michael Kolb } 2512814a362c21ac219410d9b54e1bd3e8152b845c7Michael Kolb } 252419f6b4136a8fac758e2159f223700b1dfcc20e2John Reck 253419f6b4136a8fac758e2159f223700b1dfcc20e2John Reck @Override 254419f6b4136a8fac758e2159f223700b1dfcc20e2John Reck public void onTabDataChanged(Tab tab) { 255419f6b4136a8fac758e2159f223700b1dfcc20e2John Reck super.onTabDataChanged(tab); 256419f6b4136a8fac758e2159f223700b1dfcc20e2John Reck mIncognitoIcon.setVisibility(tab.isPrivateBrowsingEnabled() 257419f6b4136a8fac758e2159f223700b1dfcc20e2John Reck ? View.VISIBLE : View.GONE); 258419f6b4136a8fac758e2159f223700b1dfcc20e2John Reck } 259419f6b4136a8fac758e2159f223700b1dfcc20e2John Reck 26042229bcdea8a1623d9ac3fce099793a3767fb14dJohn Reck @Override 26142229bcdea8a1623d9ac3fce099793a3767fb14dJohn Reck public boolean onMenuItemClick(MenuItem item) { 26242229bcdea8a1623d9ac3fce099793a3767fb14dJohn Reck return mUiController.onOptionsItemSelected(item); 26342229bcdea8a1623d9ac3fce099793a3767fb14dJohn Reck } 26442229bcdea8a1623d9ac3fce099793a3767fb14dJohn Reck 26511d1978d8d16004598347abc93918b54a5ef760bMichael Kolb} 266