blob: b8ad2efbb65b667b579a8f00f1f30be12090a83f [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
Michael Kolb8233fac2010-10-26 16:08:53 -070019import com.android.common.speech.LoggingEvents;
20
21import android.app.Activity;
Leon Scroggins11e71b12010-01-25 10:40:38 -050022import android.content.Intent;
23import android.content.pm.PackageManager;
24import android.content.pm.ResolveInfo;
Leon Scroggins3bbb6ca2009-09-09 12:51:10 -040025import android.content.res.Resources;
Leon Scroggins62e8f942009-09-03 15:08:54 -040026import android.graphics.drawable.Animatable;
Leon Scroggins81db3662009-06-04 17:45:11 -040027import android.graphics.drawable.Drawable;
Leon Scrogginsc6fa1102009-09-21 10:40:01 -040028import android.os.Handler;
29import android.os.Message;
Leon Scroggins11e71b12010-01-25 10:40:38 -050030import android.speech.RecognizerIntent;
Leon Scrogginsf48d44e2010-02-05 16:41:49 -050031import android.text.SpannableString;
32import android.text.Spanned;
Leon Scroggins76e16862010-02-08 14:39:34 -050033import android.text.TextUtils;
Leon Scrogginsf48d44e2010-02-05 16:41:49 -050034import android.text.style.ImageSpan;
Leon Scroggins9535cee2010-03-15 20:37:16 -040035import android.util.DisplayMetrics;
Leon Scroggins3bbb6ca2009-09-09 12:51:10 -040036import android.util.TypedValue;
Leon Scrogginsc6fa1102009-09-21 10:40:01 -040037import android.view.ContextMenu;
Leon Scrogginse4b3bda2009-06-09 15:46:41 -040038import android.view.LayoutInflater;
Leon Scrogginsc6fa1102009-09-21 10:40:01 -040039import android.view.MenuInflater;
Leon Scroggins68579392009-09-15 15:31:54 -040040import android.view.MotionEvent;
Leon Scrogginse4b3bda2009-06-09 15:46:41 -040041import android.view.View;
Leon Scroggins68579392009-09-15 15:31:54 -040042import android.view.ViewConfiguration;
Leon Scroggins81db3662009-06-04 17:45:11 -040043import android.widget.ImageView;
Leon Scroggins81db3662009-06-04 17:45:11 -040044import android.widget.ProgressBar;
45import android.widget.TextView;
Leon Scroggins81db3662009-06-04 17:45:11 -040046
Leon Scroggins1f005d32009-08-10 17:36:42 -040047/**
48 * This class represents a title bar for a particular "tab" or "window" in the
49 * browser.
50 */
Leon Scroggins571b3762010-05-26 10:25:01 -040051public class TitleBar extends TitleBarBase {
Michael Kolb8233fac2010-10-26 16:08:53 -070052
53 private Activity mActivity;
54 private UiController mController;
55 private TextView mTitle;
56 private ImageView mRtButton;
57 private Drawable mCircularProgress;
58 private ProgressBar mHorizontalProgress;
59 private ImageView mStopButton;
60 private Drawable mBookmarkDrawable;
61 private Drawable mVoiceDrawable;
62 private boolean mInLoad;
63 private View mTitleBg;
64 private MyHandler mHandler;
65 private Intent mVoiceSearchIntent;
66 private boolean mInVoiceMode;
67 private Drawable mVoiceModeBackground;
68 private Drawable mNormalBackground;
69 private Drawable mLoadingBackground;
70 private ImageSpan mArcsSpan;
71 private int mLeftMargin;
72 private int mRightMargin;
Leon Scrogginsc6fa1102009-09-21 10:40:01 -040073
74 private static int LONG_PRESS = 1;
Leon Scroggins81db3662009-06-04 17:45:11 -040075
Michael Kolb8233fac2010-10-26 16:08:53 -070076 public TitleBar(Activity activity, UiController controller) {
77 super(activity);
Leon Scrogginsc6fa1102009-09-21 10:40:01 -040078 mHandler = new MyHandler();
Michael Kolb8233fac2010-10-26 16:08:53 -070079 LayoutInflater factory = LayoutInflater.from(activity);
Leon Scroggins81db3662009-06-04 17:45:11 -040080 factory.inflate(R.layout.title_bar, this);
Michael Kolb8233fac2010-10-26 16:08:53 -070081 mActivity = activity;
82 mController = controller;
Leon Scroggins81db3662009-06-04 17:45:11 -040083
84 mTitle = (TextView) findViewById(R.id.title);
Leon Scrogginsa81a7642009-08-31 17:05:41 -040085 mTitle.setCompoundDrawablePadding(5);
Leon Scroggins81db3662009-06-04 17:45:11 -040086
Leon Scroggins68579392009-09-15 15:31:54 -040087 mTitleBg = findViewById(R.id.title_bg);
Leon Scroggins62e8f942009-09-03 15:08:54 -040088 mLockIcon = (ImageView) findViewById(R.id.lock);
Leon Scrogginsf4bb18a2009-09-11 18:37:53 -040089 mFavicon = (ImageView) findViewById(R.id.favicon);
Leon Scrogginsb3b04f72010-03-03 17:17:18 -050090 mStopButton = (ImageView) findViewById(R.id.stop);
Leon Scroggins62e8f942009-09-03 15:08:54 -040091
Leon Scrogginsa81a7642009-08-31 17:05:41 -040092 mRtButton = (ImageView) findViewById(R.id.rt_btn);
Michael Kolb8233fac2010-10-26 16:08:53 -070093 Resources resources = activity.getResources();
94 mCircularProgress = resources.getDrawable(
Leon Scroggins62e8f942009-09-03 15:08:54 -040095 com.android.internal.R.drawable.search_spinner);
Leon Scroggins9535cee2010-03-15 20:37:16 -040096 DisplayMetrics metrics = resources.getDisplayMetrics();
Leon Scrogginscd663ea2010-03-31 14:50:47 -040097 mLeftMargin = (int) TypedValue.applyDimension(
98 TypedValue.COMPLEX_UNIT_DIP, 8f, metrics);
99 mRightMargin = (int) TypedValue.applyDimension(
100 TypedValue.COMPLEX_UNIT_DIP, 6f, metrics);
Leon Scroggins571b3762010-05-26 10:25:01 -0400101 int iconDimension = (int) TypedValue.applyDimension(
Leon Scroggins9535cee2010-03-15 20:37:16 -0400102 TypedValue.COMPLEX_UNIT_DIP, 20f, metrics);
Leon Scroggins571b3762010-05-26 10:25:01 -0400103 mCircularProgress.setBounds(0, 0, iconDimension, iconDimension);
Leon Scroggins81db3662009-06-04 17:45:11 -0400104 mHorizontalProgress = (ProgressBar) findViewById(
105 R.id.progress_horizontal);
Leon Scroggins11e71b12010-01-25 10:40:38 -0500106 mVoiceSearchIntent = new Intent(RecognizerIntent.ACTION_WEB_SEARCH);
107 mVoiceSearchIntent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL,
108 RecognizerIntent.LANGUAGE_MODEL_WEB_SEARCH);
Mike LeBeau9f677bc2010-04-01 14:57:10 -0700109 // This extra tells voice search not to send the application id in its
110 // results intent - http://b/2546173
111 //
112 // TODO: Make a constant for this extra.
Michael Kolb8233fac2010-10-26 16:08:53 -0700113 mVoiceSearchIntent.putExtra("android.speech.extras.SEND_APPLICATION_ID_EXTRA",
114 false);
115 PackageManager pm = activity.getPackageManager();
Leon Scroggins11e71b12010-01-25 10:40:38 -0500116 ResolveInfo ri = pm.resolveActivity(mVoiceSearchIntent,
117 PackageManager.MATCH_DEFAULT_ONLY);
118 if (ri == null) {
119 mVoiceSearchIntent = null;
120 } else {
121 mVoiceDrawable = resources.getDrawable(
122 android.R.drawable.ic_btn_speak_now);
123 }
Leon Scroggins11e71b12010-01-25 10:40:38 -0500124 mBookmarkDrawable = mRtButton.getDrawable();
Leon Scroggins58d56c62010-01-28 15:12:40 -0500125 mVoiceModeBackground = resources.getDrawable(
Leon Scrogginsf48d44e2010-02-05 16:41:49 -0500126 R.drawable.title_voice);
Leon Scroggins58d56c62010-01-28 15:12:40 -0500127 mNormalBackground = mTitleBg.getBackground();
Leon Scrogginsb3b04f72010-03-03 17:17:18 -0500128 mLoadingBackground = resources.getDrawable(R.drawable.title_loading);
Michael Kolb8233fac2010-10-26 16:08:53 -0700129 mArcsSpan = new ImageSpan(activity, R.drawable.arcs,
Leon Scrogginsf48d44e2010-02-05 16:41:49 -0500130 ImageSpan.ALIGN_BASELINE);
Leon Scrogginse4b3bda2009-06-09 15:46:41 -0400131 }
132
Leon Scrogginsc6fa1102009-09-21 10:40:01 -0400133 private class MyHandler extends Handler {
Michael Kolb8233fac2010-10-26 16:08:53 -0700134 @Override
Leon Scrogginsc6fa1102009-09-21 10:40:01 -0400135 public void handleMessage(Message msg) {
136 if (msg.what == LONG_PRESS) {
137 // Prevent the normal action from happening by setting the title
138 // bar's state to false.
139 mTitleBg.setPressed(false);
140 // Need to call a special method on BrowserActivity for when the
141 // fake title bar is up, because its ViewGroup does not show a
142 // context menu.
Michael Kolb8233fac2010-10-26 16:08:53 -0700143 // TODO:
144 // this test is not valid for all UIs; fix later
145 if (getParent() != null) {
146 mActivity.openContextMenu(TitleBar.this);
147 }
Leon Scrogginsc6fa1102009-09-21 10:40:01 -0400148 }
149 }
150 };
151
152 @Override
Leon Scroggins4e9f89b2010-02-22 16:54:14 -0500153 public void createContextMenu(ContextMenu menu) {
Michael Kolb8233fac2010-10-26 16:08:53 -0700154 MenuInflater inflater = mActivity.getMenuInflater();
Leon Scrogginsc6fa1102009-09-21 10:40:01 -0400155 inflater.inflate(R.menu.title_context, menu);
Michael Kolb8233fac2010-10-26 16:08:53 -0700156 mActivity.onCreateContextMenu(menu, this, null);
Leon Scrogginsc6fa1102009-09-21 10:40:01 -0400157 }
158
Leon Scroggins68579392009-09-15 15:31:54 -0400159 @Override
160 public boolean onTouchEvent(MotionEvent event) {
Leon Scrogginsbf083d22010-03-22 10:54:04 -0400161 ImageView button = mInLoad ? mStopButton : mRtButton;
Leon Scroggins68579392009-09-15 15:31:54 -0400162 switch (event.getAction()) {
163 case MotionEvent.ACTION_DOWN:
164 // Make all touches hit either the textfield or the button,
165 // depending on which side of the right edge of the textfield
166 // they hit.
167 if ((int) event.getX() > mTitleBg.getRight()) {
Leon Scrogginsbf083d22010-03-22 10:54:04 -0400168 button.setPressed(true);
Leon Scroggins68579392009-09-15 15:31:54 -0400169 } else {
170 mTitleBg.setPressed(true);
Leon Scrogginsc6fa1102009-09-21 10:40:01 -0400171 mHandler.sendMessageDelayed(mHandler.obtainMessage(
172 LONG_PRESS),
173 ViewConfiguration.getLongPressTimeout());
Leon Scroggins68579392009-09-15 15:31:54 -0400174 }
175 break;
176 case MotionEvent.ACTION_MOVE:
Michael Kolb8233fac2010-10-26 16:08:53 -0700177 int slop = ViewConfiguration.get(mActivity)
Leon Scroggins68579392009-09-15 15:31:54 -0400178 .getScaledTouchSlop();
179 if ((int) event.getY() > getHeight() + slop) {
180 // We only trigger the actions in ACTION_UP if one or the
181 // other is pressed. Since the user moved off the title
182 // bar, mark both as not pressed.
183 mTitleBg.setPressed(false);
Leon Scrogginsbf083d22010-03-22 10:54:04 -0400184 button.setPressed(false);
Leon Scrogginsc6fa1102009-09-21 10:40:01 -0400185 mHandler.removeMessages(LONG_PRESS);
Leon Scroggins68579392009-09-15 15:31:54 -0400186 break;
187 }
188 int x = (int) event.getX();
189 int titleRight = mTitleBg.getRight();
190 if (mTitleBg.isPressed() && x > titleRight + slop) {
191 mTitleBg.setPressed(false);
Leon Scrogginsc6fa1102009-09-21 10:40:01 -0400192 mHandler.removeMessages(LONG_PRESS);
Leon Scrogginsbf083d22010-03-22 10:54:04 -0400193 } else if (button.isPressed() && x < titleRight - slop) {
194 button.setPressed(false);
Leon Scroggins68579392009-09-15 15:31:54 -0400195 }
196 break;
197 case MotionEvent.ACTION_CANCEL:
Leon Scrogginsbf083d22010-03-22 10:54:04 -0400198 button.setPressed(false);
Leon Scroggins68579392009-09-15 15:31:54 -0400199 mTitleBg.setPressed(false);
Leon Scrogginsc6fa1102009-09-21 10:40:01 -0400200 mHandler.removeMessages(LONG_PRESS);
Leon Scroggins68579392009-09-15 15:31:54 -0400201 break;
202 case MotionEvent.ACTION_UP:
Leon Scrogginsbf083d22010-03-22 10:54:04 -0400203 if (button.isPressed()) {
Leon Scroggins11e71b12010-01-25 10:40:38 -0500204 if (mInVoiceMode) {
Michael Kolb8233fac2010-10-26 16:08:53 -0700205 if (mController.getTabControl().getCurrentTab()
Leon Scroggins1fe13a52010-02-09 15:31:26 -0500206 .voiceSearchSourceIsGoogle()) {
207 Intent i = new Intent(
208 LoggingEvents.ACTION_LOG_EVENT);
209 i.putExtra(LoggingEvents.EXTRA_EVENT,
210 LoggingEvents.VoiceSearch.RETRY);
Michael Kolb8233fac2010-10-26 16:08:53 -0700211 mActivity.sendBroadcast(i);
Leon Scroggins1fe13a52010-02-09 15:31:26 -0500212 }
Michael Kolb8233fac2010-10-26 16:08:53 -0700213 mActivity.startActivity(mVoiceSearchIntent);
Leon Scroggins11e71b12010-01-25 10:40:38 -0500214 } else if (mInLoad) {
Michael Kolb8233fac2010-10-26 16:08:53 -0700215 mController.stopLoading();
Leon Scroggins68579392009-09-15 15:31:54 -0400216 } else {
Michael Kolb8233fac2010-10-26 16:08:53 -0700217 mController.bookmarkCurrentPage(
Leon Scrogginsbdff8a72011-02-11 15:49:04 -0500218 AddBookmarkPage.DEFAULT_FOLDER_ID, true);
Leon Scroggins68579392009-09-15 15:31:54 -0400219 }
Leon Scrogginsbf083d22010-03-22 10:54:04 -0400220 button.setPressed(false);
Leon Scroggins68579392009-09-15 15:31:54 -0400221 } else if (mTitleBg.isPressed()) {
Leon Scrogginsc6fa1102009-09-21 10:40:01 -0400222 mHandler.removeMessages(LONG_PRESS);
Leon Scroggins58d56c62010-01-28 15:12:40 -0500223 if (mInVoiceMode) {
Michael Kolb8233fac2010-10-26 16:08:53 -0700224 if (mController.getTabControl().getCurrentTab()
Leon Scroggins1fe13a52010-02-09 15:31:26 -0500225 .voiceSearchSourceIsGoogle()) {
226 Intent i = new Intent(
227 LoggingEvents.ACTION_LOG_EVENT);
228 i.putExtra(LoggingEvents.EXTRA_EVENT,
229 LoggingEvents.VoiceSearch.N_BEST_REVEAL);
Michael Kolb8233fac2010-10-26 16:08:53 -0700230 mActivity.sendBroadcast(i);
Leon Scroggins1fe13a52010-02-09 15:31:26 -0500231 }
Michael Kolb8233fac2010-10-26 16:08:53 -0700232 mController.showVoiceSearchResults(
Leon Scrogginsea754072010-02-08 14:08:30 -0500233 mTitle.getText().toString().trim());
Leon Scroggins58d56c62010-01-28 15:12:40 -0500234 } else {
Michael Kolb8233fac2010-10-26 16:08:53 -0700235 mController.editUrl();
Leon Scroggins58d56c62010-01-28 15:12:40 -0500236 }
Leon Scroggins68579392009-09-15 15:31:54 -0400237 mTitleBg.setPressed(false);
238 }
239 break;
240 default:
241 break;
242 }
243 return true;
Leon Scroggins81db3662009-06-04 17:45:11 -0400244 }
245
Leon Scroggins1f005d32009-08-10 17:36:42 -0400246 /**
Leon Scroggins11e71b12010-01-25 10:40:38 -0500247 * Change the TitleBar to or from voice mode. If there is no package to
248 * handle voice search, the TitleBar cannot be set to voice mode.
249 */
Michael Kolb8233fac2010-10-26 16:08:53 -0700250 @Override
251 void setInVoiceMode(boolean inVoiceMode) {
Leon Scroggins11e71b12010-01-25 10:40:38 -0500252 if (mInVoiceMode == inVoiceMode) return;
253 mInVoiceMode = inVoiceMode && mVoiceSearchIntent != null;
Leon Scrogginsb3b04f72010-03-03 17:17:18 -0500254 Drawable titleDrawable;
Leon Scroggins11e71b12010-01-25 10:40:38 -0500255 if (mInVoiceMode) {
Leon Scrogginsb3b04f72010-03-03 17:17:18 -0500256 mRtButton.setImageDrawable(mVoiceDrawable);
Leon Scroggins58d56c62010-01-28 15:12:40 -0500257 titleDrawable = mVoiceModeBackground;
Leon Scroggins76e16862010-02-08 14:39:34 -0500258 mTitle.setEllipsize(null);
Leon Scrogginsb3b04f72010-03-03 17:17:18 -0500259 mRtButton.setVisibility(View.VISIBLE);
260 mStopButton.setVisibility(View.GONE);
Leon Scroggins III1644ff62010-04-08 10:34:14 -0400261 mTitleBg.setBackgroundDrawable(titleDrawable);
Leon Scroggins7fb1a352010-04-15 10:55:02 -0400262 mTitleBg.setPadding(mLeftMargin, mTitleBg.getPaddingTop(),
263 mRightMargin, mTitleBg.getPaddingBottom());
Leon Scroggins11e71b12010-01-25 10:40:38 -0500264 } else {
Leon Scroggins58d56c62010-01-28 15:12:40 -0500265 if (mInLoad) {
Leon Scrogginsb3b04f72010-03-03 17:17:18 -0500266 titleDrawable = mLoadingBackground;
267 mRtButton.setVisibility(View.GONE);
268 mStopButton.setVisibility(View.VISIBLE);
Leon Scroggins58d56c62010-01-28 15:12:40 -0500269 } else {
Leon Scrogginsb3b04f72010-03-03 17:17:18 -0500270 titleDrawable = mNormalBackground;
271 mRtButton.setVisibility(View.VISIBLE);
272 mStopButton.setVisibility(View.GONE);
273 mRtButton.setImageDrawable(mBookmarkDrawable);
Leon Scroggins58d56c62010-01-28 15:12:40 -0500274 }
Leon Scroggins76e16862010-02-08 14:39:34 -0500275 mTitle.setEllipsize(TextUtils.TruncateAt.END);
Leon Scroggins III1644ff62010-04-08 10:34:14 -0400276 mTitleBg.setBackgroundDrawable(titleDrawable);
277 mTitleBg.setPadding(mLeftMargin, 0, mRightMargin, 0);
Leon Scroggins11e71b12010-01-25 10:40:38 -0500278 }
Leon Scrogginsf48d44e2010-02-05 16:41:49 -0500279 mTitle.setSingleLine(!mInVoiceMode);
Leon Scroggins11e71b12010-01-25 10:40:38 -0500280 }
281
282 /**
Leon Scroggins1f005d32009-08-10 17:36:42 -0400283 * Update the progress, from 0 to 100.
284 */
Michael Kolb8233fac2010-10-26 16:08:53 -0700285 @Override
286 void setProgress(int newProgress) {
Nicolas Roard1382b492009-09-16 21:50:06 +0100287 if (newProgress >= mHorizontalProgress.getMax()) {
Leon Scrogginsf4bb18a2009-09-11 18:37:53 -0400288 mTitle.setCompoundDrawables(null, null, null, null);
Leon Scroggins62e8f942009-09-03 15:08:54 -0400289 ((Animatable) mCircularProgress).stop();
290 mHorizontalProgress.setVisibility(View.INVISIBLE);
Leon Scroggins11e71b12010-01-25 10:40:38 -0500291 if (!mInVoiceMode) {
Leon Scrogginsa81a7642009-08-31 17:05:41 -0400292 mRtButton.setImageDrawable(mBookmarkDrawable);
Leon Scrogginsb3b04f72010-03-03 17:17:18 -0500293 mRtButton.setVisibility(View.VISIBLE);
294 mStopButton.setVisibility(View.GONE);
295 mTitleBg.setBackgroundDrawable(mNormalBackground);
Leon Scrogginscd663ea2010-03-31 14:50:47 -0400296 mTitleBg.setPadding(mLeftMargin, 0, mRightMargin, 0);
Leon Scroggins1f005d32009-08-10 17:36:42 -0400297 }
Leon Scroggins81db3662009-06-04 17:45:11 -0400298 mInLoad = false;
299 } else {
Leon Scroggins81db3662009-06-04 17:45:11 -0400300 mHorizontalProgress.setProgress(newProgress);
Nicolas Roard1382b492009-09-16 21:50:06 +0100301 if (!mInLoad && getWindowToken() != null) {
302 // checking the window token lets us be sure that we
303 // are attached to a window before starting the animation,
304 // preventing a potential race condition
305 // (fix for bug http://b/2115736)
Leon Scrogginsf4bb18a2009-09-11 18:37:53 -0400306 mTitle.setCompoundDrawables(null, null, mCircularProgress,
Leon Scroggins62e8f942009-09-03 15:08:54 -0400307 null);
308 ((Animatable) mCircularProgress).start();
309 mHorizontalProgress.setVisibility(View.VISIBLE);
Leon Scroggins11e71b12010-01-25 10:40:38 -0500310 if (!mInVoiceMode) {
Leon Scrogginsb3b04f72010-03-03 17:17:18 -0500311 mTitleBg.setBackgroundDrawable(mLoadingBackground);
Leon Scrogginscd663ea2010-03-31 14:50:47 -0400312 mTitleBg.setPadding(mLeftMargin, 0, mRightMargin, 0);
Leon Scrogginsb3b04f72010-03-03 17:17:18 -0500313 mRtButton.setVisibility(View.GONE);
314 mStopButton.setVisibility(View.VISIBLE);
Leon Scroggins62e8f942009-09-03 15:08:54 -0400315 }
316 mInLoad = true;
Leon Scrogginse4b3bda2009-06-09 15:46:41 -0400317 }
Leon Scroggins81db3662009-06-04 17:45:11 -0400318 }
319 }
320
Leon Scroggins1f005d32009-08-10 17:36:42 -0400321 /**
Leon Scroggins58d56c62010-01-28 15:12:40 -0500322 * Update the text displayed in the title bar.
John Reckef074262010-12-02 16:09:14 -0800323 * @param title String to display. If null, the new tab string will be
Leon Scroggins58d56c62010-01-28 15:12:40 -0500324 * shown.
Leon Scroggins1f005d32009-08-10 17:36:42 -0400325 */
Michael Kolb8233fac2010-10-26 16:08:53 -0700326 @Override
327 void setDisplayTitle(String title) {
Leon Scroggins58d56c62010-01-28 15:12:40 -0500328 if (title == null) {
John Reckef074262010-12-02 16:09:14 -0800329 mTitle.setText(R.string.new_tab);
Leon Scrogginsd7c3dd52009-07-20 13:38:47 -0400330 } else {
Leon Scrogginsf48d44e2010-02-05 16:41:49 -0500331 if (mInVoiceMode) {
332 // Add two spaces. The second one will be replaced with an
333 // image, and the first one will put space between it and the
334 // text
335 SpannableString spannable = new SpannableString(title + " ");
336 int end = spannable.length();
337 spannable.setSpan(mArcsSpan, end - 1, end,
338 Spanned.SPAN_MARK_POINT);
339 mTitle.setText(spannable);
340 } else {
341 mTitle.setText(title);
342 }
Leon Scrogginsd7c3dd52009-07-20 13:38:47 -0400343 }
Leon Scroggins81db3662009-06-04 17:45:11 -0400344 }
Leon Scroggins81db3662009-06-04 17:45:11 -0400345}