Jeff Sharkey | 3f17759 | 2009-05-18 15:23:12 -0700 | [diff] [blame] | 1 | /* |
| 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 | |
| 17 | package com.android.contacts; |
| 18 | |
| 19 | import com.android.contacts.NotifyingAsyncQueryHandler.QueryCompleteListener; |
Jeff Sharkey | 3f17759 | 2009-05-18 15:23:12 -0700 | [diff] [blame] | 20 | import com.android.contacts.SocialStreamActivity.MappingCache; |
Jeff Sharkey | 549aa16 | 2009-05-21 01:33:30 -0700 | [diff] [blame] | 21 | import com.android.contacts.SocialStreamActivity.Mapping; |
| 22 | import com.android.internal.policy.PolicyManager; |
Jeff Sharkey | 3f17759 | 2009-05-18 15:23:12 -0700 | [diff] [blame] | 23 | import com.android.providers.contacts2.ContactsContract; |
Jeff Sharkey | ecedf75 | 2009-05-18 22:07:40 -0700 | [diff] [blame] | 24 | import com.android.providers.contacts2.ContactsContract.Aggregates; |
Jeff Sharkey | 3f17759 | 2009-05-18 15:23:12 -0700 | [diff] [blame] | 25 | import com.android.providers.contacts2.ContactsContract.CommonDataKinds; |
| 26 | import com.android.providers.contacts2.ContactsContract.Data; |
| 27 | import com.android.providers.contacts2.ContactsContract.CommonDataKinds.Email; |
| 28 | import com.android.providers.contacts2.ContactsContract.CommonDataKinds.Im; |
| 29 | import com.android.providers.contacts2.ContactsContract.CommonDataKinds.Phone; |
Jeff Sharkey | ecedf75 | 2009-05-18 22:07:40 -0700 | [diff] [blame] | 30 | import com.android.providers.contacts2.ContactsContract.CommonDataKinds.Photo; |
Jeff Sharkey | 3f17759 | 2009-05-18 15:23:12 -0700 | [diff] [blame] | 31 | import com.android.providers.contacts2.ContactsContract.CommonDataKinds.Postal; |
| 32 | |
Jeff Sharkey | 549aa16 | 2009-05-21 01:33:30 -0700 | [diff] [blame] | 33 | import android.app.Activity; |
Jeff Sharkey | 3f17759 | 2009-05-18 15:23:12 -0700 | [diff] [blame] | 34 | import android.content.ActivityNotFoundException; |
| 35 | import android.content.ContentUris; |
| 36 | import android.content.Context; |
| 37 | import android.content.Intent; |
| 38 | import android.content.res.Resources; |
| 39 | import android.database.Cursor; |
Jeff Sharkey | ecedf75 | 2009-05-18 22:07:40 -0700 | [diff] [blame] | 40 | import android.graphics.Bitmap; |
| 41 | import android.graphics.BitmapFactory; |
Jeff Sharkey | 80a193a | 2009-05-21 14:18:18 -0700 | [diff] [blame] | 42 | import android.graphics.Color; |
Jeff Sharkey | 3f17759 | 2009-05-18 15:23:12 -0700 | [diff] [blame] | 43 | import android.net.Uri; |
Jeff Sharkey | 549aa16 | 2009-05-21 01:33:30 -0700 | [diff] [blame] | 44 | import android.provider.Contacts.Phones; |
Jeff Sharkey | 80a193a | 2009-05-21 14:18:18 -0700 | [diff] [blame] | 45 | import android.text.SpannableStringBuilder; |
| 46 | import android.text.style.CharacterStyle; |
| 47 | import android.text.style.ForegroundColorSpan; |
| 48 | import android.text.style.StyleSpan; |
Jeff Sharkey | 3f17759 | 2009-05-18 15:23:12 -0700 | [diff] [blame] | 49 | import android.util.Log; |
Jeff Sharkey | 549aa16 | 2009-05-21 01:33:30 -0700 | [diff] [blame] | 50 | import android.view.ContextThemeWrapper; |
Jeff Sharkey | 3f17759 | 2009-05-18 15:23:12 -0700 | [diff] [blame] | 51 | import android.view.Gravity; |
Jeff Sharkey | 549aa16 | 2009-05-21 01:33:30 -0700 | [diff] [blame] | 52 | import android.view.KeyEvent; |
Jeff Sharkey | 3f17759 | 2009-05-18 15:23:12 -0700 | [diff] [blame] | 53 | import android.view.LayoutInflater; |
Jeff Sharkey | 549aa16 | 2009-05-21 01:33:30 -0700 | [diff] [blame] | 54 | import android.view.Menu; |
| 55 | import android.view.MenuItem; |
| 56 | import android.view.MotionEvent; |
Jeff Sharkey | 3f17759 | 2009-05-18 15:23:12 -0700 | [diff] [blame] | 57 | import android.view.View; |
Jeff Sharkey | 549aa16 | 2009-05-21 01:33:30 -0700 | [diff] [blame] | 58 | import android.view.ViewConfiguration; |
Jeff Sharkey | 3f17759 | 2009-05-18 15:23:12 -0700 | [diff] [blame] | 59 | import android.view.ViewGroup; |
| 60 | import android.view.ViewTreeObserver; |
Jeff Sharkey | 549aa16 | 2009-05-21 01:33:30 -0700 | [diff] [blame] | 61 | import android.view.Window; |
| 62 | import android.view.WindowManager; |
Jeff Sharkey | 3f17759 | 2009-05-18 15:23:12 -0700 | [diff] [blame] | 63 | import android.view.View.OnClickListener; |
| 64 | import android.view.ViewTreeObserver.OnScrollChangedListener; |
Jeff Sharkey | 549aa16 | 2009-05-21 01:33:30 -0700 | [diff] [blame] | 65 | import android.view.accessibility.AccessibilityEvent; |
Jeff Sharkey | 3f17759 | 2009-05-18 15:23:12 -0700 | [diff] [blame] | 66 | import android.widget.AbsListView; |
| 67 | import android.widget.ImageView; |
| 68 | import android.widget.LinearLayout; |
| 69 | import android.widget.ListView; |
| 70 | import android.widget.PopupWindow; |
| 71 | import android.widget.TextView; |
| 72 | import android.widget.Toast; |
| 73 | import android.widget.AbsListView.OnScrollListener; |
| 74 | import android.widget.Gallery.LayoutParams; |
| 75 | |
| 76 | import java.lang.ref.WeakReference; |
| 77 | import java.util.ArrayList; |
Jeff Sharkey | 549aa16 | 2009-05-21 01:33:30 -0700 | [diff] [blame] | 78 | import java.util.Arrays; |
Jeff Sharkey | 3f17759 | 2009-05-18 15:23:12 -0700 | [diff] [blame] | 79 | import java.util.Collections; |
| 80 | import java.util.Comparator; |
| 81 | import java.util.HashMap; |
| 82 | import java.util.Iterator; |
Jeff Sharkey | 549aa16 | 2009-05-21 01:33:30 -0700 | [diff] [blame] | 83 | import java.util.LinkedList; |
Jeff Sharkey | 3f17759 | 2009-05-18 15:23:12 -0700 | [diff] [blame] | 84 | import java.util.PriorityQueue; |
Jeff Sharkey | 549aa16 | 2009-05-21 01:33:30 -0700 | [diff] [blame] | 85 | import java.util.Set; |
Jeff Sharkey | 3f17759 | 2009-05-18 15:23:12 -0700 | [diff] [blame] | 86 | |
| 87 | /** |
Jeff Sharkey | 549aa16 | 2009-05-21 01:33:30 -0700 | [diff] [blame] | 88 | * Window that shows fast-track contact details for a specific |
| 89 | * {@link Aggregate#_ID}. |
Jeff Sharkey | 3f17759 | 2009-05-18 15:23:12 -0700 | [diff] [blame] | 90 | */ |
Jeff Sharkey | 549aa16 | 2009-05-21 01:33:30 -0700 | [diff] [blame] | 91 | public class FastTrackWindow implements Window.Callback, QueryCompleteListener, OnClickListener { |
Jeff Sharkey | 3f17759 | 2009-05-18 15:23:12 -0700 | [diff] [blame] | 92 | private static final String TAG = "FastTrackWindow"; |
| 93 | |
Jeff Sharkey | 549aa16 | 2009-05-21 01:33:30 -0700 | [diff] [blame] | 94 | /** |
| 95 | * Interface used to allow the person showing a {@link FastTrackWindow} to |
| 96 | * know when the window has been dismissed. |
| 97 | */ |
| 98 | interface OnDismissListener { |
| 99 | public void onDismiss(FastTrackWindow dialog); |
| 100 | } |
| 101 | |
| 102 | final Context mContext; |
| 103 | final LayoutInflater mInflater; |
| 104 | final WindowManager mWindowManager; |
| 105 | Window mWindow; |
| 106 | View mDecor; |
| 107 | |
| 108 | private boolean mQuerying = false; |
| 109 | private boolean mShowing = false; |
Jeff Sharkey | 3f17759 | 2009-05-18 15:23:12 -0700 | [diff] [blame] | 110 | |
| 111 | /** Mapping cache from mime-type to icons and actions */ |
| 112 | private MappingCache mMappingCache; |
| 113 | |
Jeff Sharkey | 3f17759 | 2009-05-18 15:23:12 -0700 | [diff] [blame] | 114 | private NotifyingAsyncQueryHandler mHandler; |
Jeff Sharkey | 549aa16 | 2009-05-21 01:33:30 -0700 | [diff] [blame] | 115 | private OnDismissListener mDismissListener; |
Jeff Sharkey | 3f17759 | 2009-05-18 15:23:12 -0700 | [diff] [blame] | 116 | |
Jeff Sharkey | 549aa16 | 2009-05-21 01:33:30 -0700 | [diff] [blame] | 117 | private long mAggId; |
Jeff Sharkey | 80a193a | 2009-05-21 14:18:18 -0700 | [diff] [blame] | 118 | private int mAnchorX; |
| 119 | private int mAnchorY; |
| 120 | private int mAnchorHeight; |
Jeff Sharkey | 3f17759 | 2009-05-18 15:23:12 -0700 | [diff] [blame] | 121 | |
Jeff Sharkey | 549aa16 | 2009-05-21 01:33:30 -0700 | [diff] [blame] | 122 | private boolean mHasProfile = false; |
| 123 | private boolean mHasActions = false; |
Jeff Sharkey | 3f17759 | 2009-05-18 15:23:12 -0700 | [diff] [blame] | 124 | |
Jeff Sharkey | 80a193a | 2009-05-21 14:18:18 -0700 | [diff] [blame] | 125 | private View mArrowUp; |
| 126 | private View mArrowDown; |
| 127 | |
Jeff Sharkey | 549aa16 | 2009-05-21 01:33:30 -0700 | [diff] [blame] | 128 | private ImageView mPhoto; |
| 129 | private ImageView mPresence; |
Jeff Sharkey | 80a193a | 2009-05-21 14:18:18 -0700 | [diff] [blame] | 130 | private TextView mContent; |
| 131 | private TextView mPublished; |
Jeff Sharkey | 549aa16 | 2009-05-21 01:33:30 -0700 | [diff] [blame] | 132 | private ViewGroup mTrack; |
| 133 | |
| 134 | // TODO: read from a resource somewhere |
Jeff Sharkey | 80a193a | 2009-05-21 14:18:18 -0700 | [diff] [blame] | 135 | private static final int mHeight = 138; |
| 136 | private static final int mArrowHeight = 10; |
| 137 | private static final int mArrowWidth = 24; |
Jeff Sharkey | 549aa16 | 2009-05-21 01:33:30 -0700 | [diff] [blame] | 138 | |
| 139 | /** |
| 140 | * Set of {@link ActionInfo} that are associated with the aggregate |
| 141 | * currently displayed by this fast-track window. |
| 142 | */ |
| 143 | private ActionSet mActions = new ActionSet(); |
| 144 | |
| 145 | /** |
| 146 | * Specific mime-type for {@link Phone#CONTENT_ITEM_TYPE} entries that |
| 147 | * distinguishes actions that should initiate a text message. |
| 148 | */ |
| 149 | public static final String MIME_SMS_ADDRESS = "vnd.android.cursor.item/sms-address"; |
| 150 | |
| 151 | /** |
| 152 | * Specific mime-types that should be bumped to the front of the fast-track. |
| 153 | * Other mime-types not appearing in this list follow in alphabetic order. |
| 154 | */ |
| 155 | private static final String[] ORDERED_MIMETYPES = new String[] { |
| 156 | Aggregates.CONTENT_ITEM_TYPE, |
| 157 | Phones.CONTENT_ITEM_TYPE, |
| 158 | MIME_SMS_ADDRESS, |
| 159 | Email.CONTENT_ITEM_TYPE, |
| 160 | }; |
| 161 | |
Jeff Sharkey | 9bd858b | 2009-05-21 01:33:30 -0700 | [diff] [blame^] | 162 | // public static final int ICON_SIZE = 42; |
| 163 | // public static final int ICON_PADDING = 3; |
| 164 | |
Jeff Sharkey | 549aa16 | 2009-05-21 01:33:30 -0700 | [diff] [blame] | 165 | // TODO: read this status from actual query |
| 166 | private static final String STUB_STATUS = "has a really long random status message that would be far too long to read on a single device without the need for tiny reading glasses"; |
| 167 | |
| 168 | private static final boolean INCLUDE_PROFILE_ACTION = true; |
Jeff Sharkey | 3f17759 | 2009-05-18 15:23:12 -0700 | [diff] [blame] | 169 | |
Jeff Sharkey | ecedf75 | 2009-05-18 22:07:40 -0700 | [diff] [blame] | 170 | private static final int TOKEN_DISPLAY_NAME = 1; |
| 171 | private static final int TOKEN_DATA = 2; |
Jeff Sharkey | 3f17759 | 2009-05-18 15:23:12 -0700 | [diff] [blame] | 172 | |
Jeff Sharkey | 3f17759 | 2009-05-18 15:23:12 -0700 | [diff] [blame] | 173 | /** Message to show when no activity is found to perform an action */ |
| 174 | // TODO: move this value into a resources string |
| 175 | private static final String NOT_FOUND = "Couldn't find an app to handle this action"; |
| 176 | |
Jeff Sharkey | 549aa16 | 2009-05-21 01:33:30 -0700 | [diff] [blame] | 177 | /** |
| 178 | * Prepare a fast-track window to show in the given {@link Context}. |
| 179 | */ |
| 180 | public FastTrackWindow(Context context) { |
| 181 | mContext = new ContextThemeWrapper(context, R.style.FastTrack); |
| 182 | mInflater = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); |
| 183 | mWindowManager = (WindowManager)context.getSystemService(Context.WINDOW_SERVICE); |
Jeff Sharkey | 3f17759 | 2009-05-18 15:23:12 -0700 | [diff] [blame] | 184 | |
Jeff Sharkey | 549aa16 | 2009-05-21 01:33:30 -0700 | [diff] [blame] | 185 | mWindow = PolicyManager.makeNewWindow(mContext); |
| 186 | mWindow.setCallback(this); |
| 187 | mWindow.setWindowManager(mWindowManager, null, null); |
Jeff Sharkey | 3f17759 | 2009-05-18 15:23:12 -0700 | [diff] [blame] | 188 | |
Jeff Sharkey | 549aa16 | 2009-05-21 01:33:30 -0700 | [diff] [blame] | 189 | mWindow.setContentView(R.layout.fasttrack); |
| 190 | |
Jeff Sharkey | 80a193a | 2009-05-21 14:18:18 -0700 | [diff] [blame] | 191 | mArrowUp = (View)mWindow.findViewById(R.id.arrow_up); |
| 192 | mArrowDown = (View)mWindow.findViewById(R.id.arrow_down); |
| 193 | |
Jeff Sharkey | 549aa16 | 2009-05-21 01:33:30 -0700 | [diff] [blame] | 194 | mPhoto = (ImageView)mWindow.findViewById(R.id.photo); |
| 195 | mPresence = (ImageView)mWindow.findViewById(R.id.presence); |
Jeff Sharkey | 80a193a | 2009-05-21 14:18:18 -0700 | [diff] [blame] | 196 | mContent = (TextView)mWindow.findViewById(R.id.content); |
| 197 | mPublished = (TextView)mWindow.findViewById(R.id.published); |
Jeff Sharkey | 549aa16 | 2009-05-21 01:33:30 -0700 | [diff] [blame] | 198 | mTrack = (ViewGroup)mWindow.findViewById(R.id.fasttrack); |
| 199 | |
| 200 | // TODO: move generation of mime-type cache to more-efficient place |
| 201 | generateMappingCache(); |
| 202 | |
Jeff Sharkey | 3f17759 | 2009-05-18 15:23:12 -0700 | [diff] [blame] | 203 | } |
| 204 | |
| 205 | /** |
Jeff Sharkey | 549aa16 | 2009-05-21 01:33:30 -0700 | [diff] [blame] | 206 | * Prepare a fast-track window to show in the given {@link Context}, and |
| 207 | * notify the given {@link OnDismissListener} each time this dialog is |
| 208 | * dismissed. |
Jeff Sharkey | 3f17759 | 2009-05-18 15:23:12 -0700 | [diff] [blame] | 209 | */ |
Jeff Sharkey | 549aa16 | 2009-05-21 01:33:30 -0700 | [diff] [blame] | 210 | public FastTrackWindow(Context context, OnDismissListener dismissListener) { |
| 211 | this(context); |
| 212 | mDismissListener = dismissListener; |
| 213 | } |
Jeff Sharkey | 3f17759 | 2009-05-18 15:23:12 -0700 | [diff] [blame] | 214 | |
Jeff Sharkey | 549aa16 | 2009-05-21 01:33:30 -0700 | [diff] [blame] | 215 | /** |
| 216 | * Generate {@link MappingCache} specifically for fast-track windows. This |
| 217 | * cache knows how to display {@link CommonDataKinds#PACKAGE_COMMON} data |
| 218 | * types using generic icons. |
| 219 | */ |
| 220 | private void generateMappingCache() { |
| 221 | mMappingCache = MappingCache.createAndFill(mContext); |
Jeff Sharkey | 3f17759 | 2009-05-18 15:23:12 -0700 | [diff] [blame] | 222 | |
Jeff Sharkey | 549aa16 | 2009-05-21 01:33:30 -0700 | [diff] [blame] | 223 | Resources res = mContext.getResources(); |
| 224 | Mapping mapping; |
Jeff Sharkey | 3f17759 | 2009-05-18 15:23:12 -0700 | [diff] [blame] | 225 | |
Jeff Sharkey | 549aa16 | 2009-05-21 01:33:30 -0700 | [diff] [blame] | 226 | mapping = new Mapping(CommonDataKinds.PACKAGE_COMMON, Aggregates.CONTENT_ITEM_TYPE); |
| 227 | mapping.icon = BitmapFactory.decodeResource(res, R.drawable.ic_contacts_details); |
| 228 | mMappingCache.addMapping(mapping); |
Jeff Sharkey | 3f17759 | 2009-05-18 15:23:12 -0700 | [diff] [blame] | 229 | |
Jeff Sharkey | 549aa16 | 2009-05-21 01:33:30 -0700 | [diff] [blame] | 230 | mapping = new Mapping(CommonDataKinds.PACKAGE_COMMON, Phone.CONTENT_ITEM_TYPE); |
| 231 | mapping.summaryColumn = Phone.NUMBER; |
| 232 | mapping.icon = BitmapFactory.decodeResource(res, android.R.drawable.sym_action_call); |
| 233 | mMappingCache.addMapping(mapping); |
Jeff Sharkey | 3f17759 | 2009-05-18 15:23:12 -0700 | [diff] [blame] | 234 | |
Jeff Sharkey | 549aa16 | 2009-05-21 01:33:30 -0700 | [diff] [blame] | 235 | mapping = new Mapping(CommonDataKinds.PACKAGE_COMMON, MIME_SMS_ADDRESS); |
| 236 | mapping.summaryColumn = Phone.NUMBER; |
| 237 | mapping.icon = BitmapFactory.decodeResource(res, R.drawable.sym_action_sms); |
| 238 | mMappingCache.addMapping(mapping); |
Jeff Sharkey | 3f17759 | 2009-05-18 15:23:12 -0700 | [diff] [blame] | 239 | |
Jeff Sharkey | 549aa16 | 2009-05-21 01:33:30 -0700 | [diff] [blame] | 240 | mapping = new Mapping(CommonDataKinds.PACKAGE_COMMON, Email.CONTENT_ITEM_TYPE); |
| 241 | mapping.summaryColumn = Email.DATA; |
| 242 | mapping.icon = BitmapFactory.decodeResource(res, android.R.drawable.sym_action_email); |
| 243 | mMappingCache.addMapping(mapping); |
Jeff Sharkey | 3f17759 | 2009-05-18 15:23:12 -0700 | [diff] [blame] | 244 | |
Jeff Sharkey | 549aa16 | 2009-05-21 01:33:30 -0700 | [diff] [blame] | 245 | } |
Jeff Sharkey | 3f17759 | 2009-05-18 15:23:12 -0700 | [diff] [blame] | 246 | |
Jeff Sharkey | 549aa16 | 2009-05-21 01:33:30 -0700 | [diff] [blame] | 247 | /** |
| 248 | * Start showing a fast-track window for the given {@link Aggregate#_ID} |
| 249 | * pointing towards the given location. |
| 250 | */ |
Jeff Sharkey | 80a193a | 2009-05-21 14:18:18 -0700 | [diff] [blame] | 251 | public void show(Uri aggUri, int x, int y, int height) { |
Jeff Sharkey | 549aa16 | 2009-05-21 01:33:30 -0700 | [diff] [blame] | 252 | if (mShowing || mQuerying) { |
| 253 | Log.w(TAG, "already in process of showing"); |
| 254 | return; |
| 255 | } |
| 256 | |
| 257 | mAggId = ContentUris.parseId(aggUri); |
Jeff Sharkey | 80a193a | 2009-05-21 14:18:18 -0700 | [diff] [blame] | 258 | mAnchorX = x; |
| 259 | mAnchorY = y; |
| 260 | mAnchorHeight = height; |
Jeff Sharkey | 549aa16 | 2009-05-21 01:33:30 -0700 | [diff] [blame] | 261 | mQuerying = true; |
Jeff Sharkey | 3f17759 | 2009-05-18 15:23:12 -0700 | [diff] [blame] | 262 | |
| 263 | // Start data query in background |
Jeff Sharkey | 549aa16 | 2009-05-21 01:33:30 -0700 | [diff] [blame] | 264 | Uri dataUri = Uri.withAppendedPath(aggUri, |
| 265 | ContactsContract.Aggregates.Data.CONTENT_DIRECTORY); |
Jeff Sharkey | 3f17759 | 2009-05-18 15:23:12 -0700 | [diff] [blame] | 266 | |
Jeff Sharkey | 549aa16 | 2009-05-21 01:33:30 -0700 | [diff] [blame] | 267 | // TODO: also query for latest status message |
| 268 | mHandler = new NotifyingAsyncQueryHandler(mContext, this); |
Jeff Sharkey | ecedf75 | 2009-05-18 22:07:40 -0700 | [diff] [blame] | 269 | mHandler.startQuery(TOKEN_DISPLAY_NAME, null, aggUri, null, null, null, null); |
Jeff Sharkey | 549aa16 | 2009-05-21 01:33:30 -0700 | [diff] [blame] | 270 | mHandler.startQuery(TOKEN_DATA, null, dataUri, null, null, null, null); |
Jeff Sharkey | 3f17759 | 2009-05-18 15:23:12 -0700 | [diff] [blame] | 271 | |
| 272 | } |
| 273 | |
| 274 | /** |
Jeff Sharkey | 80a193a | 2009-05-21 14:18:18 -0700 | [diff] [blame] | 275 | * Show the correct callout arrow based on a {@link R.id} reference. |
| 276 | */ |
| 277 | private void showArrow(int whichArrow, int requestedX) { |
| 278 | final View showArrow = (whichArrow == R.id.arrow_up) ? mArrowUp : mArrowDown; |
| 279 | final View hideArrow = (whichArrow == R.id.arrow_up) ? mArrowDown : mArrowUp; |
| 280 | |
| 281 | showArrow.setVisibility(View.VISIBLE); |
| 282 | LinearLayout.LayoutParams param = (LinearLayout.LayoutParams)showArrow.getLayoutParams(); |
| 283 | param.leftMargin = requestedX - mArrowWidth / 2; |
| 284 | |
| 285 | hideArrow.setVisibility(View.INVISIBLE); |
| 286 | } |
| 287 | |
| 288 | /** |
Jeff Sharkey | 549aa16 | 2009-05-21 01:33:30 -0700 | [diff] [blame] | 289 | * Actual internal method to show this fast-track window. Called only by |
| 290 | * {@link #considerShowing()} when all data requirements have been met. |
Jeff Sharkey | 3f17759 | 2009-05-18 15:23:12 -0700 | [diff] [blame] | 291 | */ |
Jeff Sharkey | 549aa16 | 2009-05-21 01:33:30 -0700 | [diff] [blame] | 292 | private void showInternal() { |
| 293 | mDecor = mWindow.getDecorView(); |
| 294 | WindowManager.LayoutParams l = mWindow.getAttributes(); |
Jeff Sharkey | 80a193a | 2009-05-21 14:18:18 -0700 | [diff] [blame] | 295 | |
Jeff Sharkey | 549aa16 | 2009-05-21 01:33:30 -0700 | [diff] [blame] | 296 | l.gravity = Gravity.TOP | Gravity.LEFT; |
| 297 | l.x = 0; |
Jeff Sharkey | 80a193a | 2009-05-21 14:18:18 -0700 | [diff] [blame] | 298 | |
| 299 | if (mAnchorY > mHeight) { |
| 300 | // Show downwards callout when enough room |
| 301 | showArrow(R.id.arrow_down, mAnchorX); |
| 302 | l.y = mAnchorY - (mHeight - (mArrowHeight * 2) - 5); |
| 303 | |
| 304 | } else { |
| 305 | // Otherwise show upwards callout |
| 306 | showArrow(R.id.arrow_up, mAnchorX); |
| 307 | l.y = mAnchorY + mAnchorHeight - 10; |
| 308 | |
| 309 | } |
| 310 | |
Jeff Sharkey | 549aa16 | 2009-05-21 01:33:30 -0700 | [diff] [blame] | 311 | l.width = WindowManager.LayoutParams.FILL_PARENT; |
Jeff Sharkey | 80a193a | 2009-05-21 14:18:18 -0700 | [diff] [blame] | 312 | l.height = mHeight; |
Jeff Sharkey | 549aa16 | 2009-05-21 01:33:30 -0700 | [diff] [blame] | 313 | |
| 314 | l.dimAmount = 0.6f; |
| 315 | l.flags = WindowManager.LayoutParams.FLAG_DIM_BEHIND |
| 316 | | WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH |
| 317 | | WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE |
| 318 | | WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN |
| 319 | | WindowManager.LayoutParams.FLAG_LAYOUT_INSET_DECOR; |
| 320 | |
| 321 | mWindowManager.addView(mDecor, l); |
| 322 | mShowing = true; |
| 323 | mQuerying = false; |
| 324 | } |
| 325 | |
| 326 | /** |
| 327 | * Dismiss this fast-track window if showing. |
| 328 | */ |
| 329 | public void dismiss() { |
| 330 | if (!mQuerying && !mShowing) { |
| 331 | Log.d(TAG, "not visible, ignore"); |
| 332 | return; |
| 333 | } |
| 334 | |
| 335 | // Cancel any pending queries |
| 336 | mHandler.cancelOperation(TOKEN_DISPLAY_NAME); |
| 337 | mHandler.cancelOperation(TOKEN_DATA); |
| 338 | |
| 339 | // Reset all views to prepare for possible recycling |
| 340 | mPhoto.setImageResource(R.drawable.ic_contact_list_picture); |
| 341 | mPresence.setImageDrawable(null); |
Jeff Sharkey | 80a193a | 2009-05-21 14:18:18 -0700 | [diff] [blame] | 342 | mContent.setText(null); |
| 343 | mPublished.setText(null); |
Jeff Sharkey | 549aa16 | 2009-05-21 01:33:30 -0700 | [diff] [blame] | 344 | |
| 345 | mActions.clear(); |
| 346 | mTrack.removeAllViews(); |
| 347 | |
| 348 | mHasProfile = false; |
| 349 | mHasActions = false; |
| 350 | |
| 351 | if (mDecor == null || !mShowing) { |
| 352 | Log.d(TAG, "not showing, ignore"); |
| 353 | return; |
| 354 | } |
| 355 | |
| 356 | mWindowManager.removeView(mDecor); |
| 357 | mDecor = null; |
| 358 | mWindow.closeAllPanels(); |
| 359 | mShowing = false; |
| 360 | |
| 361 | // Notify any listeners that we've been dismissed |
| 362 | if (mDismissListener != null) { |
| 363 | mDismissListener.onDismiss(this); |
Jeff Sharkey | 3f17759 | 2009-05-18 15:23:12 -0700 | [diff] [blame] | 364 | } |
| 365 | } |
| 366 | |
Jeff Sharkey | 549aa16 | 2009-05-21 01:33:30 -0700 | [diff] [blame] | 367 | /** |
| 368 | * Returns true if this fast-track window is showing or querying. |
| 369 | */ |
| 370 | public boolean isShowing() { |
| 371 | return mShowing || mQuerying; |
| 372 | } |
Jeff Sharkey | 3f17759 | 2009-05-18 15:23:12 -0700 | [diff] [blame] | 373 | |
Jeff Sharkey | 549aa16 | 2009-05-21 01:33:30 -0700 | [diff] [blame] | 374 | /** |
| 375 | * Consider showing this window, which will only call through to |
| 376 | * {@link #showInternal()} when all data items are present. |
| 377 | */ |
| 378 | private synchronized void considerShowing() { |
| 379 | if (mHasActions && mHasProfile && !mShowing) { |
| 380 | showInternal(); |
Jeff Sharkey | 3f17759 | 2009-05-18 15:23:12 -0700 | [diff] [blame] | 381 | } |
| 382 | } |
| 383 | |
| 384 | /** {@inheritDoc} */ |
| 385 | public void onQueryComplete(int token, Object cookie, Cursor cursor) { |
Jeff Sharkey | ecedf75 | 2009-05-18 22:07:40 -0700 | [diff] [blame] | 386 | if (cursor == null) { |
| 387 | return; |
Jeff Sharkey | 549aa16 | 2009-05-21 01:33:30 -0700 | [diff] [blame] | 388 | } else if (token == TOKEN_DISPLAY_NAME) { |
| 389 | handleDisplayName(cursor); |
| 390 | } else if (token == TOKEN_DATA) { |
| 391 | handleData(cursor); |
Jeff Sharkey | ecedf75 | 2009-05-18 22:07:40 -0700 | [diff] [blame] | 392 | } |
Jeff Sharkey | ecedf75 | 2009-05-18 22:07:40 -0700 | [diff] [blame] | 393 | } |
Jeff Sharkey | 80a193a | 2009-05-21 14:18:18 -0700 | [diff] [blame] | 394 | |
| 395 | private SpannableStringBuilder mBuilder = new SpannableStringBuilder(); |
| 396 | private CharacterStyle mStyleBold = new StyleSpan(android.graphics.Typeface.BOLD); |
| 397 | private CharacterStyle mStyleBlack = new ForegroundColorSpan(Color.BLACK); |
Jeff Sharkey | ecedf75 | 2009-05-18 22:07:40 -0700 | [diff] [blame] | 398 | |
| 399 | /** |
| 400 | * Handle the result from the {@link TOKEN_DISPLAY_NAME} query. |
| 401 | */ |
| 402 | private void handleDisplayName(Cursor cursor) { |
Jeff Sharkey | ecedf75 | 2009-05-18 22:07:40 -0700 | [diff] [blame] | 403 | final int COL_DISPLAY_NAME = cursor.getColumnIndex(Aggregates.DISPLAY_NAME); |
| 404 | |
| 405 | if (cursor.moveToNext()) { |
| 406 | String foundName = cursor.getString(COL_DISPLAY_NAME); |
Jeff Sharkey | 80a193a | 2009-05-21 14:18:18 -0700 | [diff] [blame] | 407 | |
| 408 | mBuilder.clear(); |
| 409 | mBuilder.append(foundName); |
| 410 | mBuilder.append(" "); |
| 411 | mBuilder.append(STUB_STATUS); |
| 412 | mBuilder.setSpan(mStyleBold, 0, foundName.length(), 0); |
| 413 | mBuilder.setSpan(mStyleBlack, 0, foundName.length(), 0); |
| 414 | mContent.setText(mBuilder); |
| 415 | |
| 416 | mPublished.setText("4 hours ago"); |
| 417 | |
Jeff Sharkey | ecedf75 | 2009-05-18 22:07:40 -0700 | [diff] [blame] | 418 | } |
| 419 | |
Jeff Sharkey | 549aa16 | 2009-05-21 01:33:30 -0700 | [diff] [blame] | 420 | mHasProfile = true; |
| 421 | considerShowing(); |
| 422 | } |
| 423 | |
| 424 | /** |
| 425 | * Description of a specific, actionable {@link Data#_ID} item. May have a |
| 426 | * {@link Mapping} associated with it to find {@link RemoteViews} or icon, |
| 427 | * and may have built a summary of itself for UI display. |
| 428 | */ |
| 429 | private class ActionInfo { |
| 430 | long dataId; |
| 431 | String packageName; |
| 432 | String mimeType; |
| 433 | |
| 434 | Mapping mapping; |
| 435 | String summaryValue; |
| 436 | |
| 437 | /** |
| 438 | * Create an action from common {@link Data} elements. |
| 439 | */ |
| 440 | public ActionInfo(long dataId, String packageName, String mimeType) { |
| 441 | this.dataId = dataId; |
| 442 | this.packageName = packageName; |
| 443 | this.mimeType = mimeType; |
| 444 | } |
| 445 | |
| 446 | /** |
| 447 | * Attempt to find a {@link Mapping} for the package and mime-type |
| 448 | * defined by this action. Returns true if one was found. |
| 449 | */ |
| 450 | public boolean findMapping(MappingCache cache) { |
| 451 | mapping = cache.findMapping(packageName, mimeType); |
| 452 | return (mapping != null); |
| 453 | } |
| 454 | |
| 455 | /** |
| 456 | * Given a {@link Cursor} pointed at the {@link Data} row associated |
| 457 | * with this action, use the {@link Mapping} to build a text summary. |
| 458 | */ |
| 459 | public void buildSummary(Cursor cursor) { |
| 460 | if (mapping == null || mapping.summaryColumn == null) return; |
| 461 | int index = cursor.getColumnIndex(mapping.summaryColumn); |
| 462 | if (index != -1) { |
| 463 | summaryValue = cursor.getString(index); |
| 464 | } |
| 465 | } |
| 466 | |
| 467 | /** |
| 468 | * Build an {@link Intent} that will perform this action. |
| 469 | */ |
| 470 | public Intent buildIntent() { |
| 471 | // Handle well-known mime-types with special care |
| 472 | if (CommonDataKinds.Phone.CONTENT_ITEM_TYPE.equals(mimeType)) { |
| 473 | Uri callUri = Uri.parse("tel:" + Uri.encode(summaryValue)); |
| 474 | return new Intent(Intent.ACTION_DIAL, callUri); |
| 475 | |
| 476 | } else if (MIME_SMS_ADDRESS.equals(mimeType)) { |
| 477 | Uri smsUri = Uri.fromParts("smsto", summaryValue, null); |
| 478 | return new Intent(Intent.ACTION_SENDTO, smsUri); |
| 479 | |
| 480 | } else if (CommonDataKinds.Email.CONTENT_ITEM_TYPE.equals(mimeType)) { |
| 481 | Uri mailUri = Uri.fromParts("mailto", summaryValue, null); |
| 482 | return new Intent(Intent.ACTION_SENDTO, mailUri); |
| 483 | |
| 484 | } |
| 485 | |
| 486 | // Otherwise fall back to default VIEW action |
| 487 | Uri dataUri = ContentUris.withAppendedId(ContactsContract.Data.CONTENT_URI, dataId); |
| 488 | |
| 489 | Intent intent = new Intent(Intent.ACTION_VIEW); |
| 490 | intent.setData(dataUri); |
| 491 | |
| 492 | return intent; |
| 493 | } |
| 494 | } |
| 495 | |
| 496 | /** |
| 497 | * Provide a simple way of collecting one or more {@link ActionInfo} objects |
| 498 | * under a mime-type key. |
| 499 | */ |
| 500 | private class ActionSet extends HashMap<String, LinkedList<ActionInfo>> { |
| 501 | private void collect(String mimeType, ActionInfo info) { |
| 502 | // Create mime-type set if needed |
| 503 | if (!containsKey(mimeType)) { |
| 504 | put(mimeType, new LinkedList<ActionInfo>()); |
| 505 | } |
| 506 | LinkedList<ActionInfo> collectList = get(mimeType); |
| 507 | collectList.add(info); |
| 508 | } |
Jeff Sharkey | ecedf75 | 2009-05-18 22:07:40 -0700 | [diff] [blame] | 509 | } |
| 510 | |
| 511 | /** |
| 512 | * Handle the result from the {@link TOKEN_DATA} query. |
| 513 | */ |
| 514 | private void handleData(Cursor cursor) { |
Jeff Sharkey | 3f17759 | 2009-05-18 15:23:12 -0700 | [diff] [blame] | 515 | final int COL_ID = cursor.getColumnIndex(Data._ID); |
| 516 | final int COL_PACKAGE = cursor.getColumnIndex(Data.PACKAGE); |
| 517 | final int COL_MIMETYPE = cursor.getColumnIndex(Data.MIMETYPE); |
Jeff Sharkey | ecedf75 | 2009-05-18 22:07:40 -0700 | [diff] [blame] | 518 | final int COL_PHOTO = cursor.getColumnIndex(Photo.PHOTO); |
| 519 | |
Jeff Sharkey | 549aa16 | 2009-05-21 01:33:30 -0700 | [diff] [blame] | 520 | ActionInfo info; |
| 521 | |
| 522 | // Add the profile shortcut action if requested |
| 523 | if (INCLUDE_PROFILE_ACTION) { |
| 524 | final String mimeType = Aggregates.CONTENT_ITEM_TYPE; |
| 525 | info = new ActionInfo(mAggId, CommonDataKinds.PACKAGE_COMMON, mimeType); |
| 526 | if (info.findMapping(mMappingCache)) { |
| 527 | mActions.collect(mimeType, info); |
| 528 | } |
| 529 | } |
Jeff Sharkey | 3f17759 | 2009-05-18 15:23:12 -0700 | [diff] [blame] | 530 | |
| 531 | while (cursor.moveToNext()) { |
| 532 | final long dataId = cursor.getLong(COL_ID); |
| 533 | final String packageName = cursor.getString(COL_PACKAGE); |
| 534 | final String mimeType = cursor.getString(COL_MIMETYPE); |
| 535 | |
Jeff Sharkey | 549aa16 | 2009-05-21 01:33:30 -0700 | [diff] [blame] | 536 | // Handle when a photo appears in the various data items |
| 537 | // TODO: accept a photo only if its marked as primary |
| 538 | if (Photo.CONTENT_ITEM_TYPE.equals(mimeType)) { |
Jeff Sharkey | ecedf75 | 2009-05-18 22:07:40 -0700 | [diff] [blame] | 539 | byte[] photoBlob = cursor.getBlob(COL_PHOTO); |
| 540 | Bitmap photoBitmap = BitmapFactory.decodeByteArray(photoBlob, 0, photoBlob.length); |
Jeff Sharkey | 549aa16 | 2009-05-21 01:33:30 -0700 | [diff] [blame] | 541 | mPhoto.setImageBitmap(photoBitmap); |
Jeff Sharkey | 6912668 | 2009-05-18 21:33:41 -0700 | [diff] [blame] | 542 | continue; |
Jeff Sharkey | 3f17759 | 2009-05-18 15:23:12 -0700 | [diff] [blame] | 543 | } |
| 544 | |
Jeff Sharkey | 549aa16 | 2009-05-21 01:33:30 -0700 | [diff] [blame] | 545 | // Build an action for this data entry, find a mapping to a UI |
| 546 | // element, build its summary from the cursor, and collect it along |
| 547 | // with all others of this mime-type. |
| 548 | info = new ActionInfo(dataId, packageName, mimeType); |
| 549 | if (info.findMapping(mMappingCache)) { |
| 550 | info.buildSummary(cursor); |
| 551 | mActions.collect(info.mimeType, info); |
Jeff Sharkey | 3f17759 | 2009-05-18 15:23:12 -0700 | [diff] [blame] | 552 | } |
| 553 | |
Jeff Sharkey | 549aa16 | 2009-05-21 01:33:30 -0700 | [diff] [blame] | 554 | // If phone number, also insert as text message action |
| 555 | if (Phones.CONTENT_ITEM_TYPE.equals(mimeType)) { |
| 556 | info = new ActionInfo(dataId, packageName, MIME_SMS_ADDRESS); |
| 557 | if (info.findMapping(mMappingCache)) { |
| 558 | info.buildSummary(cursor); |
| 559 | mActions.collect(info.mimeType, info); |
Jeff Sharkey | 3f17759 | 2009-05-18 15:23:12 -0700 | [diff] [blame] | 560 | } |
Jeff Sharkey | 549aa16 | 2009-05-21 01:33:30 -0700 | [diff] [blame] | 561 | } |
Jeff Sharkey | 3f17759 | 2009-05-18 15:23:12 -0700 | [diff] [blame] | 562 | } |
| 563 | |
| 564 | cursor.close(); |
| 565 | |
Jeff Sharkey | 549aa16 | 2009-05-21 01:33:30 -0700 | [diff] [blame] | 566 | // Turn our list of actions into UI elements, starting with common types |
| 567 | Set<String> containedTypes = mActions.keySet(); |
| 568 | for (String mimeType : ORDERED_MIMETYPES) { |
| 569 | if (containedTypes.contains(mimeType)) { |
| 570 | mTrack.addView(inflateAction(mimeType)); |
| 571 | containedTypes.remove(mimeType); |
Jeff Sharkey | 3f17759 | 2009-05-18 15:23:12 -0700 | [diff] [blame] | 572 | } |
Jeff Sharkey | 3f17759 | 2009-05-18 15:23:12 -0700 | [diff] [blame] | 573 | } |
| 574 | |
Jeff Sharkey | 549aa16 | 2009-05-21 01:33:30 -0700 | [diff] [blame] | 575 | // Then continue with remaining mime-types in alphabetical order |
| 576 | String[] remainingTypes = containedTypes.toArray(new String[containedTypes.size()]); |
| 577 | Arrays.sort(remainingTypes); |
| 578 | for (String mimeType : remainingTypes) { |
| 579 | mTrack.addView(inflateAction(mimeType)); |
| 580 | } |
| 581 | |
| 582 | mHasActions = true; |
| 583 | considerShowing(); |
Jeff Sharkey | 3f17759 | 2009-05-18 15:23:12 -0700 | [diff] [blame] | 584 | } |
| 585 | |
| 586 | /** |
Jeff Sharkey | 549aa16 | 2009-05-21 01:33:30 -0700 | [diff] [blame] | 587 | * Inflate the in-track view for the action of the given mime-type. Will use |
| 588 | * the icon provided by the {@link Mapping}. |
Jeff Sharkey | 3f17759 | 2009-05-18 15:23:12 -0700 | [diff] [blame] | 589 | */ |
Jeff Sharkey | 549aa16 | 2009-05-21 01:33:30 -0700 | [diff] [blame] | 590 | private View inflateAction(String mimeType) { |
| 591 | ImageView view = (ImageView)mInflater.inflate(R.layout.fasttrack_item, mTrack, false); |
Jeff Sharkey | 3f17759 | 2009-05-18 15:23:12 -0700 | [diff] [blame] | 592 | |
Jeff Sharkey | 549aa16 | 2009-05-21 01:33:30 -0700 | [diff] [blame] | 593 | // Add direct intent if single child, otherwise flag for multiple |
| 594 | LinkedList<ActionInfo> children = mActions.get(mimeType); |
| 595 | ActionInfo firstInfo = children.get(0); |
| 596 | if (children.size() == 1) { |
| 597 | view.setTag(firstInfo.buildIntent()); |
| 598 | } else { |
| 599 | view.setTag(mimeType); |
Jeff Sharkey | 3f17759 | 2009-05-18 15:23:12 -0700 | [diff] [blame] | 600 | } |
| 601 | |
Jeff Sharkey | 549aa16 | 2009-05-21 01:33:30 -0700 | [diff] [blame] | 602 | // Set icon and listen for clicks |
| 603 | view.setImageBitmap(firstInfo.mapping.icon); |
| 604 | view.setOnClickListener(this); |
| 605 | return view; |
| 606 | } |
Jeff Sharkey | 3f17759 | 2009-05-18 15:23:12 -0700 | [diff] [blame] | 607 | |
Jeff Sharkey | 549aa16 | 2009-05-21 01:33:30 -0700 | [diff] [blame] | 608 | /** {@inheritDoc} */ |
| 609 | public void onClick(View v) { |
| 610 | final Object tag = v.getTag(); |
| 611 | if (tag instanceof Intent) { |
| 612 | // Incoming tag is concrete intent, so launch |
| 613 | try { |
| 614 | mContext.startActivity((Intent)tag); |
| 615 | } catch (ActivityNotFoundException e) { |
| 616 | Log.w(TAG, NOT_FOUND); |
| 617 | Toast.makeText(mContext, NOT_FOUND, Toast.LENGTH_SHORT).show(); |
| 618 | } |
| 619 | } else if (tag instanceof String) { |
| 620 | // Incoming tag is a mime-type, so show resolution list |
| 621 | LinkedList<ActionInfo> children = mActions.get(tag); |
Jeff Sharkey | 3f17759 | 2009-05-18 15:23:12 -0700 | [diff] [blame] | 622 | |
Jeff Sharkey | 549aa16 | 2009-05-21 01:33:30 -0700 | [diff] [blame] | 623 | // TODO: show drop-down resolution list |
| 624 | Log.d(TAG, "would show list between several options here"); |
| 625 | |
| 626 | } |
| 627 | } |
| 628 | |
| 629 | /** {@inheritDoc} */ |
| 630 | public boolean dispatchKeyEvent(KeyEvent event) { |
| 631 | return mWindow.superDispatchKeyEvent(event); |
| 632 | } |
| 633 | |
| 634 | /** {@inheritDoc} */ |
| 635 | public boolean dispatchPopulateAccessibilityEvent(AccessibilityEvent event) { |
| 636 | // TODO: make this window accessible |
| 637 | return false; |
| 638 | } |
| 639 | |
| 640 | /** {@inheritDoc} */ |
| 641 | public boolean dispatchTouchEvent(MotionEvent event) { |
| 642 | if (event.getAction() == MotionEvent.ACTION_OUTSIDE) { |
| 643 | dismiss(); |
| 644 | return true; |
| 645 | } |
| 646 | return mWindow.superDispatchTouchEvent(event); |
| 647 | } |
| 648 | |
| 649 | /** {@inheritDoc} */ |
| 650 | public boolean dispatchTrackballEvent(MotionEvent event) { |
| 651 | return mWindow.superDispatchTrackballEvent(event); |
| 652 | } |
| 653 | |
| 654 | /** {@inheritDoc} */ |
| 655 | public void onContentChanged() { |
| 656 | } |
| 657 | |
| 658 | /** {@inheritDoc} */ |
| 659 | public boolean onCreatePanelMenu(int featureId, Menu menu) { |
| 660 | return false; |
| 661 | } |
| 662 | |
| 663 | /** {@inheritDoc} */ |
| 664 | public View onCreatePanelView(int featureId) { |
| 665 | return null; |
| 666 | } |
| 667 | |
| 668 | /** {@inheritDoc} */ |
| 669 | public boolean onMenuItemSelected(int featureId, MenuItem item) { |
| 670 | return false; |
| 671 | } |
| 672 | |
| 673 | /** {@inheritDoc} */ |
| 674 | public boolean onMenuOpened(int featureId, Menu menu) { |
| 675 | return false; |
| 676 | } |
| 677 | |
| 678 | /** {@inheritDoc} */ |
| 679 | public void onPanelClosed(int featureId, Menu menu) { |
| 680 | } |
| 681 | |
| 682 | /** {@inheritDoc} */ |
| 683 | public boolean onPreparePanel(int featureId, View view, Menu menu) { |
| 684 | return false; |
| 685 | } |
| 686 | |
| 687 | /** {@inheritDoc} */ |
| 688 | public boolean onSearchRequested() { |
| 689 | return false; |
| 690 | } |
| 691 | |
| 692 | /** {@inheritDoc} */ |
| 693 | public void onWindowAttributesChanged(android.view.WindowManager.LayoutParams attrs) { |
| 694 | if (mDecor != null) { |
| 695 | mWindowManager.updateViewLayout(mDecor, attrs); |
| 696 | } |
| 697 | } |
| 698 | |
| 699 | /** {@inheritDoc} */ |
| 700 | public void onWindowFocusChanged(boolean hasFocus) { |
Jeff Sharkey | 3f17759 | 2009-05-18 15:23:12 -0700 | [diff] [blame] | 701 | } |
| 702 | } |