|
@@ -22,6 +22,8 @@ package com.owncloud.android.ui.fragment;
|
|
|
|
|
|
import android.accounts.Account;
|
|
|
import android.app.Activity;
|
|
|
+import android.os.Bundle;
|
|
|
+import android.support.annotation.Nullable;
|
|
|
import android.support.v4.app.Fragment;
|
|
|
|
|
|
import com.owncloud.android.datamodel.OCFile;
|
|
@@ -29,6 +31,8 @@ import com.owncloud.android.files.services.FileDownloader.FileDownloaderBinder;
|
|
|
import com.owncloud.android.files.services.FileUploader.FileUploaderBinder;
|
|
|
import com.owncloud.android.ui.activity.ComponentsGetter;
|
|
|
|
|
|
+import static com.owncloud.android.ui.activity.FileActivity.EXTRA_FILE;
|
|
|
+
|
|
|
|
|
|
/**
|
|
|
* Common methods for {@link Fragment}s containing {@link OCFile}s
|
|
@@ -49,14 +53,28 @@ public class FileFragment extends Fragment {
|
|
|
public FileFragment() {
|
|
|
mFile = null;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onCreate(@Nullable Bundle savedInstanceState) {
|
|
|
+ super.onCreate(savedInstanceState);
|
|
|
+
|
|
|
+ Bundle bundle = getArguments();
|
|
|
+ setFile((OCFile) bundle.getParcelable(EXTRA_FILE));
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* Creates an instance for a given {@OCFile}.
|
|
|
*
|
|
|
* @param file
|
|
|
*/
|
|
|
- public FileFragment(OCFile file) {
|
|
|
- mFile = file;
|
|
|
+ public static FileFragment newInstance(OCFile file) {
|
|
|
+ FileFragment fileFragment = new FileFragment();
|
|
|
+ Bundle bundle = new Bundle();
|
|
|
+
|
|
|
+ bundle.putParcelable(EXTRA_FILE, file);
|
|
|
+ fileFragment.setArguments(bundle);
|
|
|
+
|
|
|
+ return fileFragment;
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -111,7 +129,7 @@ public class FileFragment extends Fragment {
|
|
|
*
|
|
|
* @param file File to show details
|
|
|
*/
|
|
|
- public void showDetails(OCFile file);
|
|
|
+ void showDetails(OCFile file);
|
|
|
|
|
|
|
|
|
///// TO UNIFY IN A SINGLE CALLBACK METHOD - EVENT NOTIFICATIONs -> something happened
|
|
@@ -122,7 +140,7 @@ public class FileFragment extends Fragment {
|
|
|
*
|
|
|
* @param folder
|
|
|
*/
|
|
|
- public void onBrowsedDownTo(OCFile folder);
|
|
|
+ void onBrowsedDownTo(OCFile folder);
|
|
|
|
|
|
/**
|
|
|
* Callback method invoked when a the 'transfer state' of a file changes.
|
|
@@ -141,7 +159,7 @@ public class FileFragment extends Fragment {
|
|
|
* @param downloading Flag signaling if the file is now downloading.
|
|
|
* @param uploading Flag signaling if the file is now uploading.
|
|
|
*/
|
|
|
- public void onTransferStateChanged(OCFile file, boolean downloading, boolean uploading);
|
|
|
+ void onTransferStateChanged(OCFile file, boolean downloading, boolean uploading);
|
|
|
|
|
|
}
|
|
|
|