import java.io.File;
import android.accounts.Account;
+import android.accounts.AccountManager;
import android.app.AlertDialog;
import android.app.Dialog;
import android.app.ProgressDialog;
import com.owncloud.android.files.services.FileDownloader.FileDownloaderBinder;
import com.owncloud.android.files.services.FileUploader.FileUploaderBinder;
import com.owncloud.android.operations.CreateFolderOperation;
+
+import com.owncloud.android.operations.GetSharedFilesOperation;
+
+import com.owncloud.android.lib.accounts.OwnCloudAccount;
import com.owncloud.android.lib.operations.common.OnRemoteOperationListener;
import com.owncloud.android.lib.operations.common.RemoteOperation;
import com.owncloud.android.lib.operations.common.RemoteOperationResult;
import com.owncloud.android.lib.operations.common.RemoteOperationResult.ResultCode;
+
import com.owncloud.android.operations.RemoveFileOperation;
import com.owncloud.android.operations.RenameFileOperation;
import com.owncloud.android.operations.SynchronizeFileOperation;
protected void onAccountSet(boolean stateWasRecovered) {
if (getAccount() != null) {
mStorageManager = new FileDataStorageManager(getAccount(), getContentResolver());
-
+
/// Check whether the 'main' OCFile handled by the Activity is contained in the current Account
OCFile file = getFile();
// get parent from path
}
setFile(file);
setNavigationListWithFolder(file);
+
if (!stateWasRecovered) {
Log_OC.e(TAG, "Initializing Fragments in onAccountChanged..");
initFragmentsWithFile();
&& mStorageManager != null
) {
+ /// get the shared files
+ if (isSharedSupported()) {
+ startGetSharedFiles();
+ }
+
String synchFolderRemotePath = intent.getStringExtra(FileSyncService.SYNC_FOLDER_REMOTE_PATH);
OCFile currentFile = (getFile() == null) ? null : mStorageManager.getFileByPath(getFile().getRemotePath());
} else if (operation instanceof CreateFolderOperation) {
onCreateFolderOperationFinish((CreateFolderOperation)operation, result);
- }
+ } else if (operation instanceof GetSharedFilesOperation) {
+ onGetSharedFilesOperationFinish((GetSharedFilesOperation) operation, result);
+ }
}
+ /** Updates the data about shared files
+ *
+ * @param operation Get Shared Files
+ * @param result Result of the operation
+ */
+ private void onGetSharedFilesOperationFinish(GetSharedFilesOperation operation, RemoteOperationResult result) {
+ // TODO
+ // Refresh the filelist with the information
+ refeshListOfFilesFragment();
+
+ }
+
/**
* Updates the view associated to the activity after the finish of an operation trying to remove a
* file.
}
+ private void startGetSharedFiles() {
+ // Get shared files/folders
+ AccountManager accountMngr = AccountManager.get(this);
+ String urlServer = accountMngr.getUserData(getAccount(), OwnCloudAccount.Constants.KEY_OC_BASE_URL);
+
+ RemoteOperation getSharedFiles = new GetSharedFilesOperation(urlServer, mStorageManager);
+ getSharedFiles.execute(getAccount(), this, this, mHandler, this);
+
+ }
+
// public void enableDisableViewGroup(ViewGroup viewGroup, boolean enabled) {
// int childCount = viewGroup.getChildCount();
// for (int i = 0; i < childCount; i++) {