1 /* 2 * Copyright (C) 2011 Google Inc. 3 * Licensed to The Android Open Source Project. 4 * 5 * Licensed under the Apache License, Version 2.0 (the "License"); 6 * you may not use this file except in compliance with the License. 7 * You may obtain a copy of the License at 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 * See the License for the specific language governing permissions and 15 * limitations under the License. 16 */ 17 18 package com.android.ex.photo.provider; 19 20 import android.net.Uri; 21 import android.provider.OpenableColumns; 22 23 public final class PhotoContract { 24 /** Columns for the view */ 25 public static interface PhotoViewColumns { 26 /** 27 * This column is a {@link Uri} that can be queried 28 * for this individual image (resulting cursor has one single row for this image). 29 */ 30 public static final String URI = "uri"; 31 /** 32 * This column is a {@link String} that can be queried for this 33 * individual image to return a displayable name. 34 */ 35 public static final String NAME = OpenableColumns.DISPLAY_NAME; 36 /** 37 * This column is a {@link Uri} that points to the downloaded local file. 38 * Can be null. 39 */ 40 public static final String CONTENT_URI = "contentUri"; 41 /** 42 * This column is a {@link Uri} that points to a thumbnail of the image 43 * that ideally is a local file. 44 * Can be null. 45 */ 46 public static final String THUMBNAIL_URI = "thumbnailUri"; 47 /** 48 * This string column is the MIME type. 49 */ 50 public static final String CONTENT_TYPE = "contentType"; 51 /** 52 * This boolean column indicates that a loading indicator should display permanently 53 * if no image urls are provided. 54 */ 55 public static final String LOADING_INDICATOR = "loadingIndicator"; 56 } 57 58 public static interface PhotoQuery { 59 /** Projection of the returned cursor */ 60 public final static String[] PROJECTION = { 61 PhotoViewColumns.URI, 62 PhotoViewColumns.NAME, 63 PhotoViewColumns.CONTENT_URI, 64 PhotoViewColumns.THUMBNAIL_URI, 65 PhotoViewColumns.CONTENT_TYPE 66 }; 67 68 public final static String[] OPTIONAL_COLUMNS = { 69 PhotoViewColumns.LOADING_INDICATOR 70 }; 71 } 72 73 public static final class ContentTypeParameters { 74 /** 75 * Parameter used to specify which type of content to return. 76 * Allows multiple types to be specified. 77 */ 78 public static final String CONTENT_TYPE = "contentType"; 79 ContentTypeParameters()80 private ContentTypeParameters() {} 81 } 82 } 83