From: David A. Velasco Date: Wed, 27 Feb 2013 14:50:52 +0000 (+0100) Subject: Fixed update of download progress bar when the gallery is left with button HOME,... X-Git-Tag: oc-android-1.4.3~39^2~33 X-Git-Url: http://git.linex4red.de/pub/Android/ownCloud.git/commitdiff_plain/3d989ad060d53228330a28889abb320cc969fa94?ds=inline;hp=--cc Fixed update of download progress bar when the gallery is left with button HOME, and the user comes back before the download finishes --- 3d989ad060d53228330a28889abb320cc969fa94 diff --git a/src/com/owncloud/android/ui/preview/FileDownloadFragment.java b/src/com/owncloud/android/ui/preview/FileDownloadFragment.java index 63e8ade8..80bedc2e 100644 --- a/src/com/owncloud/android/ui/preview/FileDownloadFragment.java +++ b/src/com/owncloud/android/ui/preview/FileDownloadFragment.java @@ -334,6 +334,7 @@ public class FileDownloadFragment extends SherlockFragment implements OnClickLis if (mProgressListener != null) { if (mContainerActivity.getFileDownloaderBinder() != null) { mContainerActivity.getFileDownloaderBinder().removeDatatransferProgressListener(mProgressListener, mAccount, mFile); + mListening = false; } } } diff --git a/src/com/owncloud/android/ui/preview/PreviewImageActivity.java b/src/com/owncloud/android/ui/preview/PreviewImageActivity.java index f797580d..b090316f 100644 --- a/src/com/owncloud/android/ui/preview/PreviewImageActivity.java +++ b/src/com/owncloud/android/ui/preview/PreviewImageActivity.java @@ -116,11 +116,6 @@ public class PreviewImageActivity extends SherlockFragmentActivity implements Fi createViewPager(); - mDownloadConnection = new PreviewImageServiceConnection(); - bindService(new Intent(this, FileDownloader.class), mDownloadConnection, Context.BIND_AUTO_CREATE); - mUploadConnection = new PreviewImageServiceConnection(); - bindService(new Intent(this, FileUploader.class), mUploadConnection, Context.BIND_AUTO_CREATE); - } private void createViewPager() { @@ -143,6 +138,10 @@ public class PreviewImageActivity extends SherlockFragmentActivity implements Fi public void onStart() { super.onStart(); Log.e(TAG, "PREVIEW ACTIVITY ON START"); + mDownloadConnection = new PreviewImageServiceConnection(); + bindService(new Intent(this, FileDownloader.class), mDownloadConnection, Context.BIND_AUTO_CREATE); + mUploadConnection = new PreviewImageServiceConnection(); + bindService(new Intent(this, FileUploader.class), mUploadConnection, Context.BIND_AUTO_CREATE); } @Override @@ -190,8 +189,8 @@ public class PreviewImageActivity extends SherlockFragmentActivity implements Fi @Override - public void onDestroy() { - super.onDestroy(); + public void onStop() { + super.onStop(); if (mDownloadConnection != null) { unbindService(mDownloadConnection); mDownloadConnection = null; @@ -204,6 +203,12 @@ public class PreviewImageActivity extends SherlockFragmentActivity implements Fi @Override + public void onDestroy() { + super.onDestroy(); + } + + + @Override public boolean onOptionsItemSelected(MenuItem item) { boolean returnValue = false;