blob: ee271ba84481f8a55277037b88ea8b6207f3cfb2 [file] [log] [blame]
Evan Millar088b2912009-05-28 15:24:37 -07001/*
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
17package android.provider;
18
Jeff Sharkey8a0193e2009-07-20 23:28:23 -070019import android.content.res.Resources;
Evan Millar088b2912009-05-28 15:24:37 -070020import android.graphics.BitmapFactory;
21import android.net.Uri;
Dmitri Plotnikov7cca5f82009-07-27 20:25:59 -070022import android.provider.ContactsContract.Contacts;
Jeff Sharkeyd530b3c2009-06-01 20:23:57 -070023import android.provider.ContactsContract.Data;
Evan Millar088b2912009-05-28 15:24:37 -070024
25/**
26 * The contract between the social provider and applications. Contains
27 * definitions for the supported URIs and columns.
Dmitri Plotnikov5f123bd2009-05-28 18:06:31 -070028 *
29 * @hide
Evan Millar088b2912009-05-28 15:24:37 -070030 */
31public 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 Sharkey8a0193e2009-07-20 23:28:23 -070040 * 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 Millar088b2912009-05-28 15:24:37 -070043 * <p>
44 * Type: TEXT
45 */
Jeff Sharkey8a0193e2009-07-20 23:28:23 -070046 public static final String RES_PACKAGE = "res_package";
Evan Millar088b2912009-05-28 15:24:37 -070047
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 Plotnikov56927772009-05-28 17:23:39 -070073 * 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 Millar088b2912009-05-28 15:24:37 -070075 * 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 Plotnikov56927772009-05-28 17:23:39 -070082 * 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 Millar088b2912009-05-28 15:24:37 -070084 * 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 Sharkeyd530b3c2009-06-01 20:23:57 -0700160 * The content:// URI for this table filtered to the set of social activities
Dmitri Plotnikov56927772009-05-28 17:23:39 -0700161 * authored by a specific {@link android.provider.ContactsContract.Contacts#_ID}.
Evan Millar088b2912009-05-28 15:24:37 -0700162 */
163 public static final Uri CONTENT_AUTHORED_BY_URI =
164 Uri.withAppendedPath(CONTENT_URI, "authored_by");
165
166 /**
Jeff Sharkeyd530b3c2009-06-01 20:23:57 -0700167 * The {@link Uri} for the latest social activity performed by any
Evan Millarac39b262009-07-30 11:46:13 -0700168 * raw contact aggregated under the specified {@link Contacts#_ID}. Will
Jeff Sharkeyd530b3c2009-06-01 20:23:57 -0700169 * also join with most-present {@link Presence} for this aggregate.
170 */
Evan Millarac39b262009-07-30 11:46:13 -0700171 public static final Uri CONTENT_CONTACT_STATUS_URI =
172 Uri.withAppendedPath(AUTHORITY_URI, "contact_status");
Jeff Sharkeyd530b3c2009-06-01 20:23:57 -0700173
174 /**
Evan Millar088b2912009-05-28 15:24:37 -0700175 * 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}