OC-2918: Fix bug: It's not possible to share a file in samsung galaxy mini. (Some...
[pub/Android/ownCloud.git] / src / com / owncloud / android / services / OperationsService.java
index 798a0d4..85eaf72 100644 (file)
@@ -19,15 +19,12 @@ package com.owncloud.android.services;
 
 import java.io.IOException;
 import java.util.HashMap;
-import java.util.HashSet;
 import java.util.Iterator;
 import java.util.Map;
-import java.util.Set;
 import java.util.concurrent.ConcurrentLinkedQueue;
 
 import com.owncloud.android.datamodel.FileDataStorageManager;
 
-import com.owncloud.android.lib.network.OnDatatransferProgressListener;
 import com.owncloud.android.lib.network.OwnCloudClientFactory;
 import com.owncloud.android.lib.network.OwnCloudClient;
 import com.owncloud.android.operations.CreateShareOperation;
@@ -127,14 +124,14 @@ public class OperationsService extends Service {
             RemoteOperation operation = null;
             
             String action = intent.getAction();
-            if (action == ACTION_CREATE_SHARE) {  // Create Share
+            if (action.equals(ACTION_CREATE_SHARE)) {  // Create Share
                 String remotePath = intent.getStringExtra(EXTRA_REMOTE_PATH);
                 Intent sendIntent = intent.getParcelableExtra(EXTRA_SEND_INTENT);
                 if (remotePath.length() > 0) {
                     operation = new CreateShareOperation(remotePath, ShareType.PUBLIC_LINK, 
                             "", false, "", 1, sendIntent);
                 }
-            } else if (action == ACTION_UNSHARE) {  // Unshare file
+            } else if (action.equals(ACTION_UNSHARE)) {  // Unshare file
                 String remotePath = intent.getStringExtra(EXTRA_REMOTE_PATH);
                 if (remotePath.length() > 0) {
                     operation = new UnshareLinkOperation(remotePath, this.getApplicationContext());
@@ -144,7 +141,7 @@ public class OperationsService extends Service {
             }
             
             mPendingOperations.add(new Pair<Target , RemoteOperation>(target, operation));
-            sendBroadcastNewOperation(target, operation);
+            //sendBroadcastNewOperation(target, operation);
             
             Message msg = mServiceHandler.obtainMessage();
             msg.arg1 = startId;
@@ -202,6 +199,7 @@ public class OperationsService extends Service {
         
         
         public void clearListeners() {
+            
             mBoundListeners.clear();
         }
 
@@ -233,7 +231,7 @@ public class OperationsService extends Service {
          * @return  'True' when an operation that enforces the user to wait for completion is in process.
          */
         public boolean isPerformingBlockingOperation() {
-            return (mPendingOperations.size() > 0);
+            return (!mPendingOperations.isEmpty());
         }
 
     }
@@ -326,7 +324,7 @@ public class OperationsService extends Service {
                 }
             }
             
-            sendBroadcastOperationFinished(mLastTarget, mCurrentOperation, result);
+            //sendBroadcastOperationFinished(mLastTarget, mCurrentOperation, result);
             callbackOperationListeners(mLastTarget, mCurrentOperation, result);
         }
     }