/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

  1. package com.parleys.android.client.provider;
  2. import android.net.Uri;
  3. import android.provider.BaseColumns;
  4. public class ParleysContract {
  5. interface ParleysBaseColumns {
  6. String CREATED_ON = "created_on";
  7. String MODIFIED_ON = "modified_on";
  8. }
  9. interface NewsColumns {
  10. String NEWS_ID = "news_id";
  11. String TITLE = "title";
  12. String ITEM = "item";
  13. String AUTHOR = "author";
  14. String READ = "read";
  15. }
  16. interface SpacesColumns {
  17. String SPACE_ID = "space_id";
  18. String NAME = "name";
  19. String DESCRIPTION = "description";
  20. String THUMBNAIL_URL = "thumbnail_url";
  21. String PUBLIC = "public";
  22. String VISIBLE_IPAD = "visible_ipad";
  23. String TOTAL_VIEWCOUNT = "total_viewcount";
  24. // TODO streaming server ids
  25. // TODO keywords
  26. // TODO keywords list
  27. }
  28. interface ChannelsColumns {
  29. String CHANNEL_ID = "channel_id";
  30. String NAME = "name";
  31. String DESCRIPTION = "description";
  32. String THUMBNAIL_URL = "thumbnail_url";
  33. String PUBLIC = "public";
  34. String VISIBLE_IPAD = "visible_ipad";
  35. String IPHONE_ENABLED = "iphone_enabled";
  36. String PODCAST_ENABLED = "podcast_enabled";
  37. String TOTAL_VIEWCOUNT = "total_viewcount";
  38. String SUBSCRIBED = "subscribed";
  39. // TODO keywords list
  40. }
  41. interface PresentationsColumns {
  42. String PRESENTATION_ID = "presentation_id";
  43. String TITLE = "title";
  44. String SUMMARY = "summary";
  45. String THUMBNAIL_URL = "thumbnail_url";
  46. String MP3_URL = "mp3_url";
  47. String VISIBLE_IPAD = "visible_ipad";
  48. String IPHONE_ENABLED = "iphone_enabled";
  49. String PODCAST_ENABLED = "podcast_enabled";
  50. String TOTAL_VIEWS = "total_views";
  51. String TOTAL_VOTES = "total_votes";
  52. String TOTAL_VOTEVALUE = "total_votevalue";
  53. String TOTAL_DOWNLOADS = "total_downloads";
  54. String TOTAL_DURATION = "total_duration";
  55. // TODO speakers, keywords, assets, comments, notes
  56. }
  57. public static final String CONTENT_AUTHORITY = "com.parleys.android.client";
  58. private static final Uri BASE_CONTENT_URI = Uri.parse("content://" + CONTENT_AUTHORITY);
  59. private static final String PATH_NEWS = "news";
  60. private static final String PATH_SPACES = "spaces";
  61. private static final String PATH_CHANNELS = "channels";
  62. private static final String PATH_PRESENTATIONS = "presentations";
  63. public static class News implements NewsColumns, ParleysBaseColumns, BaseColumns {
  64. public static final Uri CONTENT_URI = BASE_CONTENT_URI.buildUpon().appendPath(PATH_NEWS).build();
  65. public static final String CONTENT_TYPE = "vnd.android.cursor.dir/vnd.parleys.news";
  66. public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/vnd.parleys.news";
  67. public static final String DEFAULT_SORT = ParleysBaseColumns.CREATED_ON + " DESC";
  68. public static Uri buildNewsUri(int newsId) {
  69. return CONTENT_URI.buildUpon().appendPath(String.valueOf(newsId)).build();
  70. }
  71. public static String getNewsId(Uri uri) {
  72. return uri.getPathSegments().get(1);
  73. }
  74. }
  75. public static class Spaces implements SpacesColumns, ParleysBaseColumns, BaseColumns {
  76. public static final Uri CONTENT_URI = BASE_CONTENT_URI.buildUpon().appendPath(PATH_SPACES).build();
  77. public static final String CONTENT_TYPE = "vnd.android.cursor.dir/vnd.parleys.spaces";
  78. public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/vnd.parleys.spaces";
  79. public static final String DEFAULT_SORT = ParleysBaseColumns.CREATED_ON + " DESC";
  80. public static Uri buildSpaceUri(int spaceId) {
  81. return CONTENT_URI.buildUpon().appendPath(String.valueOf(spaceId)).build();
  82. }
  83. public static Uri buildChannelsDirUri(int spaceId) {
  84. return CONTENT_URI.buildUpon().appendPath(String.valueOf(spaceId)).appendPath(PATH_CHANNELS).build();
  85. }
  86. public static int getSpaceId(Uri uri) {
  87. return Integer.parseInt(uri.getPathSegments().get(1));
  88. }
  89. }
  90. public static class Channels implements ChannelsColumns, ParleysBaseColumns, BaseColumns {
  91. public static final Uri CONTENT_URI = BASE_CONTENT_URI.buildUpon().appendPath(PATH_CHANNELS).build();
  92. public static final String CONTENT_TYPE = "vnd.android.cursor.dir/vnd.parleys.channels";
  93. public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/vnd.parleys.channels";
  94. public static final String DEFAULT_SORT = ParleysBaseColumns.CREATED_ON + " DESC";
  95. public static final String SPACE_ID = "space_id";
  96. public static Uri buildChannelUri(int channelId) {
  97. return CONTENT_URI.buildUpon().appendPath(String.valueOf(channelId)).build();
  98. }
  99. public static Uri buildPresentationsDirUri(int channelId) {
  100. return CONTENT_URI.buildUpon().appendPath(String.valueOf(channelId)).appendPath(PATH_PRESENTATIONS).build();
  101. }
  102. public static int getChannelId(Uri uri) {
  103. return Integer.parseInt(uri.getPathSegments().get(1));
  104. }
  105. }
  106. public static class Presentations implements PresentationsColumns, ParleysBaseColumns, BaseColumns {
  107. public static final Uri CONTENT_URI = BASE_CONTENT_URI.buildUpon().appendPath(PATH_PRESENTATIONS).build();
  108. public static final String CONTENT_TYPE = "vnd.android.cursor.dir/vnd.parleys.presentations";
  109. public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/vnd.parleys.presentations";
  110. public static final String DEFAULT_SORT = ParleysBaseColumns.CREATED_ON + " DESC";
  111. public static final String CHANNEL_ID = "channel_id";
  112. public static Uri buildPresentationUri(int presentationId) {
  113. return CONTENT_URI.buildUpon().appendPath(String.valueOf(presentationId)).build();
  114. }
  115. public static int getPresentationId(Uri uri) {
  116. return Integer.parseInt(uri.getPathSegments().get(1));
  117. }
  118. }
  119. }