blob: 70ce80d0ee0390ead0d2373136e433a1354cc8dd [file] [log] [blame]
Dmitri Plotnikov1ce1e7c2010-05-13 16:41:00 -07001/*
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
17package com.android.contacts.list;
18
Dmitri Plotnikov27b97bc2010-10-07 18:06:09 -070019import android.net.Uri;
Dmitri Plotnikov1ce1e7c2010-05-13 16:41:00 -070020
Walter Jangf9779ef2016-05-25 12:23:05 -070021import com.android.contacts.common.model.account.AccountWithDataSet;
22
23import java.util.ArrayList;
24
Dmitri Plotnikov1ce1e7c2010-05-13 16:41:00 -070025/**
26 * Parsed form of the intent sent to the Contacts application.
27 */
Brian Attwellf48efd72015-01-21 10:36:22 -080028public class ContactsRequest {
Dmitri Plotnikov1ce1e7c2010-05-13 16:41:00 -070029
30 /** Default mode: browse contacts */
31 public static final int ACTION_DEFAULT = 10;
32
Dmitri Plotnikov48cc2502010-10-08 14:56:04 -070033 /** Show all contacts */
34 public static final int ACTION_ALL_CONTACTS = 15;
35
Dmitri Plotnikov91ab5b42010-10-08 15:26:31 -070036 /** Show all contacts with phone numbers */
37 public static final int ACTION_CONTACTS_WITH_PHONES = 17;
38
Dmitri Plotnikov1ce1e7c2010-05-13 16:41:00 -070039 /** Show contents of a specific group */
40 public static final int ACTION_GROUP = 20;
41
Walter Jangf9779ef2016-05-25 12:23:05 -070042 /** Show potential new members of a specific group */
43 public static final int ACTION_PICK_GROUP_MEMBERS = 21;
44
Walter Jang1110d672016-07-25 17:55:12 +000045 /** Create a new group */
46 public static final int ACTION_INSERT_GROUP = 22;
47
Wenyi Wang79675452016-08-17 10:43:28 -070048 /** 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 Plotnikov1ce1e7c2010-05-13 16:41:00 -070054 /** 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 Lehmannc86ace72011-03-23 21:04:29 -070078 /** Show all postal addresses and pick them when clicking */
79 public static final int ACTION_PICK_EMAIL = 105;
80
Sean Midfordff6f1bb2016-10-12 09:48:23 -070081 /** 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 Plotnikov1ce1e7c2010-05-13 16:41:00 -070087 /** 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 Plotnikov27b97bc2010-10-07 18:06:09 -070096 /** Show all contacts and activate the specified one */
97 public static final int ACTION_VIEW_CONTACT = 140;
98
Brian Attwell81cc3b32014-07-22 16:04:52 -070099 /** Show contacts recommended for joining with a specified target contact */
100 public static final int ACTION_PICK_JOIN = 150;
101
Dmitri Plotnikov1ce1e7c2010-05-13 16:41:00 -0700102 private boolean mValid = true;
103 private int mActionCode = ACTION_DEFAULT;
Dmitri Plotnikov1ce1e7c2010-05-13 16:41:00 -0700104 private CharSequence mTitle;
105 private boolean mSearchMode;
Dmitri Plotnikov1ce1e7c2010-05-13 16:41:00 -0700106 private String mQueryString;
Wenyi Wang7b6bb002016-04-11 12:40:28 -0700107 private boolean mIncludeFavorites;
Dmitri Plotnikov1ce1e7c2010-05-13 16:41:00 -0700108 private boolean mLegacyCompatibilityMode;
Dmitri Plotnikov1c5c8e22010-06-24 15:14:45 -0700109 private boolean mDirectorySearchEnabled = true;
Dmitri Plotnikov27b97bc2010-10-07 18:06:09 -0700110 private Uri mContactUri;
Walter Jangf9779ef2016-05-25 12:23:05 -0700111 private AccountWithDataSet mAccountWithDataSet;
112 private ArrayList<String> mRawContactIds;
Dmitri Plotnikov1ce1e7c2010-05-13 16:41:00 -0700113
Makoto Onuki6d9befe2011-07-17 11:00:12 -0700114 @Override
115 public String toString() {
116 return "{ContactsRequest:mValid=" + mValid
117 + " mActionCode=" + mActionCode
Makoto Onuki6d9befe2011-07-17 11:00:12 -0700118 + " mTitle=" + mTitle
119 + " mSearchMode=" + mSearchMode
120 + " mQueryString=" + mQueryString
Wenyi Wang7b6bb002016-04-11 12:40:28 -0700121 + " mIncludeFavorites=" + mIncludeFavorites
Makoto Onuki6d9befe2011-07-17 11:00:12 -0700122 + " mLegacyCompatibilityMode=" + mLegacyCompatibilityMode
123 + " mDirectorySearchEnabled=" + mDirectorySearchEnabled
124 + " mContactUri=" + mContactUri
Walter Jangf9779ef2016-05-25 12:23:05 -0700125 + " mAccountWithDataSet=" + mAccountWithDataSet
126 + " mRawContactIds=" + mRawContactIds
Makoto Onuki6d9befe2011-07-17 11:00:12 -0700127 + "}";
128 }
129
Dmitri Plotnikov1ce1e7c2010-05-13 16:41:00 -0700130 public boolean isValid() {
131 return mValid;
132 }
133
134 public void setValid(boolean flag) {
135 mValid = flag;
136 }
137
Dmitri Plotnikov1ce1e7c2010-05-13 16:41:00 -0700138 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 Plotnikov1ce1e7c2010-05-13 16:41:00 -0700154 public boolean isSearchMode() {
155 return mSearchMode;
156 }
157
158 public void setSearchMode(boolean flag) {
159 mSearchMode = flag;
160 }
161
Dmitri Plotnikov1ce1e7c2010-05-13 16:41:00 -0700162 public String getQueryString() {
163 return mQueryString;
164 }
165
166 public void setQueryString(String string) {
167 mQueryString = string;
168 }
169
Wenyi Wang7b6bb002016-04-11 12:40:28 -0700170 public boolean shouldIncludeFavorites() {
171 return mIncludeFavorites;
172 }
173
174 public void setIncludeFavorites(boolean includeFavorites) {
175 mIncludeFavorites = includeFavorites;
176 }
177
Dmitri Plotnikov1ce1e7c2010-05-13 16:41:00 -0700178 public boolean isLegacyCompatibilityMode() {
179 return mLegacyCompatibilityMode;
180 }
181
182 public void setLegacyCompatibilityMode(boolean flag) {
183 mLegacyCompatibilityMode = flag;
184 }
Dmitri Plotnikov1c5c8e22010-06-24 15:14:45 -0700185
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 Plotnikov27b97bc2010-10-07 18:06:09 -0700197
198 public Uri getContactUri() {
199 return mContactUri;
200 }
201
202 public void setContactUri(Uri contactUri) {
203 this.mContactUri = contactUri;
204 }
Walter Jangf9779ef2016-05-25 12:23:05 -0700205
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 Plotnikov1ce1e7c2010-05-13 16:41:00 -0700221}