blob: 03d44a66daeaa3c689a363822764fb57f24e4aa1 [file] [log] [blame]
Leon Scroggins81db3662009-06-04 17:45:11 -04001/*
2 * Copyright (C) 2009 The Android Open Source Project
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 */
16
17package com.android.browser;
18
19import android.content.Context;
Leon Scroggins11e71b12010-01-25 10:40:38 -050020import android.content.Intent;
21import android.content.pm.PackageManager;
22import android.content.pm.ResolveInfo;
Leon Scroggins3bbb6ca2009-09-09 12:51:10 -040023import android.content.res.Resources;
24import android.graphics.Bitmap;
25import android.graphics.Color;
Leon Scroggins1f005d32009-08-10 17:36:42 -040026import android.graphics.Rect;
Leon Scroggins62e8f942009-09-03 15:08:54 -040027import android.graphics.drawable.Animatable;
Leon Scroggins3bbb6ca2009-09-09 12:51:10 -040028import android.graphics.drawable.BitmapDrawable;
Leon Scroggins81db3662009-06-04 17:45:11 -040029import android.graphics.drawable.Drawable;
Leon Scroggins3bbb6ca2009-09-09 12:51:10 -040030import android.graphics.drawable.LayerDrawable;
31import android.graphics.drawable.PaintDrawable;
Leon Scrogginsc6fa1102009-09-21 10:40:01 -040032import android.os.Handler;
33import android.os.Message;
Leon Scroggins11e71b12010-01-25 10:40:38 -050034import android.speech.RecognizerIntent;
Leon Scrogginsf48d44e2010-02-05 16:41:49 -050035import android.text.SpannableString;
36import android.text.Spanned;
Leon Scroggins76e16862010-02-08 14:39:34 -050037import android.text.TextUtils;
Leon Scrogginsf48d44e2010-02-05 16:41:49 -050038import android.text.style.ImageSpan;
Leon Scroggins3bbb6ca2009-09-09 12:51:10 -040039import android.util.TypedValue;
Leon Scrogginsc6fa1102009-09-21 10:40:01 -040040import android.view.ContextMenu;
Leon Scrogginse4b3bda2009-06-09 15:46:41 -040041import android.view.LayoutInflater;
Leon Scrogginsc6fa1102009-09-21 10:40:01 -040042import android.view.MenuInflater;
Leon Scroggins68579392009-09-15 15:31:54 -040043import android.view.MotionEvent;
Leon Scrogginse4b3bda2009-06-09 15:46:41 -040044import android.view.View;
Leon Scroggins68579392009-09-15 15:31:54 -040045import android.view.ViewConfiguration;
Leon Scroggins81db3662009-06-04 17:45:11 -040046import android.widget.ImageView;
47import android.widget.LinearLayout;
48import android.widget.ProgressBar;
49import android.widget.TextView;
Leon Scroggins81db3662009-06-04 17:45:11 -040050
Leon Scroggins1fe13a52010-02-09 15:31:26 -050051import com.android.common.speech.LoggingEvents;
52
Leon Scroggins1f005d32009-08-10 17:36:42 -040053/**
54 * This class represents a title bar for a particular "tab" or "window" in the
55 * browser.
56 */
Leon Scrogginse4b3bda2009-06-09 15:46:41 -040057public class TitleBar extends LinearLayout {
Leon Scroggins81db3662009-06-04 17:45:11 -040058 private TextView mTitle;
Leon Scroggins1f005d32009-08-10 17:36:42 -040059 private Drawable mCloseDrawable;
60 private ImageView mRtButton;
Leon Scroggins62e8f942009-09-03 15:08:54 -040061 private Drawable mCircularProgress;
Leon Scroggins81db3662009-06-04 17:45:11 -040062 private ProgressBar mHorizontalProgress;
Leon Scrogginsf4bb18a2009-09-11 18:37:53 -040063 private ImageView mFavicon;
Leon Scroggins62e8f942009-09-03 15:08:54 -040064 private ImageView mLockIcon;
Leon Scrogginsb3b04f72010-03-03 17:17:18 -050065 private ImageView mStopButton;
Leon Scrogginsa81a7642009-08-31 17:05:41 -040066 private Drawable mBookmarkDrawable;
Leon Scroggins11e71b12010-01-25 10:40:38 -050067 private Drawable mVoiceDrawable;
Leon Scroggins81db3662009-06-04 17:45:11 -040068 private boolean mInLoad;
Leon Scrogginsa81a7642009-08-31 17:05:41 -040069 private BrowserActivity mBrowserActivity;
Leon Scroggins3bbb6ca2009-09-09 12:51:10 -040070 private Drawable mGenericFavicon;
71 private int mIconDimension;
Leon Scroggins68579392009-09-15 15:31:54 -040072 private View mTitleBg;
Leon Scrogginsc6fa1102009-09-21 10:40:01 -040073 private MyHandler mHandler;
Leon Scroggins11e71b12010-01-25 10:40:38 -050074 private Intent mVoiceSearchIntent;
75 private boolean mInVoiceMode;
Leon Scroggins58d56c62010-01-28 15:12:40 -050076 private Drawable mVoiceModeBackground;
77 private Drawable mNormalBackground;
Leon Scrogginsb3b04f72010-03-03 17:17:18 -050078 private Drawable mLoadingBackground;
Leon Scrogginsf48d44e2010-02-05 16:41:49 -050079 private ImageSpan mArcsSpan;
Leon Scrogginsc6fa1102009-09-21 10:40:01 -040080
81 private static int LONG_PRESS = 1;
Leon Scroggins81db3662009-06-04 17:45:11 -040082
Leon Scroggins68579392009-09-15 15:31:54 -040083 public TitleBar(BrowserActivity context) {
Leon Scroggins1f005d32009-08-10 17:36:42 -040084 super(context, null);
Leon Scrogginsc6fa1102009-09-21 10:40:01 -040085 mHandler = new MyHandler();
Leon Scroggins81db3662009-06-04 17:45:11 -040086 LayoutInflater factory = LayoutInflater.from(context);
87 factory.inflate(R.layout.title_bar, this);
Leon Scroggins3bbb6ca2009-09-09 12:51:10 -040088 mBrowserActivity = context;
Leon Scroggins81db3662009-06-04 17:45:11 -040089
90 mTitle = (TextView) findViewById(R.id.title);
Leon Scrogginsa81a7642009-08-31 17:05:41 -040091 mTitle.setCompoundDrawablePadding(5);
Leon Scroggins81db3662009-06-04 17:45:11 -040092
Leon Scroggins68579392009-09-15 15:31:54 -040093 mTitleBg = findViewById(R.id.title_bg);
Leon Scroggins62e8f942009-09-03 15:08:54 -040094 mLockIcon = (ImageView) findViewById(R.id.lock);
Leon Scrogginsf4bb18a2009-09-11 18:37:53 -040095 mFavicon = (ImageView) findViewById(R.id.favicon);
Leon Scrogginsb3b04f72010-03-03 17:17:18 -050096 mStopButton = (ImageView) findViewById(R.id.stop);
Leon Scroggins62e8f942009-09-03 15:08:54 -040097
Leon Scrogginsa81a7642009-08-31 17:05:41 -040098 mRtButton = (ImageView) findViewById(R.id.rt_btn);
Leon Scroggins3bbb6ca2009-09-09 12:51:10 -040099 Resources resources = context.getResources();
100 mCircularProgress = (Drawable) resources.getDrawable(
Leon Scroggins62e8f942009-09-03 15:08:54 -0400101 com.android.internal.R.drawable.search_spinner);
Leon Scroggins3bbb6ca2009-09-09 12:51:10 -0400102 mIconDimension = (int) TypedValue.applyDimension(
103 TypedValue.COMPLEX_UNIT_DIP, 20f,
104 resources.getDisplayMetrics());
105 mCircularProgress.setBounds(0, 0, mIconDimension, mIconDimension);
Leon Scroggins81db3662009-06-04 17:45:11 -0400106 mHorizontalProgress = (ProgressBar) findViewById(
107 R.id.progress_horizontal);
Leon Scroggins3bbb6ca2009-09-09 12:51:10 -0400108 mGenericFavicon = context.getResources().getDrawable(
109 R.drawable.app_web_browser_sm);
Leon Scroggins11e71b12010-01-25 10:40:38 -0500110 mVoiceSearchIntent = new Intent(RecognizerIntent.ACTION_WEB_SEARCH);
111 mVoiceSearchIntent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL,
112 RecognizerIntent.LANGUAGE_MODEL_WEB_SEARCH);
113 PackageManager pm = context.getPackageManager();
114 ResolveInfo ri = pm.resolveActivity(mVoiceSearchIntent,
115 PackageManager.MATCH_DEFAULT_ONLY);
116 if (ri == null) {
117 mVoiceSearchIntent = null;
118 } else {
119 mVoiceDrawable = resources.getDrawable(
120 android.R.drawable.ic_btn_speak_now);
121 }
Leon Scroggins11e71b12010-01-25 10:40:38 -0500122 mBookmarkDrawable = mRtButton.getDrawable();
Leon Scroggins58d56c62010-01-28 15:12:40 -0500123 mVoiceModeBackground = resources.getDrawable(
Leon Scrogginsf48d44e2010-02-05 16:41:49 -0500124 R.drawable.title_voice);
Leon Scroggins58d56c62010-01-28 15:12:40 -0500125 mNormalBackground = mTitleBg.getBackground();
Leon Scrogginsb3b04f72010-03-03 17:17:18 -0500126 mLoadingBackground = resources.getDrawable(R.drawable.title_loading);
Leon Scrogginsf48d44e2010-02-05 16:41:49 -0500127 mArcsSpan = new ImageSpan(context, R.drawable.arcs,
128 ImageSpan.ALIGN_BASELINE);
Leon Scrogginse4b3bda2009-06-09 15:46:41 -0400129 }
130
Leon Scrogginsc6fa1102009-09-21 10:40:01 -0400131 private class MyHandler extends Handler {
132 public void handleMessage(Message msg) {
133 if (msg.what == LONG_PRESS) {
134 // Prevent the normal action from happening by setting the title
135 // bar's state to false.
136 mTitleBg.setPressed(false);
137 // Need to call a special method on BrowserActivity for when the
138 // fake title bar is up, because its ViewGroup does not show a
139 // context menu.
140 mBrowserActivity.showTitleBarContextMenu();
141 }
142 }
143 };
144
145 @Override
Leon Scroggins4e9f89b2010-02-22 16:54:14 -0500146 public void createContextMenu(ContextMenu menu) {
Leon Scrogginsc6fa1102009-09-21 10:40:01 -0400147 MenuInflater inflater = mBrowserActivity.getMenuInflater();
148 inflater.inflate(R.menu.title_context, menu);
Leon Scroggins4e9f89b2010-02-22 16:54:14 -0500149 mBrowserActivity.onCreateContextMenu(menu, this, null);
Leon Scrogginsc6fa1102009-09-21 10:40:01 -0400150 }
151
Leon Scroggins68579392009-09-15 15:31:54 -0400152 @Override
153 public boolean onTouchEvent(MotionEvent event) {
154 switch (event.getAction()) {
155 case MotionEvent.ACTION_DOWN:
156 // Make all touches hit either the textfield or the button,
157 // depending on which side of the right edge of the textfield
158 // they hit.
159 if ((int) event.getX() > mTitleBg.getRight()) {
160 mRtButton.setPressed(true);
161 } else {
162 mTitleBg.setPressed(true);
Leon Scrogginsc6fa1102009-09-21 10:40:01 -0400163 mHandler.sendMessageDelayed(mHandler.obtainMessage(
164 LONG_PRESS),
165 ViewConfiguration.getLongPressTimeout());
Leon Scroggins68579392009-09-15 15:31:54 -0400166 }
167 break;
168 case MotionEvent.ACTION_MOVE:
169 int slop = ViewConfiguration.get(mBrowserActivity)
170 .getScaledTouchSlop();
171 if ((int) event.getY() > getHeight() + slop) {
172 // We only trigger the actions in ACTION_UP if one or the
173 // other is pressed. Since the user moved off the title
174 // bar, mark both as not pressed.
175 mTitleBg.setPressed(false);
176 mRtButton.setPressed(false);
Leon Scrogginsc6fa1102009-09-21 10:40:01 -0400177 mHandler.removeMessages(LONG_PRESS);
Leon Scroggins68579392009-09-15 15:31:54 -0400178 break;
179 }
180 int x = (int) event.getX();
181 int titleRight = mTitleBg.getRight();
182 if (mTitleBg.isPressed() && x > titleRight + slop) {
183 mTitleBg.setPressed(false);
Leon Scrogginsc6fa1102009-09-21 10:40:01 -0400184 mHandler.removeMessages(LONG_PRESS);
Leon Scroggins68579392009-09-15 15:31:54 -0400185 } else if (mRtButton.isPressed() && x < titleRight - slop) {
186 mRtButton.setPressed(false);
187 }
188 break;
189 case MotionEvent.ACTION_CANCEL:
190 mRtButton.setPressed(false);
191 mTitleBg.setPressed(false);
Leon Scrogginsc6fa1102009-09-21 10:40:01 -0400192 mHandler.removeMessages(LONG_PRESS);
Leon Scroggins68579392009-09-15 15:31:54 -0400193 break;
194 case MotionEvent.ACTION_UP:
195 if (mRtButton.isPressed()) {
Leon Scroggins11e71b12010-01-25 10:40:38 -0500196 if (mInVoiceMode) {
Leon Scroggins1fe13a52010-02-09 15:31:26 -0500197 if (mBrowserActivity.getTabControl().getCurrentTab()
198 .voiceSearchSourceIsGoogle()) {
199 Intent i = new Intent(
200 LoggingEvents.ACTION_LOG_EVENT);
201 i.putExtra(LoggingEvents.EXTRA_EVENT,
202 LoggingEvents.VoiceSearch.RETRY);
203 mBrowserActivity.sendBroadcast(i);
204 }
Leon Scroggins11e71b12010-01-25 10:40:38 -0500205 mBrowserActivity.startActivity(mVoiceSearchIntent);
206 } else if (mInLoad) {
Leon Scroggins68579392009-09-15 15:31:54 -0400207 mBrowserActivity.stopLoading();
208 } else {
209 mBrowserActivity.bookmarksOrHistoryPicker(false);
210 }
211 mRtButton.setPressed(false);
212 } else if (mTitleBg.isPressed()) {
Leon Scrogginsc6fa1102009-09-21 10:40:01 -0400213 mHandler.removeMessages(LONG_PRESS);
Leon Scroggins58d56c62010-01-28 15:12:40 -0500214 if (mInVoiceMode) {
Leon Scroggins1fe13a52010-02-09 15:31:26 -0500215 if (mBrowserActivity.getTabControl().getCurrentTab()
216 .voiceSearchSourceIsGoogle()) {
217 Intent i = new Intent(
218 LoggingEvents.ACTION_LOG_EVENT);
219 i.putExtra(LoggingEvents.EXTRA_EVENT,
220 LoggingEvents.VoiceSearch.N_BEST_REVEAL);
221 mBrowserActivity.sendBroadcast(i);
222 }
Leon Scroggins58d56c62010-01-28 15:12:40 -0500223 mBrowserActivity.showVoiceSearchResults(
Leon Scrogginsea754072010-02-08 14:08:30 -0500224 mTitle.getText().toString().trim());
Leon Scroggins58d56c62010-01-28 15:12:40 -0500225 } else {
Leon Scroggins8ad29922010-02-16 12:33:55 -0500226 mBrowserActivity.editUrl();
Leon Scroggins58d56c62010-01-28 15:12:40 -0500227 }
Leon Scroggins68579392009-09-15 15:31:54 -0400228 mTitleBg.setPressed(false);
229 }
230 break;
231 default:
232 break;
233 }
234 return true;
Leon Scroggins81db3662009-06-04 17:45:11 -0400235 }
236
Leon Scroggins1f005d32009-08-10 17:36:42 -0400237 /**
Leon Scroggins3bbb6ca2009-09-09 12:51:10 -0400238 * Set a new Bitmap for the Favicon.
Leon Scroggins1f005d32009-08-10 17:36:42 -0400239 */
Leon Scroggins3bbb6ca2009-09-09 12:51:10 -0400240 /* package */ void setFavicon(Bitmap icon) {
241 Drawable[] array = new Drawable[3];
242 array[0] = new PaintDrawable(Color.BLACK);
243 PaintDrawable p = new PaintDrawable(Color.WHITE);
244 array[1] = p;
245 if (icon == null) {
246 array[2] = mGenericFavicon;
247 } else {
248 array[2] = new BitmapDrawable(icon);
Leon Scrogginsa81a7642009-08-31 17:05:41 -0400249 }
Leon Scroggins3bbb6ca2009-09-09 12:51:10 -0400250 LayerDrawable d = new LayerDrawable(array);
251 d.setLayerInset(1, 1, 1, 1, 1);
252 d.setLayerInset(2, 2, 2, 2, 2);
Leon Scrogginsf4bb18a2009-09-11 18:37:53 -0400253 mFavicon.setImageDrawable(d);
Leon Scroggins81db3662009-06-04 17:45:11 -0400254 }
255
Leon Scroggins1f005d32009-08-10 17:36:42 -0400256 /**
Leon Scroggins11e71b12010-01-25 10:40:38 -0500257 * Change the TitleBar to or from voice mode. If there is no package to
258 * handle voice search, the TitleBar cannot be set to voice mode.
259 */
260 /* package */ void setInVoiceMode(boolean inVoiceMode) {
261 if (mInVoiceMode == inVoiceMode) return;
262 mInVoiceMode = inVoiceMode && mVoiceSearchIntent != null;
Leon Scrogginsb3b04f72010-03-03 17:17:18 -0500263 Drawable titleDrawable;
Leon Scroggins11e71b12010-01-25 10:40:38 -0500264 if (mInVoiceMode) {
Leon Scrogginsb3b04f72010-03-03 17:17:18 -0500265 mRtButton.setImageDrawable(mVoiceDrawable);
Leon Scroggins58d56c62010-01-28 15:12:40 -0500266 titleDrawable = mVoiceModeBackground;
Leon Scroggins76e16862010-02-08 14:39:34 -0500267 mTitle.setEllipsize(null);
Leon Scrogginsb3b04f72010-03-03 17:17:18 -0500268 mRtButton.setVisibility(View.VISIBLE);
269 mStopButton.setVisibility(View.GONE);
Leon Scroggins11e71b12010-01-25 10:40:38 -0500270 } else {
Leon Scroggins58d56c62010-01-28 15:12:40 -0500271 if (mInLoad) {
Leon Scrogginsb3b04f72010-03-03 17:17:18 -0500272 titleDrawable = mLoadingBackground;
273 mRtButton.setVisibility(View.GONE);
274 mStopButton.setVisibility(View.VISIBLE);
Leon Scroggins58d56c62010-01-28 15:12:40 -0500275 } else {
Leon Scrogginsb3b04f72010-03-03 17:17:18 -0500276 titleDrawable = mNormalBackground;
277 mRtButton.setVisibility(View.VISIBLE);
278 mStopButton.setVisibility(View.GONE);
279 mRtButton.setImageDrawable(mBookmarkDrawable);
Leon Scroggins58d56c62010-01-28 15:12:40 -0500280 }
Leon Scroggins76e16862010-02-08 14:39:34 -0500281 mTitle.setEllipsize(TextUtils.TruncateAt.END);
Leon Scroggins11e71b12010-01-25 10:40:38 -0500282 }
Leon Scrogginsf48d44e2010-02-05 16:41:49 -0500283 mTitle.setSingleLine(!mInVoiceMode);
Leon Scroggins58d56c62010-01-28 15:12:40 -0500284 mTitleBg.setBackgroundDrawable(titleDrawable);
Leon Scroggins11e71b12010-01-25 10:40:38 -0500285 }
286
287 /**
Leon Scroggins1f005d32009-08-10 17:36:42 -0400288 * Set the Drawable for the lock icon, or null to hide it.
289 */
Leon Scroggins81db3662009-06-04 17:45:11 -0400290 /* package */ void setLock(Drawable d) {
Leon Scroggins62e8f942009-09-03 15:08:54 -0400291 if (null == d) {
292 mLockIcon.setVisibility(View.GONE);
293 } else {
294 mLockIcon.setImageDrawable(d);
295 mLockIcon.setVisibility(View.VISIBLE);
Leon Scroggins81db3662009-06-04 17:45:11 -0400296 }
297 }
298
Leon Scroggins1f005d32009-08-10 17:36:42 -0400299 /**
300 * Update the progress, from 0 to 100.
301 */
Leon Scroggins81db3662009-06-04 17:45:11 -0400302 /* package */ void setProgress(int newProgress) {
Nicolas Roard1382b492009-09-16 21:50:06 +0100303 if (newProgress >= mHorizontalProgress.getMax()) {
Leon Scrogginsf4bb18a2009-09-11 18:37:53 -0400304 mTitle.setCompoundDrawables(null, null, null, null);
Leon Scroggins62e8f942009-09-03 15:08:54 -0400305 ((Animatable) mCircularProgress).stop();
306 mHorizontalProgress.setVisibility(View.INVISIBLE);
Leon Scroggins11e71b12010-01-25 10:40:38 -0500307 if (!mInVoiceMode) {
Leon Scrogginsa81a7642009-08-31 17:05:41 -0400308 mRtButton.setImageDrawable(mBookmarkDrawable);
Leon Scrogginsb3b04f72010-03-03 17:17:18 -0500309 mRtButton.setVisibility(View.VISIBLE);
310 mStopButton.setVisibility(View.GONE);
311 mTitleBg.setBackgroundDrawable(mNormalBackground);
Leon Scroggins1f005d32009-08-10 17:36:42 -0400312 }
Leon Scroggins81db3662009-06-04 17:45:11 -0400313 mInLoad = false;
314 } else {
Leon Scroggins81db3662009-06-04 17:45:11 -0400315 mHorizontalProgress.setProgress(newProgress);
Nicolas Roard1382b492009-09-16 21:50:06 +0100316 if (!mInLoad && getWindowToken() != null) {
317 // checking the window token lets us be sure that we
318 // are attached to a window before starting the animation,
319 // preventing a potential race condition
320 // (fix for bug http://b/2115736)
Leon Scrogginsf4bb18a2009-09-11 18:37:53 -0400321 mTitle.setCompoundDrawables(null, null, mCircularProgress,
Leon Scroggins62e8f942009-09-03 15:08:54 -0400322 null);
323 ((Animatable) mCircularProgress).start();
324 mHorizontalProgress.setVisibility(View.VISIBLE);
Leon Scroggins11e71b12010-01-25 10:40:38 -0500325 if (!mInVoiceMode) {
Leon Scrogginsb3b04f72010-03-03 17:17:18 -0500326 mTitleBg.setBackgroundDrawable(mLoadingBackground);
327 mRtButton.setVisibility(View.GONE);
328 mStopButton.setVisibility(View.VISIBLE);
Leon Scroggins62e8f942009-09-03 15:08:54 -0400329 }
330 mInLoad = true;
Leon Scrogginse4b3bda2009-06-09 15:46:41 -0400331 }
Leon Scroggins81db3662009-06-04 17:45:11 -0400332 }
333 }
334
Leon Scroggins1f005d32009-08-10 17:36:42 -0400335 /**
Leon Scroggins58d56c62010-01-28 15:12:40 -0500336 * Update the text displayed in the title bar.
337 * @param title String to display. If null, the loading string will be
338 * shown.
Leon Scroggins1f005d32009-08-10 17:36:42 -0400339 */
Leon Scroggins58d56c62010-01-28 15:12:40 -0500340 /* package */ void setDisplayTitle(String title) {
341 if (title == null) {
Leon Scrogginsa81a7642009-08-31 17:05:41 -0400342 mTitle.setText(R.string.title_bar_loading);
Leon Scrogginsd7c3dd52009-07-20 13:38:47 -0400343 } else {
Leon Scrogginsf48d44e2010-02-05 16:41:49 -0500344 if (mInVoiceMode) {
345 // Add two spaces. The second one will be replaced with an
346 // image, and the first one will put space between it and the
347 // text
348 SpannableString spannable = new SpannableString(title + " ");
349 int end = spannable.length();
350 spannable.setSpan(mArcsSpan, end - 1, end,
351 Spanned.SPAN_MARK_POINT);
352 mTitle.setText(spannable);
353 } else {
354 mTitle.setText(title);
355 }
Leon Scrogginsd7c3dd52009-07-20 13:38:47 -0400356 }
Leon Scroggins81db3662009-06-04 17:45:11 -0400357 }
358
359 /* package */ void setToTabPicker() {
360 mTitle.setText(R.string.tab_picker_title);
361 setFavicon(null);
362 setLock(null);
Leon Scroggins81db3662009-06-04 17:45:11 -0400363 mHorizontalProgress.setVisibility(View.GONE);
Leon Scroggins81db3662009-06-04 17:45:11 -0400364 }
365}