Dmitri Plotnikov | 1ce1e7c | 2010-05-13 16:41:00 -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 | |
| 17 | package com.android.contacts.list; |
| 18 | |
Dmitri Plotnikov | 27b97bc | 2010-10-07 18:06:09 -0700 | [diff] [blame] | 19 | import android.net.Uri; |
Dmitri Plotnikov | 1ce1e7c | 2010-05-13 16:41:00 -0700 | [diff] [blame] | 20 | |
Walter Jang | f9779ef | 2016-05-25 12:23:05 -0700 | [diff] [blame] | 21 | import com.android.contacts.common.model.account.AccountWithDataSet; |
| 22 | |
| 23 | import java.util.ArrayList; |
| 24 | |
Dmitri Plotnikov | 1ce1e7c | 2010-05-13 16:41:00 -0700 | [diff] [blame] | 25 | /** |
| 26 | * Parsed form of the intent sent to the Contacts application. |
| 27 | */ |
Brian Attwell | f48efd7 | 2015-01-21 10:36:22 -0800 | [diff] [blame] | 28 | public class ContactsRequest { |
Dmitri Plotnikov | 1ce1e7c | 2010-05-13 16:41:00 -0700 | [diff] [blame] | 29 | |
| 30 | /** Default mode: browse contacts */ |
| 31 | public static final int ACTION_DEFAULT = 10; |
| 32 | |
Dmitri Plotnikov | 48cc250 | 2010-10-08 14:56:04 -0700 | [diff] [blame] | 33 | /** Show all contacts */ |
| 34 | public static final int ACTION_ALL_CONTACTS = 15; |
| 35 | |
Dmitri Plotnikov | 91ab5b4 | 2010-10-08 15:26:31 -0700 | [diff] [blame] | 36 | /** Show all contacts with phone numbers */ |
| 37 | public static final int ACTION_CONTACTS_WITH_PHONES = 17; |
| 38 | |
Dmitri Plotnikov | 1ce1e7c | 2010-05-13 16:41:00 -0700 | [diff] [blame] | 39 | /** Show contents of a specific group */ |
| 40 | public static final int ACTION_GROUP = 20; |
| 41 | |
Walter Jang | f9779ef | 2016-05-25 12:23:05 -0700 | [diff] [blame] | 42 | /** Show potential new members of a specific group */ |
| 43 | public static final int ACTION_PICK_GROUP_MEMBERS = 21; |
| 44 | |
Walter Jang | 1110d67 | 2016-07-25 17:55:12 +0000 | [diff] [blame] | 45 | /** Create a new group */ |
| 46 | public static final int ACTION_INSERT_GROUP = 22; |
| 47 | |
Wenyi Wang | 7967545 | 2016-08-17 10:43:28 -0700 | [diff] [blame] | 48 | /** View a group */ |
| 49 | public static final int ACTION_VIEW_GROUP = 23; |
| 50 | |
| 51 | /** Edit a group */ |
| 52 | public static final int ACTION_EDIT_GROUP = 24; |
| 53 | |
Dmitri Plotnikov | 1ce1e7c | 2010-05-13 16:41:00 -0700 | [diff] [blame] | 54 | /** Show all starred contacts */ |
| 55 | public static final int ACTION_STARRED = 30; |
| 56 | |
| 57 | /** Show frequently contacted contacts */ |
| 58 | public static final int ACTION_FREQUENT = 40; |
| 59 | |
| 60 | /** Show starred and the frequent */ |
| 61 | public static final int ACTION_STREQUENT = 50; |
| 62 | |
| 63 | /** Show all contacts and pick them when clicking */ |
| 64 | public static final int ACTION_PICK_CONTACT = 60; |
| 65 | |
| 66 | /** Show all contacts as well as the option to create a new one */ |
| 67 | public static final int ACTION_PICK_OR_CREATE_CONTACT = 70; |
| 68 | |
| 69 | /** Show all contacts and pick them for edit when clicking, and allow creating a new contact */ |
| 70 | public static final int ACTION_INSERT_OR_EDIT_CONTACT = 80; |
| 71 | |
| 72 | /** Show all phone numbers and pick them when clicking */ |
| 73 | public static final int ACTION_PICK_PHONE = 90; |
| 74 | |
| 75 | /** Show all postal addresses and pick them when clicking */ |
| 76 | public static final int ACTION_PICK_POSTAL = 100; |
| 77 | |
Daniel Lehmann | c86ace7 | 2011-03-23 21:04:29 -0700 | [diff] [blame] | 78 | /** Show all postal addresses and pick them when clicking */ |
| 79 | public static final int ACTION_PICK_EMAIL = 105; |
| 80 | |
Sean Midford | ff6f1bb | 2016-10-12 09:48:23 -0700 | [diff] [blame] | 81 | /** Show a list of emails for selected contacts and select them when clicking */ |
| 82 | public static final int ACTION_PICK_EMAILS = 106; |
| 83 | |
| 84 | /** Show a list of phones for selected contacts and select them when clicking */ |
| 85 | public static final int ACTION_PICK_PHONES = 107; |
| 86 | |
Dmitri Plotnikov | 1ce1e7c | 2010-05-13 16:41:00 -0700 | [diff] [blame] | 87 | /** Show all contacts and create a shortcut for the picked contact */ |
| 88 | public static final int ACTION_CREATE_SHORTCUT_CONTACT = 110; |
| 89 | |
| 90 | /** Show all phone numbers and create a call shortcut for the picked number */ |
| 91 | public static final int ACTION_CREATE_SHORTCUT_CALL = 120; |
| 92 | |
| 93 | /** Show all phone numbers and create an SMS shortcut for the picked number */ |
| 94 | public static final int ACTION_CREATE_SHORTCUT_SMS = 130; |
| 95 | |
Dmitri Plotnikov | 27b97bc | 2010-10-07 18:06:09 -0700 | [diff] [blame] | 96 | /** Show all contacts and activate the specified one */ |
| 97 | public static final int ACTION_VIEW_CONTACT = 140; |
| 98 | |
Brian Attwell | 81cc3b3 | 2014-07-22 16:04:52 -0700 | [diff] [blame] | 99 | /** Show contacts recommended for joining with a specified target contact */ |
| 100 | public static final int ACTION_PICK_JOIN = 150; |
| 101 | |
Dmitri Plotnikov | 1ce1e7c | 2010-05-13 16:41:00 -0700 | [diff] [blame] | 102 | private boolean mValid = true; |
| 103 | private int mActionCode = ACTION_DEFAULT; |
Dmitri Plotnikov | 1ce1e7c | 2010-05-13 16:41:00 -0700 | [diff] [blame] | 104 | private CharSequence mTitle; |
| 105 | private boolean mSearchMode; |
Dmitri Plotnikov | 1ce1e7c | 2010-05-13 16:41:00 -0700 | [diff] [blame] | 106 | private String mQueryString; |
Wenyi Wang | 7b6bb00 | 2016-04-11 12:40:28 -0700 | [diff] [blame] | 107 | private boolean mIncludeFavorites; |
Dmitri Plotnikov | 1ce1e7c | 2010-05-13 16:41:00 -0700 | [diff] [blame] | 108 | private boolean mLegacyCompatibilityMode; |
Dmitri Plotnikov | 1c5c8e2 | 2010-06-24 15:14:45 -0700 | [diff] [blame] | 109 | private boolean mDirectorySearchEnabled = true; |
Dmitri Plotnikov | 27b97bc | 2010-10-07 18:06:09 -0700 | [diff] [blame] | 110 | private Uri mContactUri; |
Walter Jang | f9779ef | 2016-05-25 12:23:05 -0700 | [diff] [blame] | 111 | private AccountWithDataSet mAccountWithDataSet; |
| 112 | private ArrayList<String> mRawContactIds; |
Dmitri Plotnikov | 1ce1e7c | 2010-05-13 16:41:00 -0700 | [diff] [blame] | 113 | |
Makoto Onuki | 6d9befe | 2011-07-17 11:00:12 -0700 | [diff] [blame] | 114 | @Override |
| 115 | public String toString() { |
| 116 | return "{ContactsRequest:mValid=" + mValid |
| 117 | + " mActionCode=" + mActionCode |
Makoto Onuki | 6d9befe | 2011-07-17 11:00:12 -0700 | [diff] [blame] | 118 | + " mTitle=" + mTitle |
| 119 | + " mSearchMode=" + mSearchMode |
| 120 | + " mQueryString=" + mQueryString |
Wenyi Wang | 7b6bb00 | 2016-04-11 12:40:28 -0700 | [diff] [blame] | 121 | + " mIncludeFavorites=" + mIncludeFavorites |
Makoto Onuki | 6d9befe | 2011-07-17 11:00:12 -0700 | [diff] [blame] | 122 | + " mLegacyCompatibilityMode=" + mLegacyCompatibilityMode |
| 123 | + " mDirectorySearchEnabled=" + mDirectorySearchEnabled |
| 124 | + " mContactUri=" + mContactUri |
Walter Jang | f9779ef | 2016-05-25 12:23:05 -0700 | [diff] [blame] | 125 | + " mAccountWithDataSet=" + mAccountWithDataSet |
| 126 | + " mRawContactIds=" + mRawContactIds |
Makoto Onuki | 6d9befe | 2011-07-17 11:00:12 -0700 | [diff] [blame] | 127 | + "}"; |
| 128 | } |
| 129 | |
Dmitri Plotnikov | 1ce1e7c | 2010-05-13 16:41:00 -0700 | [diff] [blame] | 130 | public boolean isValid() { |
| 131 | return mValid; |
| 132 | } |
| 133 | |
| 134 | public void setValid(boolean flag) { |
| 135 | mValid = flag; |
| 136 | } |
| 137 | |
Dmitri Plotnikov | 1ce1e7c | 2010-05-13 16:41:00 -0700 | [diff] [blame] | 138 | public void setActivityTitle(CharSequence title) { |
| 139 | mTitle = title; |
| 140 | } |
| 141 | |
| 142 | public CharSequence getActivityTitle() { |
| 143 | return mTitle; |
| 144 | } |
| 145 | |
| 146 | public int getActionCode() { |
| 147 | return mActionCode; |
| 148 | } |
| 149 | |
| 150 | public void setActionCode(int actionCode) { |
| 151 | mActionCode = actionCode; |
| 152 | } |
| 153 | |
Dmitri Plotnikov | 1ce1e7c | 2010-05-13 16:41:00 -0700 | [diff] [blame] | 154 | public boolean isSearchMode() { |
| 155 | return mSearchMode; |
| 156 | } |
| 157 | |
| 158 | public void setSearchMode(boolean flag) { |
| 159 | mSearchMode = flag; |
| 160 | } |
| 161 | |
Dmitri Plotnikov | 1ce1e7c | 2010-05-13 16:41:00 -0700 | [diff] [blame] | 162 | public String getQueryString() { |
| 163 | return mQueryString; |
| 164 | } |
| 165 | |
| 166 | public void setQueryString(String string) { |
| 167 | mQueryString = string; |
| 168 | } |
| 169 | |
Wenyi Wang | 7b6bb00 | 2016-04-11 12:40:28 -0700 | [diff] [blame] | 170 | public boolean shouldIncludeFavorites() { |
| 171 | return mIncludeFavorites; |
| 172 | } |
| 173 | |
| 174 | public void setIncludeFavorites(boolean includeFavorites) { |
| 175 | mIncludeFavorites = includeFavorites; |
| 176 | } |
| 177 | |
Dmitri Plotnikov | 1ce1e7c | 2010-05-13 16:41:00 -0700 | [diff] [blame] | 178 | public boolean isLegacyCompatibilityMode() { |
| 179 | return mLegacyCompatibilityMode; |
| 180 | } |
| 181 | |
| 182 | public void setLegacyCompatibilityMode(boolean flag) { |
| 183 | mLegacyCompatibilityMode = flag; |
| 184 | } |
Dmitri Plotnikov | 1c5c8e2 | 2010-06-24 15:14:45 -0700 | [diff] [blame] | 185 | |
| 186 | /** |
| 187 | * Determines whether this search request should include directories or |
| 188 | * is limited to local contacts only. |
| 189 | */ |
| 190 | public boolean isDirectorySearchEnabled() { |
| 191 | return mDirectorySearchEnabled; |
| 192 | } |
| 193 | |
| 194 | public void setDirectorySearchEnabled(boolean flag) { |
| 195 | mDirectorySearchEnabled = flag; |
| 196 | } |
Dmitri Plotnikov | 27b97bc | 2010-10-07 18:06:09 -0700 | [diff] [blame] | 197 | |
| 198 | public Uri getContactUri() { |
| 199 | return mContactUri; |
| 200 | } |
| 201 | |
| 202 | public void setContactUri(Uri contactUri) { |
| 203 | this.mContactUri = contactUri; |
| 204 | } |
Walter Jang | f9779ef | 2016-05-25 12:23:05 -0700 | [diff] [blame] | 205 | |
| 206 | public AccountWithDataSet getAccountWithDataSet() { |
| 207 | return mAccountWithDataSet; |
| 208 | } |
| 209 | |
| 210 | public void setAccountWithDataSet(AccountWithDataSet accountWithDataSet) { |
| 211 | mAccountWithDataSet = accountWithDataSet; |
| 212 | } |
| 213 | |
| 214 | public ArrayList<String> getRawContactIds() { |
| 215 | return mRawContactIds; |
| 216 | } |
| 217 | |
| 218 | public void setRawContactIds(ArrayList<String> rawContactIds) { |
| 219 | mRawContactIds = rawContactIds; |
| 220 | } |
Dmitri Plotnikov | 1ce1e7c | 2010-05-13 16:41:00 -0700 | [diff] [blame] | 221 | } |