Home | History | Annotate | Download | only in provider
      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 
     19 import android.content.res.Resources;
     20 import android.graphics.BitmapFactory;
     21 import android.net.Uri;
     22 import android.provider.ContactsContract.Contacts;
     23 import android.provider.ContactsContract.Data;
     24 
     25 /**
     26  * The contract between the social provider and applications. Contains
     27  * definitions for the supported URIs and columns.
     28  *
     29  * @hide
     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         /**
     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.
     43          * <p>
     44          * Type: TEXT
     45          */
     46         public static final String RES_PACKAGE = "res_package";
     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         /**
     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>
     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         /**
     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
     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         /**
    160          * The content:// URI for this table filtered to the set of social activities
    161          * authored by a specific {@link android.provider.ContactsContract.Contacts#_ID}.
    162          */
    163         public static final Uri CONTENT_AUTHORED_BY_URI =
    164             Uri.withAppendedPath(CONTENT_URI, "authored_by");
    165 
    166         /**
    167          * The {@link Uri} for the latest social activity performed by any
    168          * raw contact aggregated under the specified {@link Contacts#_ID}. Will
    169          * also join with most-present {@link Presence} for this aggregate.
    170          */
    171         public static final Uri CONTENT_CONTACT_STATUS_URI =
    172             Uri.withAppendedPath(AUTHORITY_URI, "contact_status");
    173 
    174         /**
    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 }
    188