From: David A. Velasco Date: Thu, 8 Nov 2012 16:21:45 +0000 (+0100) Subject: Fixed update of right fragment when actions in the context menu of the left fragment... X-Git-Tag: oc-android-1.4.3~88^2~9 X-Git-Url: http://git.linex4red.de/pub/Android/ownCloud.git/commitdiff_plain/85e9a40dbeb521029a592a3d85e9fa583cce0c19?ds=inline;hp=-c Fixed update of right fragment when actions in the context menu of the left fragment are completed, in large-landscape devices --- 85e9a40dbeb521029a592a3d85e9fa583cce0c19 diff --git a/src/com/owncloud/android/datamodel/OCFile.java b/src/com/owncloud/android/datamodel/OCFile.java index d2d64784..21b8c375 100644 --- a/src/com/owncloud/android/datamodel/OCFile.java +++ b/src/com/owncloud/android/datamodel/OCFile.java @@ -22,6 +22,7 @@ import java.io.File; import android.os.Parcel; import android.os.Parcelable; +import android.util.Log; public class OCFile implements Parcelable, Comparable { @@ -38,6 +39,8 @@ public class OCFile implements Parcelable, Comparable { }; public static final String PATH_SEPARATOR = "/"; + + private static final String TAG = OCFile.class.getSimpleName(); private long mId; private long mParentId; @@ -221,11 +224,15 @@ public class OCFile implements Parcelable, Comparable { * Does nothing if the new name is null, empty or includes "/" ; or if the file is the root directory */ public void setFileName(String name) { + Log.d(TAG, "OCFile name changin from " + mRemotePath); if (name != null && name.length() > 0 && !name.contains(PATH_SEPARATOR) && !mRemotePath.equals(PATH_SEPARATOR)) { - mRemotePath = (new File(getRemotePath())).getParent() + name; + String parent = (new File(getRemotePath())).getParent(); + parent = (parent.endsWith(PATH_SEPARATOR)) ? parent : parent + PATH_SEPARATOR; + mRemotePath = parent + name; if (isDirectory()) { mRemotePath += PATH_SEPARATOR; } + Log.d(TAG, "OCFile name changed to " + mRemotePath); } } diff --git a/src/com/owncloud/android/files/services/FileUploader.java b/src/com/owncloud/android/files/services/FileUploader.java index b466d596..aef15db2 100644 --- a/src/com/owncloud/android/files/services/FileUploader.java +++ b/src/com/owncloud/android/files/services/FileUploader.java @@ -434,7 +434,7 @@ public class FileUploader extends Service implements OnDatatransferProgressListe // parent dir String parentPath = new File(remotePath).getParent(); - parentPath = parentPath.endsWith("/")?parentPath:parentPath+"/" ; + parentPath = parentPath.endsWith(OCFile.PATH_SEPARATOR) ? parentPath : parentPath + OCFile.PATH_SEPARATOR ; OCFile parentDir = storageManager.getFileByPath(parentPath); if (parentDir == null) { throw new IllegalStateException("Can not upload a file to a non existing remote location: " + parentPath); diff --git a/src/com/owncloud/android/operations/RemoveFileOperation.java b/src/com/owncloud/android/operations/RemoveFileOperation.java index 69d0a6c3..d8809a69 100644 --- a/src/com/owncloud/android/operations/RemoveFileOperation.java +++ b/src/com/owncloud/android/operations/RemoveFileOperation.java @@ -60,6 +60,16 @@ public class RemoveFileOperation extends RemoteOperation { /** + * Getter for the file to remove (or removed, if the operation was successfully performed). + * + * @return File to remove or already removed. + */ + public OCFile getFile() { + return mFileToRemove; + } + + + /** * Performs the remove operation * * @param client Client object to communicate with the remote ownCloud server. diff --git a/src/com/owncloud/android/operations/RenameFileOperation.java b/src/com/owncloud/android/operations/RenameFileOperation.java index fe7ad796..fd97c581 100644 --- a/src/com/owncloud/android/operations/RenameFileOperation.java +++ b/src/com/owncloud/android/operations/RenameFileOperation.java @@ -86,7 +86,9 @@ public class RenameFileOperation extends RemoteOperation { return new RemoteOperationResult(ResultCode.OK); } - newRemotePath = (new File(mFile.getRemotePath())).getParent() + mNewName; + String parent = (new File(mFile.getRemotePath())).getParent(); + parent = (parent.endsWith(OCFile.PATH_SEPARATOR)) ? parent : parent + OCFile.PATH_SEPARATOR; + newRemotePath = parent + mNewName; // check if the new name is valid in the local file system if (!isValidNewName()) { diff --git a/src/com/owncloud/android/ui/activity/FileDetailActivity.java b/src/com/owncloud/android/ui/activity/FileDetailActivity.java index de9faf8b..ee23ca3d 100644 --- a/src/com/owncloud/android/ui/activity/FileDetailActivity.java +++ b/src/com/owncloud/android/ui/activity/FileDetailActivity.java @@ -114,7 +114,7 @@ public class FileDetailActivity extends SherlockFragmentActivity implements File } FileDetailFragment fragment = (FileDetailFragment) getSupportFragmentManager().findFragmentByTag(FileDetailFragment.FTAG); if (fragment != null) - fragment.updateFileDetails(); // let the fragment gets the mDownloadBinder through getDownloadBinder() (see FileDetailFragment#updateFileDetais()) + fragment.updateFileDetails(false); // let the fragment gets the mDownloadBinder through getDownloadBinder() (see FileDetailFragment#updateFileDetais()) } @Override @@ -168,7 +168,7 @@ public class FileDetailActivity extends SherlockFragmentActivity implements File super.onResume(); if (!mConfigurationChangedToLandscape) { FileDetailFragment fragment = (FileDetailFragment) getSupportFragmentManager().findFragmentByTag(FileDetailFragment.FTAG); - fragment.updateFileDetails(); + fragment.updateFileDetails(false); } } diff --git a/src/com/owncloud/android/ui/activity/FileDisplayActivity.java b/src/com/owncloud/android/ui/activity/FileDisplayActivity.java index 358ae9eb..ffbbb887 100644 --- a/src/com/owncloud/android/ui/activity/FileDisplayActivity.java +++ b/src/com/owncloud/android/ui/activity/FileDisplayActivity.java @@ -72,7 +72,12 @@ import com.owncloud.android.files.services.FileObserverService; import com.owncloud.android.files.services.FileUploader; import com.owncloud.android.files.services.FileUploader.FileUploaderBinder; import com.owncloud.android.network.OwnCloudClientUtils; +import com.owncloud.android.operations.OnRemoteOperationListener; +import com.owncloud.android.operations.RemoteOperation; import com.owncloud.android.operations.RemoteOperationResult; +import com.owncloud.android.operations.RemoveFileOperation; +import com.owncloud.android.operations.RenameFileOperation; +import com.owncloud.android.operations.RemoteOperationResult.ResultCode; import com.owncloud.android.syncadapter.FileSyncService; import com.owncloud.android.ui.dialog.SslValidatorDialog; import com.owncloud.android.ui.dialog.SslValidatorDialog.OnSslValidatorListener; @@ -90,7 +95,7 @@ import eu.alefzero.webdav.WebdavClient; */ public class FileDisplayActivity extends SherlockFragmentActivity implements - OCFileListFragment.ContainerActivity, FileDetailFragment.ContainerActivity, OnNavigationListener, OnSslValidatorListener { + OCFileListFragment.ContainerActivity, FileDetailFragment.ContainerActivity, OnNavigationListener, OnSslValidatorListener, OnRemoteOperationListener { private ArrayAdapter mDirectories; private OCFile mCurrentDir = null; @@ -1024,7 +1029,7 @@ public class FileDisplayActivity extends SherlockFragmentActivity implements if (mDualPane) { FileDetailFragment fragment = (FileDetailFragment) getSupportFragmentManager().findFragmentByTag(FileDetailFragment.FTAG); if (fragment != null) - fragment.updateFileDetails(); + fragment.updateFileDetails(false); } } @@ -1069,4 +1074,119 @@ public class FileDisplayActivity extends SherlockFragmentActivity implements } + /** + * Updates the view associated to the activity after the finish of some operation over files + * in the current account. + * + * @param operation Removal operation performed. + * @param result Result of the removal. + */ + @Override + public void onRemoteOperationFinish(RemoteOperation operation, RemoteOperationResult result) { + if (operation instanceof RemoveFileOperation) { + onRemoveFileOperationFinish((RemoveFileOperation)operation, result); + + } else if (operation instanceof RenameFileOperation) { + onRenameFileOperationFinish((RenameFileOperation)operation, result); + } + } + + /** + * Updates the view associated to the activity after the finish of an operation trying to remove a + * file. + * + * @param operation Removal operation performed. + * @param result Result of the removal. + */ + private void onRemoveFileOperationFinish(RemoveFileOperation operation, RemoteOperationResult result) { + dismissDialog(DIALOG_SHORT_WAIT); + if (result.isSuccess()) { + Toast msg = Toast.makeText(this, R.string.remove_success_msg, Toast.LENGTH_LONG); + msg.show(); + OCFile removedFile = operation.getFile(); + if (mDualPane) { + FileDetailFragment details = (FileDetailFragment) getSupportFragmentManager().findFragmentByTag(FileDetailFragment.FTAG); + if (details != null && removedFile.equals(details.getDisplayedFile()) ) { + FragmentTransaction transaction = getSupportFragmentManager().beginTransaction(); + transaction.replace(R.id.file_details_container, new FileDetailFragment(null, null)); // empty FileDetailFragment + transaction.commit(); + } + } + if (mStorageManager.getFileById(removedFile.getParentId()).equals(mCurrentDir)) { + mFileList.listDirectory(); + } + + } else { + Toast msg = Toast.makeText(this, R.string.remove_fail_msg, Toast.LENGTH_LONG); + msg.show(); + if (result.isSslRecoverableException()) { + mLastSslUntrustedServerResult = result; + showDialog(DIALOG_SSL_VALIDATOR); + } + } + } + + /** + * Updates the view associated to the activity after the finish of an operation trying to rename a + * file. + * + * @param operation Renaming operation performed. + * @param result Result of the renaming. + */ + private void onRenameFileOperationFinish(RenameFileOperation operation, RemoteOperationResult result) { + dismissDialog(DIALOG_SHORT_WAIT); + OCFile renamedFile = operation.getFile(); + if (result.isSuccess()) { + if (mDualPane) { + FileDetailFragment details = (FileDetailFragment) getSupportFragmentManager().findFragmentByTag(FileDetailFragment.FTAG); + if (details != null && renamedFile.equals(details.getDisplayedFile()) ) { + details.updateFileDetails(renamedFile, AccountUtils.getCurrentOwnCloudAccount(this)); + } + } + if (mStorageManager.getFileById(renamedFile.getParentId()).equals(mCurrentDir)) { + mFileList.listDirectory(); + } + + } else { + if (result.getCode().equals(ResultCode.INVALID_LOCAL_FILE_NAME)) { + Toast msg = Toast.makeText(this, R.string.rename_local_fail_msg, Toast.LENGTH_LONG); + msg.show(); + // TODO throw again the new rename dialog + } else { + Toast msg = Toast.makeText(this, R.string.rename_server_fail_msg, Toast.LENGTH_LONG); + msg.show(); + if (result.isSslRecoverableException()) { + mLastSslUntrustedServerResult = result; + showDialog(DIALOG_SSL_VALIDATOR); + } + } + } + } + + + /** + * {@inheritDoc} + */ + @Override + public void onTransferStateChanged(OCFile file, boolean downloading, boolean uploading) { + /*OCFileListFragment fileListFragment = (OCFileListFragment) getSupportFragmentManager().findFragmentById(R.id.fileList); + if (fileListFragment != null) { + fileListFragment.listDirectory(); + }*/ + if (mDualPane) { + FileDetailFragment details = (FileDetailFragment) getSupportFragmentManager().findFragmentByTag(FileDetailFragment.FTAG); + if (details != null && file.equals(details.getDisplayedFile()) ) { + if (downloading || uploading) { + details.updateFileDetails(file, AccountUtils.getCurrentOwnCloudAccount(this)); + } else { + details.updateFileDetails(downloading || uploading); + } + } + } + } + + + + + } diff --git a/src/com/owncloud/android/ui/dialog/EditNameDialog.java b/src/com/owncloud/android/ui/dialog/EditNameDialog.java index 8ee6af6d..1755fa5a 100644 --- a/src/com/owncloud/android/ui/dialog/EditNameDialog.java +++ b/src/com/owncloud/android/ui/dialog/EditNameDialog.java @@ -39,6 +39,8 @@ import com.owncloud.android.R; */ public class EditNameDialog extends SherlockDialogFragment implements OnClickListener { + public static final String TAG = EditNameDialog.class.getSimpleName(); + private String mNewFilename; private boolean mResult; private EditNameDialogListener mListener; diff --git a/src/com/owncloud/android/ui/fragment/FileDetailFragment.java b/src/com/owncloud/android/ui/fragment/FileDetailFragment.java index c2a380d8..9b0f03bc 100644 --- a/src/com/owncloud/android/ui/fragment/FileDetailFragment.java +++ b/src/com/owncloud/android/ui/fragment/FileDetailFragment.java @@ -186,7 +186,7 @@ public class FileDetailFragment extends SherlockFragment implements mPreview = (ImageView)mView.findViewById(R.id.fdPreview); } - updateFileDetails(); + updateFileDetails(false); return view; } @@ -462,14 +462,21 @@ public class FileDetailFragment extends SherlockFragment implements public void updateFileDetails(OCFile file, Account ocAccount) { mFile = file; mAccount = ocAccount; - updateFileDetails(); + updateFileDetails(false); } /** * Updates the view with all relevant details about that file. + * + * TODO Remove parameter when the transferring state of files is kept in database. + * + * @param transferring Flag signaling if the file should be considered as downloading or uploading, + * although {@link FileDownloaderBinder#isDownloading(Account, OCFile)} and + * {@link FileUploaderBinder#isUploading(Account, OCFile)} return false. + * */ - public void updateFileDetails() { + public void updateFileDetails(boolean transferring) { if (mFile != null && mAccount != null && mLayout == R.layout.file_details_fragment) { @@ -491,7 +498,7 @@ public class FileDetailFragment extends SherlockFragment implements //if (FileDownloader.isDownloading(mAccount, mFile.getRemotePath()) || FileUploader.isUploading(mAccount, mFile.getRemotePath())) { FileDownloaderBinder downloaderBinder = mContainerActivity.getFileDownloaderBinder(); FileUploaderBinder uploaderBinder = mContainerActivity.getFileUploaderBinder(); - if ((downloaderBinder != null && downloaderBinder.isDownloading(mAccount, mFile)) || (uploaderBinder != null && uploaderBinder.isUploading(mAccount, mFile))) { + if (transferring || (downloaderBinder != null && downloaderBinder.isDownloading(mAccount, mFile)) || (uploaderBinder != null && uploaderBinder.isUploading(mAccount, mFile))) { setButtonsForTransferring(); } else if (mFile.isDown()) { @@ -504,9 +511,11 @@ public class FileDetailFragment extends SherlockFragment implements setButtonsForDown(); } else { + // TODO load default preview image; when the local file is removed, the preview remains there setButtonsForRemote(); } } + getView().invalidate(); } @@ -674,7 +683,7 @@ public class FileDetailFragment extends SherlockFragment implements if (downloadWasFine) { mFile.setStoragePath(intent.getStringExtra(FileDownloader.EXTRA_FILE_PATH)); // updates the local object without accessing the database again } - updateFileDetails(); // it updates the buttons; must be called although !downloadWasFine + updateFileDetails(false); // it updates the buttons; must be called although !downloadWasFine } } } @@ -704,7 +713,7 @@ public class FileDetailFragment extends SherlockFragment implements FileDataStorageManager fdsm = new FileDataStorageManager(mAccount, getActivity().getApplicationContext().getContentResolver()); mFile = fdsm.getFileByPath(mFile.getRemotePath()); } - updateFileDetails(); // it updates the buttons; must be called although !uploadWasFine; interrupted uploads still leave an incomplete file in the server + updateFileDetails(false); // it updates the buttons; must be called although !uploadWasFine; interrupted uploads still leave an incomplete file in the server } } } @@ -968,6 +977,6 @@ public class FileDetailFragment extends SherlockFragment implements } } } - + } diff --git a/src/com/owncloud/android/ui/fragment/OCFileListFragment.java b/src/com/owncloud/android/ui/fragment/OCFileListFragment.java index 83f09acd..cb41a777 100644 --- a/src/com/owncloud/android/ui/fragment/OCFileListFragment.java +++ b/src/com/owncloud/android/ui/fragment/OCFileListFragment.java @@ -29,15 +29,14 @@ import com.owncloud.android.files.services.FileUploader.FileUploaderBinder; import com.owncloud.android.network.OwnCloudClientUtils; import com.owncloud.android.operations.OnRemoteOperationListener; import com.owncloud.android.operations.RemoteOperation; -import com.owncloud.android.operations.RemoteOperationResult; import com.owncloud.android.operations.RemoveFileOperation; import com.owncloud.android.operations.RenameFileOperation; -import com.owncloud.android.operations.RemoteOperationResult.ResultCode; import com.owncloud.android.ui.FragmentListView; import com.owncloud.android.ui.activity.FileDisplayActivity; import com.owncloud.android.ui.activity.TransferServiceGetter; import com.owncloud.android.ui.adapter.FileListListAdapter; import com.owncloud.android.ui.dialog.EditNameDialog; +import com.owncloud.android.ui.dialog.EditNameDialog.EditNameDialogListener; import com.owncloud.android.ui.fragment.ConfirmationDialogFragment.ConfirmationDialogFragmentListener; import eu.alefzero.webdav.WebdavClient; @@ -50,7 +49,6 @@ import android.content.Intent; import android.net.Uri; import android.os.Bundle; import android.os.Handler; -import android.support.v4.app.FragmentTransaction; import android.util.Log; import android.view.ContextMenu; import android.view.MenuInflater; @@ -67,7 +65,7 @@ import android.widget.AdapterView.AdapterContextMenuInfo; * @author Bartek Przybylski * */ -public class OCFileListFragment extends FragmentListView implements EditNameDialog.EditNameDialogListener, OnRemoteOperationListener, ConfirmationDialogFragmentListener { +public class OCFileListFragment extends FragmentListView implements EditNameDialogListener, ConfirmationDialogFragmentListener { private static final String TAG = "FileListFragment"; private static final String SAVED_LIST_POSITION = "LIST_POSITION"; @@ -77,7 +75,6 @@ public class OCFileListFragment extends FragmentListView implements EditNameDial private FileListListAdapter mAdapter; private Handler mHandler; - private boolean mIsLargeLayout; private OCFile mTargetFile; @@ -115,7 +112,6 @@ public class OCFileListFragment extends FragmentListView implements EditNameDial registerForContextMenu(getListView()); getListView().setOnCreateContextMenuListener(this); - mIsLargeLayout = getResources().getBoolean(R.bool.large_layout); mHandler = new Handler(); Log.i(TAG, "onActivityCreated() stop"); @@ -209,8 +205,7 @@ public class OCFileListFragment extends FragmentListView implements EditNameDial case R.id.rename_file_item: { EditNameDialog dialog = EditNameDialog.newInstance(mTargetFile.getFileName()); dialog.setOnDismissListener(this); - dialog.show(getFragmentManager(), "nameeditdialog"); - Log.d(TAG, "RENAME SELECTED, item " + info.id + " at position " + info.position); + dialog.show(getFragmentManager(), EditNameDialog.TAG); return true; } case R.id.remove_file_item: { @@ -233,7 +228,6 @@ public class OCFileListFragment extends FragmentListView implements EditNameDial R.string.common_cancel); confDialog.setOnConfirmationListener(this); confDialog.show(getFragmentManager(), FileDetailFragment.FTAG_CONFIRMATION); - Log.d(TAG, "REMOVE SELECTED, item " + info.id + " at position " + info.position); return true; } case R.id.open_file_item: { @@ -289,6 +283,7 @@ public class OCFileListFragment extends FragmentListView implements EditNameDial i.putExtra(FileDownloader.EXTRA_FILE, mTargetFile); getActivity().startService(i); listDirectory(); + mContainerActivity.onTransferStateChanged(mTargetFile, true, false); return true; } case R.id.cancel_download_item: { @@ -297,6 +292,7 @@ public class OCFileListFragment extends FragmentListView implements EditNameDial if (downloaderBinder != null && downloaderBinder.isDownloading(account, mTargetFile)) { downloaderBinder.cancel(account, mTargetFile); listDirectory(); + mContainerActivity.onTransferStateChanged(mTargetFile, false, false); } return true; } @@ -306,6 +302,7 @@ public class OCFileListFragment extends FragmentListView implements EditNameDial if (uploaderBinder != null && uploaderBinder.isUploading(account, mTargetFile)) { uploaderBinder.cancel(account, mTargetFile); listDirectory(); + mContainerActivity.onTransferStateChanged(mTargetFile, false, false); } return true; } @@ -388,7 +385,7 @@ public class OCFileListFragment extends FragmentListView implements EditNameDial * * @author David A. Velasco */ - public interface ContainerActivity extends TransferServiceGetter { + public interface ContainerActivity extends TransferServiceGetter, OnRemoteOperationListener { /** * Callback method invoked when a directory is clicked by the user on the files list @@ -418,10 +415,26 @@ public class OCFileListFragment extends FragmentListView implements EditNameDial public OCFile getInitialDirectory(); + /** + * Callback method invoked when a the 'transfer state' of a file changes. + * + * This happens when a download or upload is started or ended for a file. + * + * This method is necessary by now to update the user interface of the double-pane layout in tablets + * because methods {@link FileDownloaderBinder#isDownloading(Account, OCFile)} and {@link FileUploaderBinder#isUploading(Account, OCFile)} + * won't provide the needed response before the method where this is called finishes. + * + * TODO Remove this when the transfer state of a file is kept in the database (other thing TODO) + * + * @param file OCFile which state changed. + * @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); + } - - - + + @Override public void onDismiss(EditNameDialog dialog) { if (dialog.getResult()) { @@ -431,69 +444,12 @@ public class OCFileListFragment extends FragmentListView implements EditNameDial newFilename, mContainerActivity.getStorageManager()); WebdavClient wc = OwnCloudClientUtils.createOwnCloudClient(AccountUtils.getCurrentOwnCloudAccount(getSherlockActivity()), getSherlockActivity().getApplicationContext()); - operation.execute(wc, this, mHandler); + operation.execute(wc, mContainerActivity, mHandler); getActivity().showDialog(FileDisplayActivity.DIALOG_SHORT_WAIT); } } - - @Override - public void onRemoteOperationFinish(RemoteOperation operation, RemoteOperationResult result) { - if (operation instanceof RemoveFileOperation) { - onRemoveFileOperationFinish((RemoveFileOperation)operation, result); - - } else if (operation instanceof RenameFileOperation) { - onRenameFileOperationFinish((RenameFileOperation)operation, result); - } - } - - - private void onRemoveFileOperationFinish(RemoveFileOperation operation, RemoteOperationResult result) { - getActivity().dismissDialog(FileDisplayActivity.DIALOG_SHORT_WAIT); - if (result.isSuccess()) { - Toast msg = Toast.makeText(getActivity().getApplicationContext(), R.string.remove_success_msg, Toast.LENGTH_LONG); - msg.show(); - if (mIsLargeLayout) { - // TODO - this should be done only when the current FileDetailFragment shows the deleted file - // -> THIS METHOD WOULD BE BETTER PLACED AT THE ACTIVITY LEVEL - FragmentTransaction transaction = getActivity().getSupportFragmentManager().beginTransaction(); - transaction.replace(R.id.file_details_container, new FileDetailFragment(null, null)); // empty FileDetailFragment - transaction.commit(); - } - listDirectory(); - - } else { - Toast msg = Toast.makeText(getActivity(), R.string.remove_fail_msg, Toast.LENGTH_LONG); - msg.show(); - if (result.isSslRecoverableException()) { - // TODO show the SSL warning dialog - } - } - } - - private void onRenameFileOperationFinish(RenameFileOperation operation, RemoteOperationResult result) { - getActivity().dismissDialog(FileDisplayActivity.DIALOG_SHORT_WAIT); - if (result.isSuccess()) { - listDirectory(); - // TODO is file - - } else { - if (result.getCode().equals(ResultCode.INVALID_LOCAL_FILE_NAME)) { - Toast msg = Toast.makeText(getActivity(), R.string.rename_local_fail_msg, Toast.LENGTH_LONG); - msg.show(); - // TODO throw again the new rename dialog - } else { - Toast msg = Toast.makeText(getActivity(), R.string.rename_server_fail_msg, Toast.LENGTH_LONG); - msg.show(); - if (result.isSslRecoverableException()) { - // TODO show the SSL warning dialog - } - } - } - } - - @Override public void onConfirmation(String callerTag) { if (callerTag.equals(FileDetailFragment.FTAG_CONFIRMATION)) { @@ -502,7 +458,7 @@ public class OCFileListFragment extends FragmentListView implements EditNameDial true, mContainerActivity.getStorageManager()); WebdavClient wc = OwnCloudClientUtils.createOwnCloudClient(AccountUtils.getCurrentOwnCloudAccount(getSherlockActivity()), getSherlockActivity().getApplicationContext()); - operation.execute(wc, this, mHandler); + operation.execute(wc, mContainerActivity, mHandler); getActivity().showDialog(FileDisplayActivity.DIALOG_SHORT_WAIT); } @@ -519,15 +475,16 @@ public class OCFileListFragment extends FragmentListView implements EditNameDial } else if (mTargetFile.isDown() && (f = new File(mTargetFile.getStoragePath())).exists()) { f.delete(); mTargetFile.setStoragePath(null); - mContainerActivity.getStorageManager().saveFile(mFile); + mContainerActivity.getStorageManager().saveFile(mTargetFile); } listDirectory(); + mContainerActivity.onTransferStateChanged(mTargetFile, false, false); } @Override public void onCancel(String callerTag) { Log.d(TAG, "REMOVAL CANCELED"); } - - + + }