Evan Millar | 088b291 | 2009-05-28 15:24:37 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2009 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 android.provider; |
| 18 | |
Jeff Sharkey | 8a0193e | 2009-07-20 23:28:23 -0700 | [diff] [blame] | 19 | import android.content.res.Resources; |
Evan Millar | 088b291 | 2009-05-28 15:24:37 -0700 | [diff] [blame] | 20 | import android.graphics.BitmapFactory; |
| 21 | import android.net.Uri; |
Dmitri Plotnikov | 7cca5f8 | 2009-07-27 20:25:59 -0700 | [diff] [blame] | 22 | import android.provider.ContactsContract.Contacts; |
Jeff Sharkey | d530b3c | 2009-06-01 20:23:57 -0700 | [diff] [blame] | 23 | import android.provider.ContactsContract.Data; |
Evan Millar | 088b291 | 2009-05-28 15:24:37 -0700 | [diff] [blame] | 24 | |
| 25 | /** |
| 26 | * The contract between the social provider and applications. Contains |
| 27 | * definitions for the supported URIs and columns. |
Dmitri Plotnikov | 5f123bd | 2009-05-28 18:06:31 -0700 | [diff] [blame] | 28 | * |
| 29 | * @hide |
Evan Millar | 088b291 | 2009-05-28 15:24:37 -0700 | [diff] [blame] | 30 | */ |
| 31 | public class SocialContract { |
| 32 | /** The authority for the social provider */ |
| 33 | public static final String AUTHORITY = "com.android.social"; |
| 34 | |
| 35 | /** A content:// style uri to the authority for the contacts provider */ |
| 36 | public static final Uri AUTHORITY_URI = Uri.parse("content://" + AUTHORITY); |
| 37 | |
| 38 | private interface ActivitiesColumns { |
| 39 | /** |
Jeff Sharkey | 8a0193e | 2009-07-20 23:28:23 -0700 | [diff] [blame] | 40 | * The package name to use when creating {@link Resources} objects for |
| 41 | * this data row. This value is only designed for use when building user |
| 42 | * interfaces, and should not be used to infer the owner. |
Evan Millar | 088b291 | 2009-05-28 15:24:37 -0700 | [diff] [blame] | 43 | * <p> |
| 44 | * Type: TEXT |
| 45 | */ |
Jeff Sharkey | 8a0193e | 2009-07-20 23:28:23 -0700 | [diff] [blame] | 46 | public static final String RES_PACKAGE = "res_package"; |
Evan Millar | 088b291 | 2009-05-28 15:24:37 -0700 | [diff] [blame] | 47 | |
| 48 | /** |
| 49 | * The mime-type of this social activity. |
| 50 | * <p> |
| 51 | * Type: TEXT |
| 52 | */ |
| 53 | public static final String MIMETYPE = "mimetype"; |
| 54 | |
| 55 | /** |
| 56 | * Internal raw identifier for this social activity. This field is |
| 57 | * analogous to the <code>atom:id</code> element defined in RFC 4287. |
| 58 | * <p> |
| 59 | * Type: TEXT |
| 60 | */ |
| 61 | public static final String RAW_ID = "raw_id"; |
| 62 | |
| 63 | /** |
| 64 | * Reference to another {@link Activities#RAW_ID} that this social activity |
| 65 | * is replying to. This field is analogous to the |
| 66 | * <code>thr:in-reply-to</code> element defined in RFC 4685. |
| 67 | * <p> |
| 68 | * Type: TEXT |
| 69 | */ |
| 70 | public static final String IN_REPLY_TO = "in_reply_to"; |
| 71 | |
| 72 | /** |
Dmitri Plotnikov | 5692777 | 2009-05-28 17:23:39 -0700 | [diff] [blame] | 73 | * Reference to the {@link android.provider.ContactsContract.Contacts#_ID} that authored |
| 74 | * this social activity. This field is analogous to the <code>atom:author</code> |
Evan Millar | 088b291 | 2009-05-28 15:24:37 -0700 | [diff] [blame] | 75 | * element defined in RFC 4287. |
| 76 | * <p> |
| 77 | * Type: INTEGER |
| 78 | */ |
| 79 | public static final String AUTHOR_CONTACT_ID = "author_contact_id"; |
| 80 | |
| 81 | /** |
Dmitri Plotnikov | 5692777 | 2009-05-28 17:23:39 -0700 | [diff] [blame] | 82 | * Optional reference to the {@link android.provider.ContactsContract.Contacts#_ID} this |
| 83 | * social activity is targeted towards. If more than one direct target, this field may |
Evan Millar | 088b291 | 2009-05-28 15:24:37 -0700 | [diff] [blame] | 84 | * be left undefined. This field is analogous to the |
| 85 | * <code>activity:target</code> element defined in the Atom Activity |
| 86 | * Extensions Internet-Draft. |
| 87 | * <p> |
| 88 | * Type: INTEGER |
| 89 | */ |
| 90 | public static final String TARGET_CONTACT_ID = "target_contact_id"; |
| 91 | |
| 92 | /** |
| 93 | * Timestamp when this social activity was published, in a |
| 94 | * {@link System#currentTimeMillis()} time base. This field is analogous |
| 95 | * to the <code>atom:published</code> element defined in RFC 4287. |
| 96 | * <p> |
| 97 | * Type: INTEGER |
| 98 | */ |
| 99 | public static final String PUBLISHED = "published"; |
| 100 | |
| 101 | /** |
| 102 | * Timestamp when the original social activity in a thread was |
| 103 | * published. For activities that have an in-reply-to field specified, the |
| 104 | * content provider will automatically populate this field with the |
| 105 | * timestamp of the original activity. |
| 106 | * <p> |
| 107 | * This field is useful for sorting order of activities that keeps together all |
| 108 | * messages in each thread. |
| 109 | * <p> |
| 110 | * Type: INTEGER |
| 111 | */ |
| 112 | public static final String THREAD_PUBLISHED = "thread_published"; |
| 113 | |
| 114 | /** |
| 115 | * Title of this social activity. This field is analogous to the |
| 116 | * <code>atom:title</code> element defined in RFC 4287. |
| 117 | * <p> |
| 118 | * Type: TEXT |
| 119 | */ |
| 120 | public static final String TITLE = "title"; |
| 121 | |
| 122 | /** |
| 123 | * Summary of this social activity. This field is analogous to the |
| 124 | * <code>atom:summary</code> element defined in RFC 4287. |
| 125 | * <p> |
| 126 | * Type: TEXT |
| 127 | */ |
| 128 | public static final String SUMMARY = "summary"; |
| 129 | |
| 130 | /** |
| 131 | * A URI associated this social activity. This field is analogous to the |
| 132 | * <code>atom:link rel="alternate"</code> element defined in RFC 4287. |
| 133 | * <p> |
| 134 | * Type: TEXT |
| 135 | */ |
| 136 | public static final String LINK = "link"; |
| 137 | |
| 138 | /** |
| 139 | * Optional thumbnail specific to this social activity. This is the raw |
| 140 | * bytes of an image that could be inflated using {@link BitmapFactory}. |
| 141 | * <p> |
| 142 | * Type: BLOB |
| 143 | */ |
| 144 | public static final String THUMBNAIL = "thumbnail"; |
| 145 | } |
| 146 | |
| 147 | public static final class Activities implements BaseColumns, ActivitiesColumns { |
| 148 | /** |
| 149 | * This utility class cannot be instantiated |
| 150 | */ |
| 151 | private Activities() { |
| 152 | } |
| 153 | |
| 154 | /** |
| 155 | * The content:// style URI for this table |
| 156 | */ |
| 157 | public static final Uri CONTENT_URI = Uri.withAppendedPath(AUTHORITY_URI, "activities"); |
| 158 | |
| 159 | /** |
Jeff Sharkey | d530b3c | 2009-06-01 20:23:57 -0700 | [diff] [blame] | 160 | * The content:// URI for this table filtered to the set of social activities |
Dmitri Plotnikov | 5692777 | 2009-05-28 17:23:39 -0700 | [diff] [blame] | 161 | * authored by a specific {@link android.provider.ContactsContract.Contacts#_ID}. |
Evan Millar | 088b291 | 2009-05-28 15:24:37 -0700 | [diff] [blame] | 162 | */ |
| 163 | public static final Uri CONTENT_AUTHORED_BY_URI = |
| 164 | Uri.withAppendedPath(CONTENT_URI, "authored_by"); |
| 165 | |
| 166 | /** |
Jeff Sharkey | d530b3c | 2009-06-01 20:23:57 -0700 | [diff] [blame] | 167 | * The {@link Uri} for the latest social activity performed by any |
Evan Millar | ac39b26 | 2009-07-30 11:46:13 -0700 | [diff] [blame] | 168 | * raw contact aggregated under the specified {@link Contacts#_ID}. Will |
Jeff Sharkey | d530b3c | 2009-06-01 20:23:57 -0700 | [diff] [blame] | 169 | * also join with most-present {@link Presence} for this aggregate. |
| 170 | */ |
Evan Millar | ac39b26 | 2009-07-30 11:46:13 -0700 | [diff] [blame] | 171 | public static final Uri CONTENT_CONTACT_STATUS_URI = |
| 172 | Uri.withAppendedPath(AUTHORITY_URI, "contact_status"); |
Jeff Sharkey | d530b3c | 2009-06-01 20:23:57 -0700 | [diff] [blame] | 173 | |
| 174 | /** |
Evan Millar | 088b291 | 2009-05-28 15:24:37 -0700 | [diff] [blame] | 175 | * The MIME type of {@link #CONTENT_URI} providing a directory of social |
| 176 | * activities. |
| 177 | */ |
| 178 | public static final String CONTENT_TYPE = "vnd.android.cursor.dir/activity"; |
| 179 | |
| 180 | /** |
| 181 | * The MIME type of a {@link #CONTENT_URI} subdirectory of a single |
| 182 | * social activity. |
| 183 | */ |
| 184 | public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/activity"; |
| 185 | } |
| 186 | |
| 187 | } |