added "x folders and y files" to end of list
[pub/Android/ownCloud.git] / src / com / owncloud / android / ui / fragment / FileFragment.java
1 /* ownCloud Android client application
2 * Copyright (C) 2012-2013 ownCloud Inc.
3 *
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2,
6 * as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 */
17
18 package com.owncloud.android.ui.fragment;
19
20 import android.support.v4.app.Fragment;
21
22 import com.actionbarsherlock.app.SherlockFragment;
23 import com.owncloud.android.datamodel.OCFile;
24 import com.owncloud.android.files.FileHandler;
25 import com.owncloud.android.ui.activity.TransferServiceGetter;
26
27
28 /**
29 * Common methods for {@link Fragment}s containing {@link OCFile}s
30 *
31 * @author David A. Velasco
32 *
33 */
34 public class FileFragment extends SherlockFragment {
35
36 private OCFile mFile;
37
38
39 /**
40 * Creates an empty fragment.
41 *
42 * It's necessary to keep a public constructor without parameters; the system uses it when tries to reinstantiate a fragment automatically.
43 */
44 public FileFragment() {
45 mFile = null;
46 }
47
48 /**
49 * Creates an instance for a given {@OCFile}.
50 *
51 * @param file
52 */
53 public FileFragment(OCFile file) {
54 mFile = file;
55 }
56
57 /**
58 * Getter for the hold {@link OCFile}
59 *
60 * @return The {@link OCFile} hold
61 */
62 public OCFile getFile() {
63 return mFile;
64 }
65
66
67 protected void setFile(OCFile file) {
68 mFile = file;
69 }
70
71 /**
72 * Interface to implement by any Activity that includes some instance of FileFragment
73 *
74 * @author David A. Velasco
75 */
76 public interface ContainerActivity extends TransferServiceGetter, FileHandler {
77
78 /**
79 * Callback method invoked when the detail fragment wants to notice its container
80 * activity about a relevant state the file shown by the fragment.
81 *
82 * Added to notify to FileDisplayActivity about the need of refresh the files list.
83 *
84 * Currently called when:
85 * - a download is started;
86 * - a rename is completed;
87 * - a deletion is completed;
88 * - the 'inSync' flag is changed;
89 */
90 public void onFileStateChanged();
91
92 /**
93 * Request the parent activity to show the details of an {@link OCFile}.
94 *
95 * @param file File to show details
96 */
97 public void showDetails(OCFile file);
98
99
100 }
101
102 }