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