SocialContract.java revision 569277732b4180c07c9f917ff8c3fc3111b10338
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 17package android.provider; 18 19import android.provider.ContactsContract.Contacts; 20 21import android.graphics.BitmapFactory; 22import android.net.Uri; 23import android.provider.BaseColumns; 24 25/** 26 * The contract between the social provider and applications. Contains 27 * definitions for the supported URIs and columns. 28 * <p> 29 * TODO: move to android.provider package 30 */ 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 /** 40 * The package name that owns this social activity. 41 * <p> 42 * Type: TEXT 43 */ 44 public static final String PACKAGE = "package"; 45 46 /** 47 * The mime-type of this social activity. 48 * <p> 49 * Type: TEXT 50 */ 51 public static final String MIMETYPE = "mimetype"; 52 53 /** 54 * Internal raw identifier for this social activity. This field is 55 * analogous to the <code>atom:id</code> element defined in RFC 4287. 56 * <p> 57 * Type: TEXT 58 */ 59 public static final String RAW_ID = "raw_id"; 60 61 /** 62 * Reference to another {@link Activities#RAW_ID} that this social activity 63 * is replying to. This field is analogous to the 64 * <code>thr:in-reply-to</code> element defined in RFC 4685. 65 * <p> 66 * Type: TEXT 67 */ 68 public static final String IN_REPLY_TO = "in_reply_to"; 69 70 /** 71 * Reference to the {@link android.provider.ContactsContract.Contacts#_ID} that authored 72 * this social activity. This field is analogous to the <code>atom:author</code> 73 * element defined in RFC 4287. 74 * <p> 75 * Type: INTEGER 76 */ 77 public static final String AUTHOR_CONTACT_ID = "author_contact_id"; 78 79 /** 80 * Optional reference to the {@link android.provider.ContactsContract.Contacts#_ID} this 81 * social activity is targeted towards. If more than one direct target, this field may 82 * be left undefined. This field is analogous to the 83 * <code>activity:target</code> element defined in the Atom Activity 84 * Extensions Internet-Draft. 85 * <p> 86 * Type: INTEGER 87 */ 88 public static final String TARGET_CONTACT_ID = "target_contact_id"; 89 90 /** 91 * Timestamp when this social activity was published, in a 92 * {@link System#currentTimeMillis()} time base. This field is analogous 93 * to the <code>atom:published</code> element defined in RFC 4287. 94 * <p> 95 * Type: INTEGER 96 */ 97 public static final String PUBLISHED = "published"; 98 99 /** 100 * Timestamp when the original social activity in a thread was 101 * published. For activities that have an in-reply-to field specified, the 102 * content provider will automatically populate this field with the 103 * timestamp of the original activity. 104 * <p> 105 * This field is useful for sorting order of activities that keeps together all 106 * messages in each thread. 107 * <p> 108 * Type: INTEGER 109 */ 110 public static final String THREAD_PUBLISHED = "thread_published"; 111 112 /** 113 * Title of this social activity. This field is analogous to the 114 * <code>atom:title</code> element defined in RFC 4287. 115 * <p> 116 * Type: TEXT 117 */ 118 public static final String TITLE = "title"; 119 120 /** 121 * Summary of this social activity. This field is analogous to the 122 * <code>atom:summary</code> element defined in RFC 4287. 123 * <p> 124 * Type: TEXT 125 */ 126 public static final String SUMMARY = "summary"; 127 128 /** 129 * A URI associated this social activity. This field is analogous to the 130 * <code>atom:link rel="alternate"</code> element defined in RFC 4287. 131 * <p> 132 * Type: TEXT 133 */ 134 public static final String LINK = "link"; 135 136 /** 137 * Optional thumbnail specific to this social activity. This is the raw 138 * bytes of an image that could be inflated using {@link BitmapFactory}. 139 * <p> 140 * Type: BLOB 141 */ 142 public static final String THUMBNAIL = "thumbnail"; 143 } 144 145 public static final class Activities implements BaseColumns, ActivitiesColumns { 146 /** 147 * This utility class cannot be instantiated 148 */ 149 private Activities() { 150 } 151 152 /** 153 * The content:// style URI for this table 154 */ 155 public static final Uri CONTENT_URI = Uri.withAppendedPath(AUTHORITY_URI, "activities"); 156 157 /** 158 * The content:// style URI for this table filtered to the set of social activities 159 * authored by a specific {@link android.provider.ContactsContract.Contacts#_ID}. 160 */ 161 public static final Uri CONTENT_AUTHORED_BY_URI = 162 Uri.withAppendedPath(CONTENT_URI, "authored_by"); 163 164 /** 165 * The MIME type of {@link #CONTENT_URI} providing a directory of social 166 * activities. 167 */ 168 public static final String CONTENT_TYPE = "vnd.android.cursor.dir/activity"; 169 170 /** 171 * The MIME type of a {@link #CONTENT_URI} subdirectory of a single 172 * social activity. 173 */ 174 public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/activity"; 175 } 176 177} 178