Fixed crash when selecting a folder to move file into after rotating the device in...
authorDavid A. Velasco <dvelasco@solidgear.es>
Thu, 28 Aug 2014 16:44:15 +0000 (18:44 +0200)
committerDavid A. Velasco <dvelasco@solidgear.es>
Thu, 28 Aug 2014 16:44:15 +0000 (18:44 +0200)
src/com/owncloud/android/ui/activity/FileActivity.java
src/com/owncloud/android/ui/activity/FileDisplayActivity.java

index 33eacae..68754d7 100644 (file)
@@ -80,6 +80,8 @@ implements OnRemoteOperationListener, ComponentsGetter {
     private static final String DIALOG_WAIT_TAG = "DIALOG_WAIT";
     private static final String KEY_WAITING_FOR_OP_ID = "WAITING_FOR_OP_ID";;
     
+    protected static final long DELAY_TO_REQUEST_OPERATION_ON_ACTIVITY_RESULTS = 200;
+    
     
     /** OwnCloud {@link Account} where the main {@link OCFile} handled by the activity is located. */
     private Account mAccount;
index 005b5ac..6329833 100644 (file)
@@ -21,6 +21,8 @@ package com.owncloud.android.ui.activity;
 import java.io.File;
 import java.io.IOException;
 
+import org.apache.commons.httpclient.methods.PostMethod;
+
 import android.accounts.Account;
 import android.accounts.AccountManager;
 import android.accounts.AuthenticatorException;
@@ -556,7 +558,18 @@ OnSslUntrustedCertListener, SwipeRefreshLayout.OnRefreshListener {
 
         } else if (requestCode == ACTION_MOVE_FILES && (resultCode == RESULT_OK || 
                 resultCode == MoveActivity.RESULT_OK_AND_MOVE)){
-            requestMoveOperation(data, resultCode);
+
+            final Intent fData = data;
+            final int fResultCode = resultCode; 
+            getHandler().postDelayed(
+                new Runnable() {
+                    @Override
+                    public void run() {
+                        requestMoveOperation(fData, fResultCode);
+                    }
+                }, 
+                DELAY_TO_REQUEST_OPERATION_ON_ACTIVITY_RESULTS
+            );
         }
     }