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()) { |
Vivek Sekhar | 60dca80 | 2014-06-27 14:48:30 -0700 | [diff] [blame] | 132 | // add for carrier requirement - show title from native instead of url |
| 133 | Tab currentTab = mUiController.getTabControl().getCurrentTab(); |
| 134 | if (currentTab != null && currentTab.getTitle() != null) { |
| 135 | mUrlInput.setText(currentTab.getTitle(), false); |
| 136 | } else if (title == null) { |
John Reck | 67f3363 | 2011-06-17 16:23:42 -0700 | [diff] [blame] | 137 | mUrlInput.setText(R.string.new_tab); |
| 138 | } else { |
Bijan Amirzada | e75909d | 2014-05-06 14:18:54 -0700 | [diff] [blame] | 139 | mUrlInput.setText(UrlUtils.stripUrl(title), false); |
John Reck | 67f3363 | 2011-06-17 16:23:42 -0700 | [diff] [blame] | 140 | } |
| 141 | mUrlInput.setSelection(0); |
Michael Kolb | 11d1978 | 2011-03-20 10:17:40 -0700 | [diff] [blame] | 142 | } |
| 143 | } |
| 144 | |
| 145 | @Override |
Michael Kolb | 11d1978 | 2011-03-20 10:17:40 -0700 | [diff] [blame] | 146 | public void onClick(View v) { |
| 147 | if (v == mStopButton) { |
John Reck | 0f602f3 | 2011-07-07 15:38:43 -0700 | [diff] [blame] | 148 | if (mTitleBar.isInLoad()) { |
Michael Kolb | 2814a36 | 2011-05-19 15:49:41 -0700 | [diff] [blame] | 149 | mUiController.stopLoading(); |
| 150 | } else { |
| 151 | WebView web = mBaseUi.getWebView(); |
| 152 | if (web != null) { |
Michael Kolb | 305b1c5 | 2011-06-21 16:16:22 -0700 | [diff] [blame] | 153 | stopEditingUrl(); |
Bijan Amirzada | 9b1e988 | 2014-02-26 17:15:46 -0800 | [diff] [blame] | 154 | Tab currentTab = mUiController.getTabControl().getCurrentTab(); |
| 155 | if (currentTab.hasCrashed) { |
| 156 | currentTab.replaceCrashView(web, currentTab.getViewContainer()); |
| 157 | } |
Michael Kolb | 2814a36 | 2011-05-19 15:49:41 -0700 | [diff] [blame] | 158 | web.reload(); |
| 159 | } |
| 160 | } |
John Reck | 8ac4290 | 2011-06-29 16:14:34 -0700 | [diff] [blame] | 161 | } else if (v == mTabSwitcher) { |
Michael Kolb | 20be26d | 2011-07-18 16:38:02 -0700 | [diff] [blame] | 162 | ((PhoneUi) mBaseUi).toggleNavScreen(); |
Michael Kolb | 017ffab | 2011-07-11 15:26:47 -0700 | [diff] [blame] | 163 | } else if (mMore == v) { |
John Reck | ef654f1 | 2011-07-12 16:42:08 -0700 | [diff] [blame] | 164 | showMenu(mMore); |
Michael Kolb | 94ec527 | 2011-08-31 16:23:57 -0700 | [diff] [blame] | 165 | } else if (mClearButton == v) { |
| 166 | mUrlInput.setText(""); |
Michael Kolb | 315d502 | 2011-10-13 12:47:11 -0700 | [diff] [blame] | 167 | } else if (mComboIcon == v) { |
| 168 | mUiController.showPageInfo(); |
Michael Kolb | 0b12912 | 2012-06-04 16:31:58 -0700 | [diff] [blame] | 169 | } else if (mVoiceButton == v) { |
| 170 | mUiController.startVoiceRecognizer(); |
Michael Kolb | 11d1978 | 2011-03-20 10:17:40 -0700 | [diff] [blame] | 171 | } else { |
| 172 | super.onClick(v); |
| 173 | } |
| 174 | } |
| 175 | |
John Reck | 5889190 | 2011-08-11 17:48:53 -0700 | [diff] [blame] | 176 | @Override |
Michael Kolb | 017ffab | 2011-07-11 15:26:47 -0700 | [diff] [blame] | 177 | public boolean isMenuShowing() { |
John Reck | 5889190 | 2011-08-11 17:48:53 -0700 | [diff] [blame] | 178 | return super.isMenuShowing() || mOverflowMenuShowing; |
Michael Kolb | 8441d4b | 2011-07-18 14:50:21 -0700 | [diff] [blame] | 179 | } |
| 180 | |
John Reck | ef654f1 | 2011-07-12 16:42:08 -0700 | [diff] [blame] | 181 | void showMenu(View anchor) { |
John Reck | e1a03a3 | 2011-09-14 17:04:16 -0700 | [diff] [blame] | 182 | Activity activity = mUiController.getActivity(); |
| 183 | if (mPopupMenu == null) { |
Bijan Amirzada | 9b1e988 | 2014-02-26 17:15:46 -0800 | [diff] [blame] | 184 | mPopupMenu = new PopupMenu(getContext(), anchor); |
John Reck | e1a03a3 | 2011-09-14 17:04:16 -0700 | [diff] [blame] | 185 | mPopupMenu.setOnMenuItemClickListener(this); |
| 186 | mPopupMenu.setOnDismissListener(this); |
| 187 | if (!activity.onCreateOptionsMenu(mPopupMenu.getMenu())) { |
| 188 | mPopupMenu = null; |
| 189 | return; |
| 190 | } |
| 191 | } |
Michael Kolb | 8441d4b | 2011-07-18 14:50:21 -0700 | [diff] [blame] | 192 | Menu menu = mPopupMenu.getMenu(); |
John Reck | e1a03a3 | 2011-09-14 17:04:16 -0700 | [diff] [blame] | 193 | if (activity.onPrepareOptionsMenu(menu)) { |
| 194 | mOverflowMenuShowing = true; |
| 195 | mPopupMenu.show(); |
| 196 | } |
Michael Kolb | 8441d4b | 2011-07-18 14:50:21 -0700 | [diff] [blame] | 197 | } |
| 198 | |
Michael Kolb | 017ffab | 2011-07-11 15:26:47 -0700 | [diff] [blame] | 199 | @Override |
| 200 | public void onDismiss(PopupMenu menu) { |
John Reck | 5889190 | 2011-08-11 17:48:53 -0700 | [diff] [blame] | 201 | if (menu == mPopupMenu) { |
| 202 | onMenuHidden(); |
| 203 | } |
Michael Kolb | 017ffab | 2011-07-11 15:26:47 -0700 | [diff] [blame] | 204 | } |
| 205 | |
Michael Kolb | 017ffab | 2011-07-11 15:26:47 -0700 | [diff] [blame] | 206 | private void onMenuHidden() { |
John Reck | 5889190 | 2011-08-11 17:48:53 -0700 | [diff] [blame] | 207 | mOverflowMenuShowing = false; |
Michael Kolb | 017ffab | 2011-07-11 15:26:47 -0700 | [diff] [blame] | 208 | mBaseUi.showTitleBarForDuration(); |
| 209 | } |
| 210 | |
Michael Kolb | 305b1c5 | 2011-06-21 16:16:22 -0700 | [diff] [blame] | 211 | @Override |
John Reck | 434e9f8 | 2011-08-10 18:16:52 -0700 | [diff] [blame] | 212 | public void onFocusChange(View view, boolean hasFocus) { |
Panos Thomas | 6ea3a42 | 2014-10-09 23:42:59 -0700 | [diff] [blame] | 213 | if (view == mUrlInput && !hasFocus) { |
| 214 | setDisplayTitle(mUrlInput.getText().toString()); |
John Reck | 434e9f8 | 2011-08-10 18:16:52 -0700 | [diff] [blame] | 215 | } |
| 216 | super.onFocusChange(view, hasFocus); |
| 217 | } |
| 218 | |
| 219 | @Override |
Michael Kolb | 305b1c5 | 2011-06-21 16:16:22 -0700 | [diff] [blame] | 220 | public void onStateChanged(int state) { |
Michael Kolb | e721cc3 | 2012-06-26 15:26:59 -0700 | [diff] [blame] | 221 | mVoiceButton.setVisibility(View.GONE); |
Michael Kolb | 305b1c5 | 2011-06-21 16:16:22 -0700 | [diff] [blame] | 222 | switch(state) { |
| 223 | case StateListener.STATE_NORMAL: |
| 224 | mComboIcon.setVisibility(View.VISIBLE); |
| 225 | mStopButton.setVisibility(View.GONE); |
Michael Kolb | 94ec527 | 2011-08-31 16:23:57 -0700 | [diff] [blame] | 226 | mClearButton.setVisibility(View.GONE); |
| 227 | mMagnify.setVisibility(View.GONE); |
Michael Kolb | 305b1c5 | 2011-06-21 16:16:22 -0700 | [diff] [blame] | 228 | mTabSwitcher.setVisibility(View.VISIBLE); |
| 229 | mTitleContainer.setBackgroundDrawable(null); |
Michael Kolb | 017ffab | 2011-07-11 15:26:47 -0700 | [diff] [blame] | 230 | mMore.setVisibility(mNeedsMenu ? View.VISIBLE : View.GONE); |
Pankaj Garg | 7b279f6 | 2014-08-12 14:47:18 -0700 | [diff] [blame] | 231 | if (mUiController != null) { |
| 232 | mUiController.setWindowDimming(0f); |
| 233 | } |
Michael Kolb | 305b1c5 | 2011-06-21 16:16:22 -0700 | [diff] [blame] | 234 | break; |
| 235 | case StateListener.STATE_HIGHLIGHTED: |
| 236 | mComboIcon.setVisibility(View.GONE); |
| 237 | mStopButton.setVisibility(View.VISIBLE); |
Michael Kolb | 94ec527 | 2011-08-31 16:23:57 -0700 | [diff] [blame] | 238 | mClearButton.setVisibility(View.GONE); |
Michael Kolb | e721cc3 | 2012-06-26 15:26:59 -0700 | [diff] [blame] | 239 | if ((mUiController != null) && mUiController.supportsVoice()) { |
| 240 | mVoiceButton.setVisibility(View.VISIBLE); |
| 241 | } |
Michael Kolb | 94ec527 | 2011-08-31 16:23:57 -0700 | [diff] [blame] | 242 | mMagnify.setVisibility(View.GONE); |
Michael Kolb | 305b1c5 | 2011-06-21 16:16:22 -0700 | [diff] [blame] | 243 | mTabSwitcher.setVisibility(View.GONE); |
Michael Kolb | 017ffab | 2011-07-11 15:26:47 -0700 | [diff] [blame] | 244 | mMore.setVisibility(View.GONE); |
Michael Kolb | 305b1c5 | 2011-06-21 16:16:22 -0700 | [diff] [blame] | 245 | mTitleContainer.setBackgroundDrawable(mTextfieldBgDrawable); |
Pankaj Garg | 7b279f6 | 2014-08-12 14:47:18 -0700 | [diff] [blame] | 246 | |
Panos Thomas | 6ea3a42 | 2014-10-09 23:42:59 -0700 | [diff] [blame] | 247 | if (!mUrlInput.getText().toString().equals(mUrlInput.getTag())) { |
| 248 | // only change text if different |
| 249 | mUrlInput.setText((String) mUrlInput.getTag(), false); |
| 250 | mUrlInput.selectAll(); |
| 251 | } |
Pankaj Garg | 7b279f6 | 2014-08-12 14:47:18 -0700 | [diff] [blame] | 252 | |
| 253 | if (mUiController != null) { |
| 254 | mUiController.setWindowDimming(0.75f); |
| 255 | } |
Michael Kolb | 305b1c5 | 2011-06-21 16:16:22 -0700 | [diff] [blame] | 256 | break; |
| 257 | case StateListener.STATE_EDITED: |
| 258 | mComboIcon.setVisibility(View.GONE); |
| 259 | mStopButton.setVisibility(View.GONE); |
Michael Kolb | 94ec527 | 2011-08-31 16:23:57 -0700 | [diff] [blame] | 260 | mClearButton.setVisibility(View.VISIBLE); |
| 261 | mMagnify.setVisibility(View.VISIBLE); |
Michael Kolb | 305b1c5 | 2011-06-21 16:16:22 -0700 | [diff] [blame] | 262 | mTabSwitcher.setVisibility(View.GONE); |
Michael Kolb | 017ffab | 2011-07-11 15:26:47 -0700 | [diff] [blame] | 263 | mMore.setVisibility(View.GONE); |
Michael Kolb | 305b1c5 | 2011-06-21 16:16:22 -0700 | [diff] [blame] | 264 | mTitleContainer.setBackgroundDrawable(mTextfieldBgDrawable); |
| 265 | break; |
Michael Kolb | 2814a36 | 2011-05-19 15:49:41 -0700 | [diff] [blame] | 266 | } |
| 267 | } |
John Reck | 419f6b4 | 2011-08-16 16:10:51 -0700 | [diff] [blame] | 268 | |
| 269 | @Override |
| 270 | public void onTabDataChanged(Tab tab) { |
| 271 | super.onTabDataChanged(tab); |
| 272 | mIncognitoIcon.setVisibility(tab.isPrivateBrowsingEnabled() |
| 273 | ? View.VISIBLE : View.GONE); |
| 274 | } |
| 275 | |
John Reck | 42229bc | 2011-08-19 13:26:43 -0700 | [diff] [blame] | 276 | @Override |
| 277 | public boolean onMenuItemClick(MenuItem item) { |
| 278 | return mUiController.onOptionsItemSelected(item); |
| 279 | } |
| 280 | |
Michael Kolb | 11d1978 | 2011-03-20 10:17:40 -0700 | [diff] [blame] | 281 | } |