Dmitri Plotnikov | 6178cb4 | 2010-04-20 11:26:05 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2010 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 | |
Dmitri Plotnikov | 0906ee3 | 2010-04-22 10:46:00 -0700 | [diff] [blame] | 17 | package com.android.contacts.list; |
Dmitri Plotnikov | 6178cb4 | 2010-04-20 11:26:05 -0700 | [diff] [blame] | 18 | |
Dmitri Plotnikov | 6178cb4 | 2010-04-20 11:26:05 -0700 | [diff] [blame] | 19 | import android.app.Activity; |
| 20 | import android.app.SearchManager; |
Dmitri Plotnikov | 6178cb4 | 2010-04-20 11:26:05 -0700 | [diff] [blame] | 21 | import android.content.Intent; |
Dmitri Plotnikov | 6178cb4 | 2010-04-20 11:26:05 -0700 | [diff] [blame] | 22 | import android.net.Uri; |
Dmitri Plotnikov | 6178cb4 | 2010-04-20 11:26:05 -0700 | [diff] [blame] | 23 | import android.provider.Contacts.ContactMethods; |
| 24 | import android.provider.Contacts.People; |
| 25 | import android.provider.Contacts.Phones; |
Daisuke Miyakawa | f0c4681 | 2011-08-23 15:58:21 -0700 | [diff] [blame] | 26 | import android.provider.ContactsContract; |
Daniel Lehmann | c86ace7 | 2011-03-23 21:04:29 -0700 | [diff] [blame] | 27 | import android.provider.ContactsContract.CommonDataKinds.Email; |
Dmitri Plotnikov | 6178cb4 | 2010-04-20 11:26:05 -0700 | [diff] [blame] | 28 | import android.provider.ContactsContract.CommonDataKinds.Phone; |
| 29 | import android.provider.ContactsContract.CommonDataKinds.StructuredPostal; |
Dmitri Plotnikov | 40ec3a8 | 2010-11-10 11:25:33 -0800 | [diff] [blame] | 30 | import android.provider.ContactsContract.Contacts; |
Walter Jang | f9779ef | 2016-05-25 12:23:05 -0700 | [diff] [blame] | 31 | import android.provider.ContactsContract.Groups; |
Dmitri Plotnikov | 40ec3a8 | 2010-11-10 11:25:33 -0800 | [diff] [blame] | 32 | import android.provider.ContactsContract.Intents; |
Katherine Kuan | 1ce53ff | 2011-12-20 14:12:32 -0800 | [diff] [blame] | 33 | import android.provider.ContactsContract.Intents.Insert; |
Dmitri Plotnikov | 6178cb4 | 2010-04-20 11:26:05 -0700 | [diff] [blame] | 34 | import android.text.TextUtils; |
| 35 | import android.util.Log; |
| 36 | |
Wenyi Wang | 7967545 | 2016-08-17 10:43:28 -0700 | [diff] [blame] | 37 | import com.android.contacts.group.GroupUtil; |
Gary Mai | 0a49afa | 2016-12-05 15:53:58 -0800 | [diff] [blame] | 38 | import com.android.contacts.model.account.AccountWithDataSet; |
Walter Jang | f9779ef | 2016-05-25 12:23:05 -0700 | [diff] [blame] | 39 | |
Dmitri Plotnikov | 6178cb4 | 2010-04-20 11:26:05 -0700 | [diff] [blame] | 40 | /** |
Dmitri Plotnikov | fe42e55 | 2010-05-14 14:50:32 -0700 | [diff] [blame] | 41 | * Parses a Contacts intent, extracting all relevant parts and packaging them |
| 42 | * as a {@link ContactsRequest} object. |
Dmitri Plotnikov | 6178cb4 | 2010-04-20 11:26:05 -0700 | [diff] [blame] | 43 | */ |
| 44 | @SuppressWarnings("deprecation") |
Dmitri Plotnikov | 0906ee3 | 2010-04-22 10:46:00 -0700 | [diff] [blame] | 45 | public class ContactsIntentResolver { |
Dmitri Plotnikov | 6178cb4 | 2010-04-20 11:26:05 -0700 | [diff] [blame] | 46 | |
Dmitri Plotnikov | b979b42 | 2010-07-01 15:29:15 -0700 | [diff] [blame] | 47 | private static final String TAG = "ContactsIntentResolver"; |
Dmitri Plotnikov | 6178cb4 | 2010-04-20 11:26:05 -0700 | [diff] [blame] | 48 | |
Dmitri Plotnikov | 6178cb4 | 2010-04-20 11:26:05 -0700 | [diff] [blame] | 49 | private final Activity mContext; |
Dmitri Plotnikov | 6178cb4 | 2010-04-20 11:26:05 -0700 | [diff] [blame] | 50 | |
Dmitri Plotnikov | 1540674 | 2010-05-07 09:22:49 -0700 | [diff] [blame] | 51 | public ContactsIntentResolver(Activity context) { |
Dmitri Plotnikov | 6178cb4 | 2010-04-20 11:26:05 -0700 | [diff] [blame] | 52 | this.mContext = context; |
| 53 | } |
| 54 | |
Dmitri Plotnikov | 1ce1e7c | 2010-05-13 16:41:00 -0700 | [diff] [blame] | 55 | public ContactsRequest resolveIntent(Intent intent) { |
| 56 | ContactsRequest request = new ContactsRequest(); |
Dmitri Plotnikov | 1ce1e7c | 2010-05-13 16:41:00 -0700 | [diff] [blame] | 57 | |
Dmitri Plotnikov | 6178cb4 | 2010-04-20 11:26:05 -0700 | [diff] [blame] | 58 | String action = intent.getAction(); |
Dmitri Plotnikov | 6178cb4 | 2010-04-20 11:26:05 -0700 | [diff] [blame] | 59 | |
Dmitri Plotnikov | 6178cb4 | 2010-04-20 11:26:05 -0700 | [diff] [blame] | 60 | Log.i(TAG, "Called with action: " + action); |
Dmitri Plotnikov | 1ce1e7c | 2010-05-13 16:41:00 -0700 | [diff] [blame] | 61 | |
Brian Attwell | c3d202c | 2015-01-08 15:01:03 -0800 | [diff] [blame] | 62 | if (UiIntentActions.LIST_DEFAULT.equals(action) ) { |
Dmitri Plotnikov | 1ce1e7c | 2010-05-13 16:41:00 -0700 | [diff] [blame] | 63 | request.setActionCode(ContactsRequest.ACTION_DEFAULT); |
Brian Attwell | c3d202c | 2015-01-08 15:01:03 -0800 | [diff] [blame] | 64 | } else if (UiIntentActions.LIST_ALL_CONTACTS_ACTION.equals(action)) { |
Dmitri Plotnikov | 48cc250 | 2010-10-08 14:56:04 -0700 | [diff] [blame] | 65 | request.setActionCode(ContactsRequest.ACTION_ALL_CONTACTS); |
Brian Attwell | c3d202c | 2015-01-08 15:01:03 -0800 | [diff] [blame] | 66 | } else if (UiIntentActions.LIST_CONTACTS_WITH_PHONES_ACTION.equals(action)) { |
Dmitri Plotnikov | 91ab5b4 | 2010-10-08 15:26:31 -0700 | [diff] [blame] | 67 | request.setActionCode(ContactsRequest.ACTION_CONTACTS_WITH_PHONES); |
Brian Attwell | c3d202c | 2015-01-08 15:01:03 -0800 | [diff] [blame] | 68 | } else if (UiIntentActions.LIST_STARRED_ACTION.equals(action)) { |
Dmitri Plotnikov | 1ce1e7c | 2010-05-13 16:41:00 -0700 | [diff] [blame] | 69 | request.setActionCode(ContactsRequest.ACTION_STARRED); |
Brian Attwell | c3d202c | 2015-01-08 15:01:03 -0800 | [diff] [blame] | 70 | } else if (UiIntentActions.LIST_FREQUENT_ACTION.equals(action)) { |
Dmitri Plotnikov | 1ce1e7c | 2010-05-13 16:41:00 -0700 | [diff] [blame] | 71 | request.setActionCode(ContactsRequest.ACTION_FREQUENT); |
Brian Attwell | c3d202c | 2015-01-08 15:01:03 -0800 | [diff] [blame] | 72 | } else if (UiIntentActions.LIST_STREQUENT_ACTION.equals(action)) { |
Dmitri Plotnikov | 1ce1e7c | 2010-05-13 16:41:00 -0700 | [diff] [blame] | 73 | request.setActionCode(ContactsRequest.ACTION_STREQUENT); |
Brian Attwell | c3d202c | 2015-01-08 15:01:03 -0800 | [diff] [blame] | 74 | } else if (UiIntentActions.LIST_GROUP_ACTION.equals(action)) { |
Dmitri Plotnikov | 1ce1e7c | 2010-05-13 16:41:00 -0700 | [diff] [blame] | 75 | request.setActionCode(ContactsRequest.ACTION_GROUP); |
Brian Attwell | c3d202c | 2015-01-08 15:01:03 -0800 | [diff] [blame] | 76 | // We no longer support UiIntentActions.GROUP_NAME_EXTRA_KEY |
Sean Midford | ff6f1bb | 2016-10-12 09:48:23 -0700 | [diff] [blame] | 77 | } else if (UiIntentActions.ACTION_SELECT_ITEMS.equals(action)) { |
| 78 | final String resolvedType = intent.resolveType(mContext); |
| 79 | if (Phone.CONTENT_TYPE.equals(resolvedType)) { |
| 80 | request.setActionCode(ContactsRequest.ACTION_PICK_PHONES); |
| 81 | } else if (Email.CONTENT_TYPE.equals(resolvedType)) { |
| 82 | request.setActionCode(ContactsRequest.ACTION_PICK_EMAILS); |
| 83 | } |
Dmitri Plotnikov | 6178cb4 | 2010-04-20 11:26:05 -0700 | [diff] [blame] | 84 | } else if (Intent.ACTION_PICK.equals(action)) { |
Dmitri Plotnikov | 6178cb4 | 2010-04-20 11:26:05 -0700 | [diff] [blame] | 85 | final String resolvedType = intent.resolveType(mContext); |
| 86 | if (Contacts.CONTENT_TYPE.equals(resolvedType)) { |
Dmitri Plotnikov | 1ce1e7c | 2010-05-13 16:41:00 -0700 | [diff] [blame] | 87 | request.setActionCode(ContactsRequest.ACTION_PICK_CONTACT); |
Dmitri Plotnikov | 6178cb4 | 2010-04-20 11:26:05 -0700 | [diff] [blame] | 88 | } else if (People.CONTENT_TYPE.equals(resolvedType)) { |
Dmitri Plotnikov | 1ce1e7c | 2010-05-13 16:41:00 -0700 | [diff] [blame] | 89 | request.setActionCode(ContactsRequest.ACTION_PICK_CONTACT); |
| 90 | request.setLegacyCompatibilityMode(true); |
Dmitri Plotnikov | 6178cb4 | 2010-04-20 11:26:05 -0700 | [diff] [blame] | 91 | } else if (Phone.CONTENT_TYPE.equals(resolvedType)) { |
Dmitri Plotnikov | 1ce1e7c | 2010-05-13 16:41:00 -0700 | [diff] [blame] | 92 | request.setActionCode(ContactsRequest.ACTION_PICK_PHONE); |
Dmitri Plotnikov | 6178cb4 | 2010-04-20 11:26:05 -0700 | [diff] [blame] | 93 | } else if (Phones.CONTENT_TYPE.equals(resolvedType)) { |
Dmitri Plotnikov | 1ce1e7c | 2010-05-13 16:41:00 -0700 | [diff] [blame] | 94 | request.setActionCode(ContactsRequest.ACTION_PICK_PHONE); |
| 95 | request.setLegacyCompatibilityMode(true); |
Dmitri Plotnikov | 6178cb4 | 2010-04-20 11:26:05 -0700 | [diff] [blame] | 96 | } else if (StructuredPostal.CONTENT_TYPE.equals(resolvedType)) { |
Dmitri Plotnikov | 1ce1e7c | 2010-05-13 16:41:00 -0700 | [diff] [blame] | 97 | request.setActionCode(ContactsRequest.ACTION_PICK_POSTAL); |
Dmitri Plotnikov | 6178cb4 | 2010-04-20 11:26:05 -0700 | [diff] [blame] | 98 | } else if (ContactMethods.CONTENT_POSTAL_TYPE.equals(resolvedType)) { |
Dmitri Plotnikov | 1ce1e7c | 2010-05-13 16:41:00 -0700 | [diff] [blame] | 99 | request.setActionCode(ContactsRequest.ACTION_PICK_POSTAL); |
| 100 | request.setLegacyCompatibilityMode(true); |
Daniel Lehmann | c86ace7 | 2011-03-23 21:04:29 -0700 | [diff] [blame] | 101 | } else if (Email.CONTENT_TYPE.equals(resolvedType)) { |
| 102 | request.setActionCode(ContactsRequest.ACTION_PICK_EMAIL); |
Walter Jang | 7c596c7 | 2016-07-25 12:55:27 -0700 | [diff] [blame] | 103 | } else if (Groups.CONTENT_TYPE.equals(resolvedType)) { |
Walter Jang | f9779ef | 2016-05-25 12:23:05 -0700 | [diff] [blame] | 104 | request.setActionCode(ContactsRequest.ACTION_PICK_GROUP_MEMBERS); |
Walter Jang | 6c5a558 | 2016-06-16 11:26:53 -0700 | [diff] [blame] | 105 | request.setAccountWithDataSet(new AccountWithDataSet( |
| 106 | intent.getStringExtra(UiIntentActions.GROUP_ACCOUNT_NAME), |
| 107 | intent.getStringExtra(UiIntentActions.GROUP_ACCOUNT_TYPE), |
| 108 | intent.getStringExtra(UiIntentActions.GROUP_ACCOUNT_DATA_SET))); |
Walter Jang | f9779ef | 2016-05-25 12:23:05 -0700 | [diff] [blame] | 109 | request.setRawContactIds(intent.getStringArrayListExtra( |
Walter Jang | 16c2959 | 2016-06-14 15:34:39 -0700 | [diff] [blame] | 110 | UiIntentActions.GROUP_CONTACT_IDS)); |
Dmitri Plotnikov | 6178cb4 | 2010-04-20 11:26:05 -0700 | [diff] [blame] | 111 | } |
| 112 | } else if (Intent.ACTION_CREATE_SHORTCUT.equals(action)) { |
Dmitri Plotnikov | 884e393 | 2010-05-13 19:13:51 -0700 | [diff] [blame] | 113 | String component = intent.getComponent().getClassName(); |
Dmitri Plotnikov | 6178cb4 | 2010-04-20 11:26:05 -0700 | [diff] [blame] | 114 | if (component.equals("alias.DialShortcut")) { |
Dmitri Plotnikov | 1ce1e7c | 2010-05-13 16:41:00 -0700 | [diff] [blame] | 115 | request.setActionCode(ContactsRequest.ACTION_CREATE_SHORTCUT_CALL); |
Dmitri Plotnikov | 6178cb4 | 2010-04-20 11:26:05 -0700 | [diff] [blame] | 116 | } else if (component.equals("alias.MessageShortcut")) { |
Dmitri Plotnikov | 1ce1e7c | 2010-05-13 16:41:00 -0700 | [diff] [blame] | 117 | request.setActionCode(ContactsRequest.ACTION_CREATE_SHORTCUT_SMS); |
Dmitri Plotnikov | 6178cb4 | 2010-04-20 11:26:05 -0700 | [diff] [blame] | 118 | } else { |
Dmitri Plotnikov | 1ce1e7c | 2010-05-13 16:41:00 -0700 | [diff] [blame] | 119 | request.setActionCode(ContactsRequest.ACTION_CREATE_SHORTCUT_CONTACT); |
Dmitri Plotnikov | 6178cb4 | 2010-04-20 11:26:05 -0700 | [diff] [blame] | 120 | } |
| 121 | } else if (Intent.ACTION_GET_CONTENT.equals(action)) { |
Dmitri Plotnikov | 884e393 | 2010-05-13 19:13:51 -0700 | [diff] [blame] | 122 | String type = intent.getType(); |
Dmitri Plotnikov | 6178cb4 | 2010-04-20 11:26:05 -0700 | [diff] [blame] | 123 | if (Contacts.CONTENT_ITEM_TYPE.equals(type)) { |
Dmitri Plotnikov | 1ce1e7c | 2010-05-13 16:41:00 -0700 | [diff] [blame] | 124 | request.setActionCode(ContactsRequest.ACTION_PICK_OR_CREATE_CONTACT); |
Dmitri Plotnikov | 6178cb4 | 2010-04-20 11:26:05 -0700 | [diff] [blame] | 125 | } else if (Phone.CONTENT_ITEM_TYPE.equals(type)) { |
Dmitri Plotnikov | 1ce1e7c | 2010-05-13 16:41:00 -0700 | [diff] [blame] | 126 | request.setActionCode(ContactsRequest.ACTION_PICK_PHONE); |
Dmitri Plotnikov | 6178cb4 | 2010-04-20 11:26:05 -0700 | [diff] [blame] | 127 | } else if (Phones.CONTENT_ITEM_TYPE.equals(type)) { |
Dmitri Plotnikov | 1ce1e7c | 2010-05-13 16:41:00 -0700 | [diff] [blame] | 128 | request.setActionCode(ContactsRequest.ACTION_PICK_PHONE); |
| 129 | request.setLegacyCompatibilityMode(true); |
Dmitri Plotnikov | 6178cb4 | 2010-04-20 11:26:05 -0700 | [diff] [blame] | 130 | } else if (StructuredPostal.CONTENT_ITEM_TYPE.equals(type)) { |
Dmitri Plotnikov | 1ce1e7c | 2010-05-13 16:41:00 -0700 | [diff] [blame] | 131 | request.setActionCode(ContactsRequest.ACTION_PICK_POSTAL); |
Dmitri Plotnikov | 6178cb4 | 2010-04-20 11:26:05 -0700 | [diff] [blame] | 132 | } else if (ContactMethods.CONTENT_POSTAL_ITEM_TYPE.equals(type)) { |
Dmitri Plotnikov | 1ce1e7c | 2010-05-13 16:41:00 -0700 | [diff] [blame] | 133 | request.setActionCode(ContactsRequest.ACTION_PICK_POSTAL); |
| 134 | request.setLegacyCompatibilityMode(true); |
Dmitri Plotnikov | 6178cb4 | 2010-04-20 11:26:05 -0700 | [diff] [blame] | 135 | } else if (People.CONTENT_ITEM_TYPE.equals(type)) { |
Dmitri Plotnikov | 1ce1e7c | 2010-05-13 16:41:00 -0700 | [diff] [blame] | 136 | request.setActionCode(ContactsRequest.ACTION_PICK_OR_CREATE_CONTACT); |
| 137 | request.setLegacyCompatibilityMode(true); |
Dmitri Plotnikov | 6178cb4 | 2010-04-20 11:26:05 -0700 | [diff] [blame] | 138 | } |
Dmitri Plotnikov | 6178cb4 | 2010-04-20 11:26:05 -0700 | [diff] [blame] | 139 | } else if (Intent.ACTION_INSERT_OR_EDIT.equals(action)) { |
Dmitri Plotnikov | 1ce1e7c | 2010-05-13 16:41:00 -0700 | [diff] [blame] | 140 | request.setActionCode(ContactsRequest.ACTION_INSERT_OR_EDIT_CONTACT); |
Walter Jang | 1110d67 | 2016-07-25 17:55:12 +0000 | [diff] [blame] | 141 | } else if (Intent.ACTION_INSERT.equals(action) && |
| 142 | Groups.CONTENT_TYPE.equals(intent.getType())) { |
| 143 | request.setActionCode(ContactsRequest.ACTION_INSERT_GROUP); |
Dmitri Plotnikov | 6178cb4 | 2010-04-20 11:26:05 -0700 | [diff] [blame] | 144 | } else if (Intent.ACTION_SEARCH.equals(action)) { |
Katherine Kuan | 1ce53ff | 2011-12-20 14:12:32 -0800 | [diff] [blame] | 145 | String query = intent.getStringExtra(SearchManager.QUERY); |
Makoto Onuki | 2dd9917 | 2012-07-31 14:15:28 -0700 | [diff] [blame] | 146 | // If the {@link SearchManager.QUERY} is empty, then check if a phone number |
| 147 | // or email is specified, in that priority. |
| 148 | if (TextUtils.isEmpty(query)) { |
| 149 | query = intent.getStringExtra(Insert.PHONE); |
Dmitri Plotnikov | 6178cb4 | 2010-04-20 11:26:05 -0700 | [diff] [blame] | 150 | } |
Makoto Onuki | 2dd9917 | 2012-07-31 14:15:28 -0700 | [diff] [blame] | 151 | if (TextUtils.isEmpty(query)) { |
| 152 | query = intent.getStringExtra(Insert.EMAIL); |
| 153 | } |
| 154 | request.setQueryString(query); |
| 155 | request.setSearchMode(true); |
Dmitri Plotnikov | 40ec3a8 | 2010-11-10 11:25:33 -0800 | [diff] [blame] | 156 | } else if (Intent.ACTION_VIEW.equals(action)) { |
Daisuke Miyakawa | f0c4681 | 2011-08-23 15:58:21 -0700 | [diff] [blame] | 157 | final String resolvedType = intent.resolveType(mContext); |
| 158 | if (ContactsContract.Contacts.CONTENT_TYPE.equals(resolvedType) |
| 159 | || android.provider.Contacts.People.CONTENT_TYPE.equals(resolvedType)) { |
| 160 | request.setActionCode(ContactsRequest.ACTION_ALL_CONTACTS); |
Wenyi Wang | 7967545 | 2016-08-17 10:43:28 -0700 | [diff] [blame] | 161 | } else if (!GroupUtil.isGroupUri(intent.getData())){ |
Daisuke Miyakawa | f0c4681 | 2011-08-23 15:58:21 -0700 | [diff] [blame] | 162 | request.setActionCode(ContactsRequest.ACTION_VIEW_CONTACT); |
| 163 | request.setContactUri(intent.getData()); |
| 164 | intent.setAction(Intent.ACTION_DEFAULT); |
| 165 | intent.setData(null); |
Wenyi Wang | 7967545 | 2016-08-17 10:43:28 -0700 | [diff] [blame] | 166 | } else { |
| 167 | request.setActionCode(ContactsRequest.ACTION_VIEW_GROUP); |
| 168 | request.setContactUri(intent.getData()); |
| 169 | } |
| 170 | } else if (Intent.ACTION_EDIT.equals(action)) { |
| 171 | if (GroupUtil.isGroupUri(intent.getData())){ |
| 172 | request.setActionCode(ContactsRequest.ACTION_EDIT_GROUP); |
| 173 | request.setContactUri(intent.getData()); |
Daisuke Miyakawa | f0c4681 | 2011-08-23 15:58:21 -0700 | [diff] [blame] | 174 | } |
Dmitri Plotnikov | 6178cb4 | 2010-04-20 11:26:05 -0700 | [diff] [blame] | 175 | // Since this is the filter activity it receives all intents |
| 176 | // dispatched from the SearchManager for security reasons |
| 177 | // so we need to re-dispatch from here to the intended target. |
| 178 | } else if (Intents.SEARCH_SUGGESTION_CLICKED.equals(action)) { |
| 179 | Uri data = intent.getData(); |
Makoto Onuki | 2dd9917 | 2012-07-31 14:15:28 -0700 | [diff] [blame] | 180 | request.setActionCode(ContactsRequest.ACTION_VIEW_CONTACT); |
| 181 | request.setContactUri(data); |
| 182 | intent.setAction(Intent.ACTION_DEFAULT); |
| 183 | intent.setData(null); |
Brian Attwell | c3d202c | 2015-01-08 15:01:03 -0800 | [diff] [blame] | 184 | } else if (UiIntentActions.PICK_JOIN_CONTACT_ACTION.equals(action)) { |
Brian Attwell | 81cc3b3 | 2014-07-22 16:04:52 -0700 | [diff] [blame] | 185 | request.setActionCode(ContactsRequest.ACTION_PICK_JOIN); |
Dmitri Plotnikov | 884e393 | 2010-05-13 19:13:51 -0700 | [diff] [blame] | 186 | } |
Dmitri Plotnikov | 1ce1e7c | 2010-05-13 16:41:00 -0700 | [diff] [blame] | 187 | // Allow the title to be set to a custom String using an extra on the intent |
Brian Attwell | c3d202c | 2015-01-08 15:01:03 -0800 | [diff] [blame] | 188 | String title = intent.getStringExtra(UiIntentActions.TITLE_EXTRA_KEY); |
Dmitri Plotnikov | 1ce1e7c | 2010-05-13 16:41:00 -0700 | [diff] [blame] | 189 | if (title != null) { |
| 190 | request.setActivityTitle(title); |
Dmitri Plotnikov | 6178cb4 | 2010-04-20 11:26:05 -0700 | [diff] [blame] | 191 | } |
Dmitri Plotnikov | 1ce1e7c | 2010-05-13 16:41:00 -0700 | [diff] [blame] | 192 | return request; |
Dmitri Plotnikov | 6178cb4 | 2010-04-20 11:26:05 -0700 | [diff] [blame] | 193 | } |
Dmitri Plotnikov | 6178cb4 | 2010-04-20 11:26:05 -0700 | [diff] [blame] | 194 | } |