ContactsRequest.java revision f48efd72289c1725f00550f09167f5cfc05e9bfd
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 17package com.android.contacts.list; 18 19import android.content.Intent; 20import android.net.Uri; 21import android.os.Parcel; 22import android.os.Parcelable; 23 24/** 25 * Parsed form of the intent sent to the Contacts application. 26 */ 27public class ContactsRequest { 28 29 /** Default mode: browse contacts */ 30 public static final int ACTION_DEFAULT = 10; 31 32 /** Show all contacts */ 33 public static final int ACTION_ALL_CONTACTS = 15; 34 35 /** Show all contacts with phone numbers */ 36 public static final int ACTION_CONTACTS_WITH_PHONES = 17; 37 38 /** Show contents of a specific group */ 39 public static final int ACTION_GROUP = 20; 40 41 /** Show all starred contacts */ 42 public static final int ACTION_STARRED = 30; 43 44 /** Show frequently contacted contacts */ 45 public static final int ACTION_FREQUENT = 40; 46 47 /** Show starred and the frequent */ 48 public static final int ACTION_STREQUENT = 50; 49 50 /** Show all contacts and pick them when clicking */ 51 public static final int ACTION_PICK_CONTACT = 60; 52 53 /** Show all contacts as well as the option to create a new one */ 54 public static final int ACTION_PICK_OR_CREATE_CONTACT = 70; 55 56 /** Show all contacts and pick them for edit when clicking, and allow creating a new contact */ 57 public static final int ACTION_INSERT_OR_EDIT_CONTACT = 80; 58 59 /** Show all phone numbers and pick them when clicking */ 60 public static final int ACTION_PICK_PHONE = 90; 61 62 /** Show all postal addresses and pick them when clicking */ 63 public static final int ACTION_PICK_POSTAL = 100; 64 65 /** Show all postal addresses and pick them when clicking */ 66 public static final int ACTION_PICK_EMAIL = 105; 67 68 /** Show all contacts and create a shortcut for the picked contact */ 69 public static final int ACTION_CREATE_SHORTCUT_CONTACT = 110; 70 71 /** Show all phone numbers and create a call shortcut for the picked number */ 72 public static final int ACTION_CREATE_SHORTCUT_CALL = 120; 73 74 /** Show all phone numbers and create an SMS shortcut for the picked number */ 75 public static final int ACTION_CREATE_SHORTCUT_SMS = 130; 76 77 /** Show all contacts and activate the specified one */ 78 public static final int ACTION_VIEW_CONTACT = 140; 79 80 /** Show contacts recommended for joining with a specified target contact */ 81 public static final int ACTION_PICK_JOIN = 150; 82 83 private boolean mValid = true; 84 private int mActionCode = ACTION_DEFAULT; 85 private Intent mRedirectIntent; 86 private CharSequence mTitle; 87 private boolean mSearchMode; 88 private String mQueryString; 89 private boolean mIncludeProfile; 90 private boolean mLegacyCompatibilityMode; 91 private boolean mDirectorySearchEnabled = true; 92 private Uri mContactUri; 93 94 @Override 95 public String toString() { 96 return "{ContactsRequest:mValid=" + mValid 97 + " mActionCode=" + mActionCode 98 + " mRedirectIntent=" + mRedirectIntent 99 + " mTitle=" + mTitle 100 + " mSearchMode=" + mSearchMode 101 + " mQueryString=" + mQueryString 102 + " mIncludeProfile=" + mIncludeProfile 103 + " mLegacyCompatibilityMode=" + mLegacyCompatibilityMode 104 + " mDirectorySearchEnabled=" + mDirectorySearchEnabled 105 + " mContactUri=" + mContactUri 106 + "}"; 107 } 108 109 public boolean isValid() { 110 return mValid; 111 } 112 113 public void setValid(boolean flag) { 114 mValid = flag; 115 } 116 117 public Intent getRedirectIntent() { 118 return mRedirectIntent; 119 } 120 121 public void setRedirectIntent(Intent intent) { 122 mRedirectIntent = intent; 123 } 124 125 public void setActivityTitle(CharSequence title) { 126 mTitle = title; 127 } 128 129 public CharSequence getActivityTitle() { 130 return mTitle; 131 } 132 133 public int getActionCode() { 134 return mActionCode; 135 } 136 137 public void setActionCode(int actionCode) { 138 mActionCode = actionCode; 139 } 140 141 public boolean isSearchMode() { 142 return mSearchMode; 143 } 144 145 public void setSearchMode(boolean flag) { 146 mSearchMode = flag; 147 } 148 149 public String getQueryString() { 150 return mQueryString; 151 } 152 153 public void setQueryString(String string) { 154 mQueryString = string; 155 } 156 157 public boolean shouldIncludeProfile() { 158 return mIncludeProfile; 159 } 160 161 public void setIncludeProfile(boolean includeProfile) { 162 mIncludeProfile = includeProfile; 163 } 164 165 public boolean isLegacyCompatibilityMode() { 166 return mLegacyCompatibilityMode; 167 } 168 169 public void setLegacyCompatibilityMode(boolean flag) { 170 mLegacyCompatibilityMode = flag; 171 } 172 173 /** 174 * Determines whether this search request should include directories or 175 * is limited to local contacts only. 176 */ 177 public boolean isDirectorySearchEnabled() { 178 return mDirectorySearchEnabled; 179 } 180 181 public void setDirectorySearchEnabled(boolean flag) { 182 mDirectorySearchEnabled = flag; 183 } 184 185 public Uri getContactUri() { 186 return mContactUri; 187 } 188 189 public void setContactUri(Uri contactUri) { 190 this.mContactUri = contactUri; 191 } 192} 193