From: masensio Date: Mon, 19 May 2014 08:50:26 +0000 (+0200) Subject: Merge pull request #494 from owncloud/fixed_restart_of_cancelled_download_after_chang... X-Git-Tag: oc-android-1.7.0_signed~309^2~12 X-Git-Url: http://git.linex4red.de/pub/Android/ownCloud.git/commitdiff_plain/fa97fe545febe566bf421c0a34b8b81e3918898a?ds=inline;hp=-c Merge pull request #494 from owncloud/fixed_restart_of_cancelled_download_after_changing_device_orientation Fixed restart of cancelled download after changing device orientation --- fa97fe545febe566bf421c0a34b8b81e3918898a diff --combined src/com/owncloud/android/ui/activity/FileDisplayActivity.java index 3984b080,4ba06d10..da888599 --- a/src/com/owncloud/android/ui/activity/FileDisplayActivity.java +++ b/src/com/owncloud/android/ui/activity/FileDisplayActivity.java @@@ -665,9 -665,6 +665,9 @@@ FileFragment.ContainerActivity, OnNavig protected void onResume() { super.onResume(); Log_OC.e(TAG, "onResume() start"); + + // refresh list of files + refreshListOfFilesFragment(); // Listen for sync messages IntentFilter syncIntentFilter = new IntentFilter(FileSyncAdapter.EVENT_FULL_SYNC_START); @@@ -1433,15 -1430,19 +1433,20 @@@ */ @Override public void onTransferStateChanged(OCFile file, boolean downloading, boolean uploading) { + refreshListOfFilesFragment(); FileFragment details = getSecondFragment(); if (details != null && details instanceof FileDetailFragment && file.equals(details.getFile()) ) { if (downloading || uploading) { ((FileDetailFragment)details).updateFileDetails(file, getAccount()); } else { - ((FileDetailFragment)details).updateFileDetails(false, true); + if (!file.fileExists()) { + cleanSecondFragment(); + } else { + ((FileDetailFragment)details).updateFileDetails(false, true); + } } } + } @@@ -1539,7 -1540,6 +1544,7 @@@ showDetailsIntent.putExtra(EXTRA_FILE, file); showDetailsIntent.putExtra(EXTRA_ACCOUNT, getAccount()); startActivity(showDetailsIntent); + } /** @@@ -1576,22 -1576,16 +1581,16 @@@ public void cancelTransference(OCFile file) { - Account account = getAccount(); - if (mDownloaderBinder != null && mDownloaderBinder.isDownloading(account, file)) { - mDownloaderBinder.cancel(account, file); - refreshListOfFilesFragment(); - onTransferStateChanged(file, false, false); - - } else if (mUploaderBinder != null && mUploaderBinder.isUploading(account, file)) { - mUploaderBinder.cancel(account, file); - refreshListOfFilesFragment(); - if (!file.fileExists()) { - cleanSecondFragment(); - - } else { - onTransferStateChanged(file, false, false); - } + getFileOperationsHelper().cancelTransference(file); + if (mWaitingToPreview != null && + mWaitingToPreview.getRemotePath().equals(file.getRemotePath())) { + mWaitingToPreview = null; + } + if (mWaitingToSend != null && + mWaitingToSend.getRemotePath().equals(file.getRemotePath())) { + mWaitingToSend = null; } + onTransferStateChanged(file, false, false); } }