Fixed audio preview loop got when a tablet is torned to portrait orientation while...
[pub/Android/ownCloud.git] / src / com / owncloud / android / ui / preview / PreviewImageActivity.java
index f797580..62dc8cf 100644 (file)
@@ -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;
         
@@ -323,23 +328,6 @@ public class PreviewImageActivity extends SherlockFragmentActivity implements Fi
         }
     }
 
-    @Override
-    public void notifySuccessfulDownload(OCFile file, Intent intent, boolean success) {
-        /*
-        if (success) {
-            if (mWaitingToPreview != null && mWaitingToPreview.equals(file)) {
-                mWaitingToPreview = null;
-                int position = mViewPager.getCurrentItem();
-                mPreviewImagePagerAdapter.updateFile(position, file);
-                Log.e(TAG, "BEFORE NOTIFY DATA SET CHANGED");
-                mPreviewImagePagerAdapter.notifyDataSetChanged();
-                Log.e(TAG, "AFTER NOTIFY DATA SET CHANGED");
-            }
-        }
-        */
-    }
-
-    
     /**
      * This method will be invoked when a new page becomes selected. Animation is not necessarily complete.
      *