/parleys-android-client/src/main/java/com/parleys/android/client/provider/ParleysContract.java
http://parleys-android-nextgen.googlecode.com/ · Java · 162 lines · 114 code · 43 blank · 5 comment · 0 complexity · ec5332b3427175551b4dcac5d559441c MD5 · raw file
- package com.parleys.android.client.provider;
- import android.net.Uri;
- import android.provider.BaseColumns;
- public class ParleysContract {
-
- interface ParleysBaseColumns {
- String CREATED_ON = "created_on";
- String MODIFIED_ON = "modified_on";
- }
- interface NewsColumns {
- String NEWS_ID = "news_id";
- String TITLE = "title";
- String ITEM = "item";
- String AUTHOR = "author";
- String READ = "read";
- }
-
- interface SpacesColumns {
- String SPACE_ID = "space_id";
- String NAME = "name";
- String DESCRIPTION = "description";
- String THUMBNAIL_URL = "thumbnail_url";
- String PUBLIC = "public";
- String VISIBLE_IPAD = "visible_ipad";
- String TOTAL_VIEWCOUNT = "total_viewcount";
- // TODO streaming server ids
- // TODO keywords
- // TODO keywords list
- }
-
- interface ChannelsColumns {
- String CHANNEL_ID = "channel_id";
- String NAME = "name";
- String DESCRIPTION = "description";
- String THUMBNAIL_URL = "thumbnail_url";
- String PUBLIC = "public";
- String VISIBLE_IPAD = "visible_ipad";
- String IPHONE_ENABLED = "iphone_enabled";
- String PODCAST_ENABLED = "podcast_enabled";
- String TOTAL_VIEWCOUNT = "total_viewcount";
- String SUBSCRIBED = "subscribed";
- // TODO keywords list
- }
-
- interface PresentationsColumns {
- String PRESENTATION_ID = "presentation_id";
- String TITLE = "title";
- String SUMMARY = "summary";
- String THUMBNAIL_URL = "thumbnail_url";
- String MP3_URL = "mp3_url";
- String VISIBLE_IPAD = "visible_ipad";
- String IPHONE_ENABLED = "iphone_enabled";
- String PODCAST_ENABLED = "podcast_enabled";
- String TOTAL_VIEWS = "total_views";
- String TOTAL_VOTES = "total_votes";
- String TOTAL_VOTEVALUE = "total_votevalue";
- String TOTAL_DOWNLOADS = "total_downloads";
- String TOTAL_DURATION = "total_duration";
- // TODO speakers, keywords, assets, comments, notes
- }
- public static final String CONTENT_AUTHORITY = "com.parleys.android.client";
- private static final Uri BASE_CONTENT_URI = Uri.parse("content://" + CONTENT_AUTHORITY);
-
- private static final String PATH_NEWS = "news";
- private static final String PATH_SPACES = "spaces";
- private static final String PATH_CHANNELS = "channels";
- private static final String PATH_PRESENTATIONS = "presentations";
- public static class News implements NewsColumns, ParleysBaseColumns, BaseColumns {
-
- public static final Uri CONTENT_URI = BASE_CONTENT_URI.buildUpon().appendPath(PATH_NEWS).build();
- public static final String CONTENT_TYPE = "vnd.android.cursor.dir/vnd.parleys.news";
- public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/vnd.parleys.news";
- public static final String DEFAULT_SORT = ParleysBaseColumns.CREATED_ON + " DESC";
- public static Uri buildNewsUri(int newsId) {
- return CONTENT_URI.buildUpon().appendPath(String.valueOf(newsId)).build();
- }
-
- public static String getNewsId(Uri uri) {
- return uri.getPathSegments().get(1);
- }
- }
- public static class Spaces implements SpacesColumns, ParleysBaseColumns, BaseColumns {
-
- public static final Uri CONTENT_URI = BASE_CONTENT_URI.buildUpon().appendPath(PATH_SPACES).build();
- public static final String CONTENT_TYPE = "vnd.android.cursor.dir/vnd.parleys.spaces";
- public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/vnd.parleys.spaces";
- public static final String DEFAULT_SORT = ParleysBaseColumns.CREATED_ON + " DESC";
- public static Uri buildSpaceUri(int spaceId) {
- return CONTENT_URI.buildUpon().appendPath(String.valueOf(spaceId)).build();
- }
-
- public static Uri buildChannelsDirUri(int spaceId) {
- return CONTENT_URI.buildUpon().appendPath(String.valueOf(spaceId)).appendPath(PATH_CHANNELS).build();
- }
- public static int getSpaceId(Uri uri) {
- return Integer.parseInt(uri.getPathSegments().get(1));
- }
- }
- public static class Channels implements ChannelsColumns, ParleysBaseColumns, BaseColumns {
-
- public static final Uri CONTENT_URI = BASE_CONTENT_URI.buildUpon().appendPath(PATH_CHANNELS).build();
- public static final String CONTENT_TYPE = "vnd.android.cursor.dir/vnd.parleys.channels";
- public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/vnd.parleys.channels";
- public static final String DEFAULT_SORT = ParleysBaseColumns.CREATED_ON + " DESC";
-
- public static final String SPACE_ID = "space_id";
- public static Uri buildChannelUri(int channelId) {
- return CONTENT_URI.buildUpon().appendPath(String.valueOf(channelId)).build();
- }
-
- public static Uri buildPresentationsDirUri(int channelId) {
- return CONTENT_URI.buildUpon().appendPath(String.valueOf(channelId)).appendPath(PATH_PRESENTATIONS).build();
- }
- public static int getChannelId(Uri uri) {
- return Integer.parseInt(uri.getPathSegments().get(1));
- }
- }
- public static class Presentations implements PresentationsColumns, ParleysBaseColumns, BaseColumns {
-
- public static final Uri CONTENT_URI = BASE_CONTENT_URI.buildUpon().appendPath(PATH_PRESENTATIONS).build();
- public static final String CONTENT_TYPE = "vnd.android.cursor.dir/vnd.parleys.presentations";
- public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/vnd.parleys.presentations";
- public static final String DEFAULT_SORT = ParleysBaseColumns.CREATED_ON + " DESC";
-
- public static final String CHANNEL_ID = "channel_id";
- public static Uri buildPresentationUri(int presentationId) {
- return CONTENT_URI.buildUpon().appendPath(String.valueOf(presentationId)).build();
- }
-
- public static int getPresentationId(Uri uri) {
- return Integer.parseInt(uri.getPathSegments().get(1));
- }
- }
- }