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 19 import android.net.Uri; 20 21 import com.android.contacts.model.account.AccountWithDataSet; 22 23 import java.util.ArrayList; 24 25 /** 26 * Parsed form of the intent sent to the Contacts application. 27 */ 28 public class ContactsRequest { 29 30 /** Default mode: browse contacts */ 31 public static final int ACTION_DEFAULT = 10; 32 33 /** Show all contacts */ 34 public static final int ACTION_ALL_CONTACTS = 15; 35 36 /** Show all contacts with phone numbers */ 37 public static final int ACTION_CONTACTS_WITH_PHONES = 17; 38 39 /** Show contents of a specific group */ 40 public static final int ACTION_GROUP = 20; 41 42 /** Show potential new members of a specific group */ 43 public static final int ACTION_PICK_GROUP_MEMBERS = 21; 44 45 /** Create a new group */ 46 public static final int ACTION_INSERT_GROUP = 22; 47 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 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 78 /** Show all postal addresses and pick them when clicking */ 79 public static final int ACTION_PICK_EMAIL = 105; 80 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 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 96 /** Show all contacts and activate the specified one */ 97 public static final int ACTION_VIEW_CONTACT = 140; 98 99 /** Show contacts recommended for joining with a specified target contact */ 100 public static final int ACTION_PICK_JOIN = 150; 101 102 private boolean mValid = true; 103 private int mActionCode = ACTION_DEFAULT; 104 private CharSequence mTitle; 105 private boolean mSearchMode; 106 private String mQueryString; 107 private boolean mIncludeFavorites; 108 private boolean mLegacyCompatibilityMode; 109 private boolean mDirectorySearchEnabled = true; 110 private Uri mContactUri; 111 private AccountWithDataSet mAccountWithDataSet; 112 private ArrayList<String> mRawContactIds; 113 114 @Override toString()115 public String toString() { 116 return "{ContactsRequest:mValid=" + mValid 117 + " mActionCode=" + mActionCode 118 + " mTitle=" + mTitle 119 + " mSearchMode=" + mSearchMode 120 + " mQueryString=" + mQueryString 121 + " mIncludeFavorites=" + mIncludeFavorites 122 + " mLegacyCompatibilityMode=" + mLegacyCompatibilityMode 123 + " mDirectorySearchEnabled=" + mDirectorySearchEnabled 124 + " mContactUri=" + mContactUri 125 + " mAccountWithDataSet=" + mAccountWithDataSet 126 + " mRawContactIds=" + mRawContactIds 127 + "}"; 128 } 129 isValid()130 public boolean isValid() { 131 return mValid; 132 } 133 setValid(boolean flag)134 public void setValid(boolean flag) { 135 mValid = flag; 136 } 137 setActivityTitle(CharSequence title)138 public void setActivityTitle(CharSequence title) { 139 mTitle = title; 140 } 141 getActivityTitle()142 public CharSequence getActivityTitle() { 143 return mTitle; 144 } 145 getActionCode()146 public int getActionCode() { 147 return mActionCode; 148 } 149 setActionCode(int actionCode)150 public void setActionCode(int actionCode) { 151 mActionCode = actionCode; 152 } 153 isSearchMode()154 public boolean isSearchMode() { 155 return mSearchMode; 156 } 157 setSearchMode(boolean flag)158 public void setSearchMode(boolean flag) { 159 mSearchMode = flag; 160 } 161 getQueryString()162 public String getQueryString() { 163 return mQueryString; 164 } 165 setQueryString(String string)166 public void setQueryString(String string) { 167 mQueryString = string; 168 } 169 shouldIncludeFavorites()170 public boolean shouldIncludeFavorites() { 171 return mIncludeFavorites; 172 } 173 setIncludeFavorites(boolean includeFavorites)174 public void setIncludeFavorites(boolean includeFavorites) { 175 mIncludeFavorites = includeFavorites; 176 } 177 isLegacyCompatibilityMode()178 public boolean isLegacyCompatibilityMode() { 179 return mLegacyCompatibilityMode; 180 } 181 setLegacyCompatibilityMode(boolean flag)182 public void setLegacyCompatibilityMode(boolean flag) { 183 mLegacyCompatibilityMode = flag; 184 } 185 186 /** 187 * Determines whether this search request should include directories or 188 * is limited to local contacts only. 189 */ isDirectorySearchEnabled()190 public boolean isDirectorySearchEnabled() { 191 return mDirectorySearchEnabled; 192 } 193 setDirectorySearchEnabled(boolean flag)194 public void setDirectorySearchEnabled(boolean flag) { 195 mDirectorySearchEnabled = flag; 196 } 197 getContactUri()198 public Uri getContactUri() { 199 return mContactUri; 200 } 201 setContactUri(Uri contactUri)202 public void setContactUri(Uri contactUri) { 203 this.mContactUri = contactUri; 204 } 205 getAccountWithDataSet()206 public AccountWithDataSet getAccountWithDataSet() { 207 return mAccountWithDataSet; 208 } 209 setAccountWithDataSet(AccountWithDataSet accountWithDataSet)210 public void setAccountWithDataSet(AccountWithDataSet accountWithDataSet) { 211 mAccountWithDataSet = accountWithDataSet; 212 } 213 getRawContactIds()214 public ArrayList<String> getRawContactIds() { 215 return mRawContactIds; 216 } 217 setRawContactIds(ArrayList<String> rawContactIds)218 public void setRawContactIds(ArrayList<String> rawContactIds) { 219 mRawContactIds = rawContactIds; 220 } 221 } 222