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 | |
Michael Kolb | 11d1978 | 2011-03-20 10:17:40 -0700 | [diff] [blame] | 18 | import android.content.Context; |
Michael Kolb | 2814a36 | 2011-05-19 15:49:41 -0700 | [diff] [blame] | 19 | import android.content.res.Resources; |
| 20 | import android.graphics.drawable.Drawable; |
Kulanthaivel Palanichamy | f36e1db | 2015-04-08 16:11:06 -0700 | [diff] [blame] | 21 | import android.os.Handler; |
| 22 | import android.os.Message; |
John Reck | 0f602f3 | 2011-07-07 15:38:43 -0700 | [diff] [blame] | 23 | import android.util.AttributeSet; |
Enrico Ros | 1f5a095 | 2014-11-18 20:15:48 -0800 | [diff] [blame] | 24 | import android.util.TypedValue; |
Michael Kolb | 11d1978 | 2011-03-20 10:17:40 -0700 | [diff] [blame] | 25 | import android.view.View; |
Kulanthaivel Palanichamy | f36e1db | 2015-04-08 16:11:06 -0700 | [diff] [blame] | 26 | |
| 27 | import org.codeaurora.swe.WebRefiner; |
Bijan Amirzada | 9b1e988 | 2014-02-26 17:15:46 -0800 | [diff] [blame] | 28 | import org.codeaurora.swe.WebView; |
Enrico Ros | 1f5a095 | 2014-11-18 20:15:48 -0800 | [diff] [blame] | 29 | import org.codeaurora.swe.util.Activator; |
| 30 | import org.codeaurora.swe.util.Observable; |
Michael Kolb | 11d1978 | 2011-03-20 10:17:40 -0700 | [diff] [blame] | 31 | |
Enrico Ros | 1f5a095 | 2014-11-18 20:15:48 -0800 | [diff] [blame] | 32 | import android.widget.ImageView; |
| 33 | import android.widget.TextView; |
Bijan Amirzada | 41242f2 | 2014-03-21 12:12:18 -0700 | [diff] [blame] | 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 |
Enrico Ros | 1f5a095 | 2014-11-18 20:15:48 -0800 | [diff] [blame] | 37 | StateListener { |
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; |
Enrico Ros | 1f5a095 | 2014-11-18 20:15:48 -0800 | [diff] [blame] | 48 | private TextView mTabText; |
Michael Kolb | 305b1c5 | 2011-06-21 16:16:22 -0700 | [diff] [blame] | 49 | private View mComboIcon; |
John Reck | 419f6b4 | 2011-08-16 16:10:51 -0700 | [diff] [blame] | 50 | private View mIncognitoIcon; |
Enrico Ros | 1f5a095 | 2014-11-18 20:15:48 -0800 | [diff] [blame] | 51 | private float mTabSwitcherInitialTextSize = 0; |
| 52 | private float mTabSwitcherCompressedTextSize = 0; |
| 53 | |
Kulanthaivel Palanichamy | f36e1db | 2015-04-08 16:11:06 -0700 | [diff] [blame] | 54 | private static final int MSG_UPDATE_NOTIFICATION_COUNTER = 4242; |
| 55 | private static final int NOTIFICATION_COUNTER_UPDATE_DELAY = 3000; |
| 56 | private TextView mNotificationCounter; |
| 57 | private Handler mHandler; |
Michael Kolb | 11d1978 | 2011-03-20 10:17:40 -0700 | [diff] [blame] | 58 | |
John Reck | 0f602f3 | 2011-07-07 15:38:43 -0700 | [diff] [blame] | 59 | public NavigationBarPhone(Context context) { |
| 60 | super(context); |
| 61 | } |
| 62 | |
| 63 | public NavigationBarPhone(Context context, AttributeSet attrs) { |
| 64 | super(context, attrs); |
| 65 | } |
| 66 | |
| 67 | public NavigationBarPhone(Context context, AttributeSet attrs, int defStyle) { |
| 68 | super(context, attrs, defStyle); |
Michael Kolb | 11d1978 | 2011-03-20 10:17:40 -0700 | [diff] [blame] | 69 | } |
| 70 | |
| 71 | @Override |
John Reck | 0f602f3 | 2011-07-07 15:38:43 -0700 | [diff] [blame] | 72 | protected void onFinishInflate() { |
| 73 | super.onFinishInflate(); |
Michael Kolb | c16c595 | 2011-03-29 15:37:03 -0700 | [diff] [blame] | 74 | mStopButton = (ImageView) findViewById(R.id.stop); |
Michael Kolb | 11d1978 | 2011-03-20 10:17:40 -0700 | [diff] [blame] | 75 | mStopButton.setOnClickListener(this); |
Michael Kolb | 94ec527 | 2011-08-31 16:23:57 -0700 | [diff] [blame] | 76 | mClearButton = (ImageView) findViewById(R.id.clear); |
| 77 | mClearButton.setOnClickListener(this); |
Michael Kolb | 0b12912 | 2012-06-04 16:31:58 -0700 | [diff] [blame] | 78 | mVoiceButton = (ImageView) findViewById(R.id.voice); |
| 79 | mVoiceButton.setOnClickListener(this); |
Michael Kolb | 94ec527 | 2011-08-31 16:23:57 -0700 | [diff] [blame] | 80 | mMagnify = (ImageView) findViewById(R.id.magnify); |
John Reck | 8ac4290 | 2011-06-29 16:14:34 -0700 | [diff] [blame] | 81 | mTabSwitcher = findViewById(R.id.tab_switcher); |
| 82 | mTabSwitcher.setOnClickListener(this); |
Enrico Ros | 1f5a095 | 2014-11-18 20:15:48 -0800 | [diff] [blame] | 83 | mTabText = (TextView) findViewById(R.id.tab_switcher_text); |
Michael Kolb | 305b1c5 | 2011-06-21 16:16:22 -0700 | [diff] [blame] | 84 | mComboIcon = findViewById(R.id.iconcombo); |
Michael Kolb | 315d502 | 2011-10-13 12:47:11 -0700 | [diff] [blame] | 85 | mComboIcon.setOnClickListener(this); |
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(); |
Enrico Ros | 1f5a095 | 2014-11-18 20:15:48 -0800 | [diff] [blame] | 88 | mStopDrawable = res.getDrawable(R.drawable.ic_action_stop); |
| 89 | mRefreshDrawable = res.getDrawable(R.drawable.ic_action_reload); |
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); |
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 | 419f6b4 | 2011-08-16 16:10:51 -0700 | [diff] [blame] | 94 | mIncognitoIcon = findViewById(R.id.incognito_icon); |
Enrico Ros | 1f5a095 | 2014-11-18 20:15:48 -0800 | [diff] [blame] | 95 | |
| 96 | if (mTabSwitcherInitialTextSize == 0) { |
| 97 | mTabSwitcherInitialTextSize = mTabText.getTextSize(); |
| 98 | mTabSwitcherCompressedTextSize = (float) (mTabSwitcherInitialTextSize / 1.2); |
| 99 | } |
Kulanthaivel Palanichamy | f36e1db | 2015-04-08 16:11:06 -0700 | [diff] [blame] | 100 | |
| 101 | mNotificationCounter = (TextView) findViewById(R.id.notification_counter); |
| 102 | mHandler = new Handler() { |
| 103 | @Override |
| 104 | public void handleMessage(Message m) { |
| 105 | switch (m.what) { |
| 106 | case MSG_UPDATE_NOTIFICATION_COUNTER: |
| 107 | WebView wv = mUiController.getCurrentTopWebView(); |
| 108 | if (wv != null && WebRefiner.isInitialized()) { |
| 109 | int count = WebRefiner.getInstance().getBlockedURLCount(wv); |
| 110 | if (count > 0) { |
| 111 | mNotificationCounter.setText(String.valueOf(count)); |
| 112 | mNotificationCounter.setVisibility(View.VISIBLE); |
| 113 | } |
| 114 | } |
| 115 | mHandler.sendEmptyMessageDelayed(MSG_UPDATE_NOTIFICATION_COUNTER, NOTIFICATION_COUNTER_UPDATE_DELAY); |
| 116 | break; |
| 117 | } |
| 118 | } |
| 119 | }; |
Enrico Ros | 1f5a095 | 2014-11-18 20:15:48 -0800 | [diff] [blame] | 120 | } |
| 121 | |
| 122 | @Override |
| 123 | public void setTitleBar(TitleBar titleBar) { |
| 124 | super.setTitleBar(titleBar); |
| 125 | Activator.activate( |
| 126 | new Observable.Observer() { |
| 127 | @Override |
| 128 | public void onChange(Object... params) { |
| 129 | if ((Integer)params[0] > 9) { |
| 130 | mTabText.setTextSize(TypedValue.COMPLEX_UNIT_PX, mTabSwitcherCompressedTextSize); |
| 131 | } else { |
| 132 | mTabText.setTextSize(TypedValue.COMPLEX_UNIT_PX, mTabSwitcherInitialTextSize); |
| 133 | } |
| 134 | |
| 135 | mTabText.setText(Integer.toString((Integer) params[0])); |
| 136 | } |
| 137 | }, |
| 138 | mUiController.getTabControl().getTabCountObservable()); |
Michael Kolb | 11d1978 | 2011-03-20 10:17:40 -0700 | [diff] [blame] | 139 | } |
| 140 | |
| 141 | @Override |
John Reck | 0f602f3 | 2011-07-07 15:38:43 -0700 | [diff] [blame] | 142 | public void onProgressStarted() { |
| 143 | super.onProgressStarted(); |
Kulanthaivel Palanichamy | f36e1db | 2015-04-08 16:11:06 -0700 | [diff] [blame] | 144 | /*if (mStopButton.getDrawable() != mStopDrawable) { |
John Reck | 0f602f3 | 2011-07-07 15:38:43 -0700 | [diff] [blame] | 145 | mStopButton.setImageDrawable(mStopDrawable); |
Michael Kolb | 30adae6 | 2011-07-29 13:37:05 -0700 | [diff] [blame] | 146 | mStopButton.setContentDescription(mStopDescription); |
John Reck | 0f602f3 | 2011-07-07 15:38:43 -0700 | [diff] [blame] | 147 | if (mStopButton.getVisibility() != View.VISIBLE) { |
| 148 | mComboIcon.setVisibility(View.GONE); |
| 149 | mStopButton.setVisibility(View.VISIBLE); |
Michael Kolb | 305b1c5 | 2011-06-21 16:16:22 -0700 | [diff] [blame] | 150 | } |
Kulanthaivel Palanichamy | f36e1db | 2015-04-08 16:11:06 -0700 | [diff] [blame] | 151 | }*/ |
| 152 | mNotificationCounter.setVisibility(View.INVISIBLE); |
| 153 | mHandler.removeMessages(MSG_UPDATE_NOTIFICATION_COUNTER); |
| 154 | mHandler.sendEmptyMessageDelayed(MSG_UPDATE_NOTIFICATION_COUNTER, NOTIFICATION_COUNTER_UPDATE_DELAY); |
John Reck | 0f602f3 | 2011-07-07 15:38:43 -0700 | [diff] [blame] | 155 | } |
| 156 | |
| 157 | @Override |
| 158 | public void onProgressStopped() { |
| 159 | super.onProgressStopped(); |
Kulanthaivel Palanichamy | f36e1db | 2015-04-08 16:11:06 -0700 | [diff] [blame] | 160 | //mStopButton.setImageDrawable(mRefreshDrawable); |
| 161 | //mStopButton.setContentDescription(mRefreshDescription); |
John Reck | 0f602f3 | 2011-07-07 15:38:43 -0700 | [diff] [blame] | 162 | if (!isEditingUrl()) { |
| 163 | mComboIcon.setVisibility(View.VISIBLE); |
Michael Kolb | 2814a36 | 2011-05-19 15:49:41 -0700 | [diff] [blame] | 164 | } |
Michael Kolb | 5e8f2b9 | 2011-07-19 13:22:32 -0700 | [diff] [blame] | 165 | onStateChanged(mUrlInput.getState()); |
Michael Kolb | 2814a36 | 2011-05-19 15:49:41 -0700 | [diff] [blame] | 166 | } |
| 167 | |
Michael Kolb | 11d1978 | 2011-03-20 10:17:40 -0700 | [diff] [blame] | 168 | /** |
| 169 | * Update the text displayed in the title bar. |
| 170 | * @param title String to display. If null, the new tab string will be |
| 171 | * shown. |
| 172 | */ |
| 173 | @Override |
| 174 | void setDisplayTitle(String title) { |
John Reck | 434e9f8 | 2011-08-10 18:16:52 -0700 | [diff] [blame] | 175 | mUrlInput.setTag(title); |
John Reck | 67f3363 | 2011-06-17 16:23:42 -0700 | [diff] [blame] | 176 | if (!isEditingUrl()) { |
Vivek Sekhar | 60dca80 | 2014-06-27 14:48:30 -0700 | [diff] [blame] | 177 | // add for carrier requirement - show title from native instead of url |
| 178 | Tab currentTab = mUiController.getTabControl().getCurrentTab(); |
Panos Thomas | 4bdb525 | 2014-11-13 16:20:11 -0800 | [diff] [blame] | 179 | if (BrowserConfig.getInstance(getContext()) |
| 180 | .hasFeature(BrowserConfig.Feature.TITLE_IN_URL_BAR) && |
| 181 | currentTab != null && currentTab.getTitle() != null) { |
Vivek Sekhar | 60dca80 | 2014-06-27 14:48:30 -0700 | [diff] [blame] | 182 | mUrlInput.setText(currentTab.getTitle(), false); |
| 183 | } else if (title == null) { |
John Reck | 67f3363 | 2011-06-17 16:23:42 -0700 | [diff] [blame] | 184 | mUrlInput.setText(R.string.new_tab); |
| 185 | } else { |
Bijan Amirzada | e75909d | 2014-05-06 14:18:54 -0700 | [diff] [blame] | 186 | mUrlInput.setText(UrlUtils.stripUrl(title), false); |
John Reck | 67f3363 | 2011-06-17 16:23:42 -0700 | [diff] [blame] | 187 | } |
| 188 | mUrlInput.setSelection(0); |
Michael Kolb | 11d1978 | 2011-03-20 10:17:40 -0700 | [diff] [blame] | 189 | } |
| 190 | } |
| 191 | |
| 192 | @Override |
Michael Kolb | 11d1978 | 2011-03-20 10:17:40 -0700 | [diff] [blame] | 193 | public void onClick(View v) { |
| 194 | if (v == mStopButton) { |
John Reck | 0f602f3 | 2011-07-07 15:38:43 -0700 | [diff] [blame] | 195 | if (mTitleBar.isInLoad()) { |
Michael Kolb | 2814a36 | 2011-05-19 15:49:41 -0700 | [diff] [blame] | 196 | mUiController.stopLoading(); |
| 197 | } else { |
| 198 | WebView web = mBaseUi.getWebView(); |
| 199 | if (web != null) { |
Michael Kolb | 305b1c5 | 2011-06-21 16:16:22 -0700 | [diff] [blame] | 200 | stopEditingUrl(); |
Bijan Amirzada | 9b1e988 | 2014-02-26 17:15:46 -0800 | [diff] [blame] | 201 | Tab currentTab = mUiController.getTabControl().getCurrentTab(); |
Michael Kolb | 2814a36 | 2011-05-19 15:49:41 -0700 | [diff] [blame] | 202 | web.reload(); |
| 203 | } |
| 204 | } |
John Reck | 8ac4290 | 2011-06-29 16:14:34 -0700 | [diff] [blame] | 205 | } else if (v == mTabSwitcher) { |
Michael Kolb | 20be26d | 2011-07-18 16:38:02 -0700 | [diff] [blame] | 206 | ((PhoneUi) mBaseUi).toggleNavScreen(); |
Michael Kolb | 94ec527 | 2011-08-31 16:23:57 -0700 | [diff] [blame] | 207 | } else if (mClearButton == v) { |
| 208 | mUrlInput.setText(""); |
Michael Kolb | 315d502 | 2011-10-13 12:47:11 -0700 | [diff] [blame] | 209 | } else if (mComboIcon == v) { |
| 210 | mUiController.showPageInfo(); |
Michael Kolb | 0b12912 | 2012-06-04 16:31:58 -0700 | [diff] [blame] | 211 | } else if (mVoiceButton == v) { |
| 212 | mUiController.startVoiceRecognizer(); |
Michael Kolb | 11d1978 | 2011-03-20 10:17:40 -0700 | [diff] [blame] | 213 | } else { |
| 214 | super.onClick(v); |
| 215 | } |
| 216 | } |
| 217 | |
John Reck | 5889190 | 2011-08-11 17:48:53 -0700 | [diff] [blame] | 218 | @Override |
John Reck | 434e9f8 | 2011-08-10 18:16:52 -0700 | [diff] [blame] | 219 | public void onFocusChange(View view, boolean hasFocus) { |
Panos Thomas | 6ea3a42 | 2014-10-09 23:42:59 -0700 | [diff] [blame] | 220 | if (view == mUrlInput && !hasFocus) { |
| 221 | setDisplayTitle(mUrlInput.getText().toString()); |
John Reck | 434e9f8 | 2011-08-10 18:16:52 -0700 | [diff] [blame] | 222 | } |
| 223 | super.onFocusChange(view, hasFocus); |
| 224 | } |
| 225 | |
| 226 | @Override |
Michael Kolb | 305b1c5 | 2011-06-21 16:16:22 -0700 | [diff] [blame] | 227 | public void onStateChanged(int state) { |
Enrico Ros | 1f5a095 | 2014-11-18 20:15:48 -0800 | [diff] [blame] | 228 | super.onStateChanged(state); |
Michael Kolb | e721cc3 | 2012-06-26 15:26:59 -0700 | [diff] [blame] | 229 | mVoiceButton.setVisibility(View.GONE); |
Michael Kolb | 305b1c5 | 2011-06-21 16:16:22 -0700 | [diff] [blame] | 230 | switch(state) { |
| 231 | case StateListener.STATE_NORMAL: |
| 232 | mComboIcon.setVisibility(View.VISIBLE); |
| 233 | mStopButton.setVisibility(View.GONE); |
Michael Kolb | 94ec527 | 2011-08-31 16:23:57 -0700 | [diff] [blame] | 234 | mClearButton.setVisibility(View.GONE); |
| 235 | mMagnify.setVisibility(View.GONE); |
Michael Kolb | 305b1c5 | 2011-06-21 16:16:22 -0700 | [diff] [blame] | 236 | mTabSwitcher.setVisibility(View.VISIBLE); |
Enrico Ros | 1f5a095 | 2014-11-18 20:15:48 -0800 | [diff] [blame] | 237 | mTabText.setVisibility(View.VISIBLE); |
Pankaj Garg | 7b279f6 | 2014-08-12 14:47:18 -0700 | [diff] [blame] | 238 | if (mUiController != null) { |
Vivek Sekhar | b991edb | 2014-12-17 18:18:07 -0800 | [diff] [blame] | 239 | mUiController.setWindowDimming(0.0f); |
Pankaj Garg | 7b279f6 | 2014-08-12 14:47:18 -0700 | [diff] [blame] | 240 | } |
Michael Kolb | 305b1c5 | 2011-06-21 16:16:22 -0700 | [diff] [blame] | 241 | break; |
| 242 | case StateListener.STATE_HIGHLIGHTED: |
| 243 | mComboIcon.setVisibility(View.GONE); |
| 244 | mStopButton.setVisibility(View.VISIBLE); |
Michael Kolb | 94ec527 | 2011-08-31 16:23:57 -0700 | [diff] [blame] | 245 | mClearButton.setVisibility(View.GONE); |
Michael Kolb | e721cc3 | 2012-06-26 15:26:59 -0700 | [diff] [blame] | 246 | if ((mUiController != null) && mUiController.supportsVoice()) { |
| 247 | mVoiceButton.setVisibility(View.VISIBLE); |
| 248 | } |
Michael Kolb | 94ec527 | 2011-08-31 16:23:57 -0700 | [diff] [blame] | 249 | mMagnify.setVisibility(View.GONE); |
Michael Kolb | 305b1c5 | 2011-06-21 16:16:22 -0700 | [diff] [blame] | 250 | mTabSwitcher.setVisibility(View.GONE); |
Enrico Ros | 1f5a095 | 2014-11-18 20:15:48 -0800 | [diff] [blame] | 251 | mTabText.setVisibility(View.GONE); |
Pankaj Garg | 7b279f6 | 2014-08-12 14:47:18 -0700 | [diff] [blame] | 252 | |
Panos Thomas | 6ea3a42 | 2014-10-09 23:42:59 -0700 | [diff] [blame] | 253 | if (!mUrlInput.getText().toString().equals(mUrlInput.getTag())) { |
| 254 | // only change text if different |
| 255 | mUrlInput.setText((String) mUrlInput.getTag(), false); |
| 256 | mUrlInput.selectAll(); |
| 257 | } |
Pankaj Garg | 7b279f6 | 2014-08-12 14:47:18 -0700 | [diff] [blame] | 258 | |
| 259 | if (mUiController != null) { |
| 260 | mUiController.setWindowDimming(0.75f); |
| 261 | } |
Michael Kolb | 305b1c5 | 2011-06-21 16:16:22 -0700 | [diff] [blame] | 262 | break; |
| 263 | case StateListener.STATE_EDITED: |
| 264 | mComboIcon.setVisibility(View.GONE); |
| 265 | mStopButton.setVisibility(View.GONE); |
Michael Kolb | 94ec527 | 2011-08-31 16:23:57 -0700 | [diff] [blame] | 266 | mClearButton.setVisibility(View.VISIBLE); |
| 267 | mMagnify.setVisibility(View.VISIBLE); |
Michael Kolb | 305b1c5 | 2011-06-21 16:16:22 -0700 | [diff] [blame] | 268 | mTabSwitcher.setVisibility(View.GONE); |
Enrico Ros | 1f5a095 | 2014-11-18 20:15:48 -0800 | [diff] [blame] | 269 | mTabText.setVisibility(View.GONE); |
Michael Kolb | 305b1c5 | 2011-06-21 16:16:22 -0700 | [diff] [blame] | 270 | break; |
Michael Kolb | 2814a36 | 2011-05-19 15:49:41 -0700 | [diff] [blame] | 271 | } |
| 272 | } |
John Reck | 419f6b4 | 2011-08-16 16:10:51 -0700 | [diff] [blame] | 273 | |
| 274 | @Override |
| 275 | public void onTabDataChanged(Tab tab) { |
| 276 | super.onTabDataChanged(tab); |
Enrico Ros | d6efa97 | 2014-12-02 19:49:59 -0800 | [diff] [blame] | 277 | boolean isPrivate = tab.isPrivateBrowsingEnabled(); |
| 278 | mIncognitoIcon.setVisibility(isPrivate ? View.VISIBLE : View.GONE); |
| 279 | // change the background to a darker tone to reflect the 'incognito' state |
| 280 | setBackgroundColor(getResources().getColor(isPrivate ? |
| 281 | R.color.NavigationBarBackgroundIncognito : R.color.NavigationBarBackground)); |
| 282 | |
John Reck | 419f6b4 | 2011-08-16 16:10:51 -0700 | [diff] [blame] | 283 | } |
Michael Kolb | 11d1978 | 2011-03-20 10:17:40 -0700 | [diff] [blame] | 284 | } |