1 /* 2 * Copyright (C) 2013 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 com.android.camera.data; 18 19 import android.content.ContentResolver; 20 import android.content.Context; 21 import android.net.Uri; 22 23 import static com.android.camera.ui.FilmStripView.DataAdapter; 24 25 /** 26 * An interface which extends {@link DataAdapter} and defines operations on 27 * the data in the local camera folder. 28 */ 29 public interface LocalDataAdapter extends DataAdapter { 30 31 /** 32 * Request for loading the local data. 33 * 34 * @param resolver {@link ContentResolver} used for data loading. 35 */ 36 public void requestLoad(ContentResolver resolver); 37 38 /** 39 * Returns the specified {@link LocalData}. 40 * 41 * @param dataID The ID of the {@link LocalData} to get. 42 * @return The {@link LocalData} to get. {@code null} if not available. 43 */ 44 public LocalData getLocalData(int dataID); 45 46 /** 47 * Remove the data in the local camera folder. 48 * 49 * @param context {@link Context} used to remove the data. 50 * @param dataID ID of data to be deleted. 51 */ 52 public void removeData(Context context, int dataID); 53 54 /** 55 * Add new local video data. 56 * 57 * @param resolver {@link ContentResolver} used to add the data. 58 * @param uri {@link Uri} of the video. 59 */ 60 public void addNewVideo(ContentResolver resolver, Uri uri); 61 62 /** 63 * Adds new local photo data. 64 * 65 * @param resolver {@link ContentResolver} used to add the data. 66 * @param uri {@link Uri} of the photo. 67 */ 68 public void addNewPhoto(ContentResolver resolver, Uri uri); 69 70 /** 71 * Refresh the data by {@link Uri}. 72 * 73 * @param resolver {@link ContentResolver} used to refresh the data. 74 * @param uri The {@link Uri} of the data to refresh. 75 */ 76 public void refresh(ContentResolver resolver, Uri uri); 77 78 /** 79 * Finds the {@link LocalData} of the specified content Uri. 80 * 81 * @param Uri The content Uri of the {@link LocalData}. 82 * @return The index of the data. {@code -1} if not found. 83 */ 84 public int findDataByContentUri(Uri uri); 85 86 /** 87 * Clears all the data currently loaded. 88 */ 89 public void flush(); 90 91 /** 92 * Executes the deletion task. Delete the data waiting in the deletion queue. 93 * 94 * @param context The {@link Context} from the caller. 95 * @return {@code true} if task has been executed, {@code false} 96 * otherwise. 97 */ 98 public boolean executeDeletion(Context context); 99 100 /** 101 * Undo a deletion. If there is any data waiting to be deleted in the queue, 102 * move it out of the deletion queue. 103 * 104 * @return {@code true} if there are items in the queue, {@code false} otherwise. 105 */ 106 public boolean undoDataRemoval(); 107 108 /** 109 * Update the data in a specific position. 110 * 111 * @param pos The position of the data to be updated. 112 * @param data The new data. 113 */ 114 public void updateData(int pos, LocalData data); 115 116 /** Insert a data. */ 117 public void insertData(LocalData data); 118 } 119