X-Git-Url: http://git.linex4red.de/pub/Android/ownCloud.git/blobdiff_plain/2a04c6ae5da009baa78c243606297b5a039925c2..393bcd6869d4d77b2048c9c625e36eaeb6963ef3:/src/eu/alefzero/owncloud/ui/fragment/FileDetailFragment.java diff --git a/src/eu/alefzero/owncloud/ui/fragment/FileDetailFragment.java b/src/eu/alefzero/owncloud/ui/fragment/FileDetailFragment.java index 6a34c6d0..acc07bf2 100644 --- a/src/eu/alefzero/owncloud/ui/fragment/FileDetailFragment.java +++ b/src/eu/alefzero/owncloud/ui/fragment/FileDetailFragment.java @@ -79,6 +79,7 @@ import eu.alefzero.owncloud.authenticator.AccountAuthenticator; import eu.alefzero.owncloud.datamodel.FileDataStorageManager; import eu.alefzero.owncloud.datamodel.OCFile; import eu.alefzero.owncloud.files.services.FileDownloader; +import eu.alefzero.owncloud.files.services.FileUploader; import eu.alefzero.owncloud.ui.activity.FileDisplayActivity; import eu.alefzero.owncloud.utils.OwnCloudVersion; import eu.alefzero.webdav.WebdavClient; @@ -240,7 +241,7 @@ public class FileDetailFragment extends SherlockFragment implements break; } case R.id.fdRemoveBtn: { - ConfirmationDialogFragment confDialog = ConfirmationDialogFragment.newInstance("to remove " + mFile.getFileName()); + ConfirmationDialogFragment confDialog = ConfirmationDialogFragment.newInstance(R.string.confirmation_remove_alert, new String[]{mFile.getFileName()}); confDialog.setOnConfirmationListener(this); confDialog.show(getFragmentManager(), FTAG_CONFIRMATION); break; @@ -361,7 +362,7 @@ public class FileDetailFragment extends SherlockFragment implements cb.setChecked(mFile.keepInSync()); // configure UI for depending upon local state of the file - if (mFile.isDownloading()) { + if (FileDownloader.isDownloading(mAccount, mFile.getRemotePath())) { setButtonsForDownloading(); } else if (mFile.isDown()) { @@ -553,7 +554,9 @@ public class FileDetailFragment extends SherlockFragment implements private class DownloadFinishReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { - if (mFile != null) { + String accountName = intent.getStringExtra(FileDownloader.ACCOUNT_NAME); + + if (!isEmpty() && accountName.equals(mAccount.name)) { boolean downloadWasFine = intent.getBooleanExtra(FileDownloader.EXTRA_DOWNLOAD_RESULT, false); String downloadedRemotePath = intent.getStringExtra(FileDownloader.EXTRA_REMOTE_PATH); if (mFile.getRemotePath().equals(downloadedRemotePath)) { @@ -688,7 +691,7 @@ public class FileDetailFragment extends SherlockFragment implements if (!newFilename.equals(mFile.getFileName())) { FileDataStorageManager fdsm = new FileDataStorageManager(mAccount, getActivity().getContentResolver()); if (fdsm.getFileById(mFile.getFileId()) != null) { - OCFile newFile = new OCFile(fdsm.getFileById(mFile.getParentId()).getRemotePath() + OCFile.PATH_SEPARATOR + newFilename); + OCFile newFile = new OCFile(fdsm.getFileById(mFile.getParentId()).getRemotePath() + newFilename); newFile.setCreationTimestamp(mFile.getCreationTimestamp()); newFile.setFileId(mFile.getFileId()); newFile.setFileLength(mFile.getFileLength()); @@ -700,9 +703,9 @@ public class FileDetailFragment extends SherlockFragment implements if (mFile.isDown()) { File f = new File(mFile.getStoragePath()); Log.e(TAG, f.getAbsolutePath()); - f.renameTo(new File(f.getParent()+"/"+newFilename)); - Log.e(TAG, f.getAbsolutePath()); - newFile.setStoragePath(f.getAbsolutePath()); + f.renameTo(new File(f.getParent() + File.separator + newFilename)); // TODO check if fails + Log.e(TAG, f.getParent() + File.separator + newFilename); + newFile.setStoragePath(f.getParent() + File.separator + newFilename); } new Thread(new RenameRunnable(mFile, newFile, mAccount, new Handler())).start();