mirror of
				https://github.com/owncloud/android-library.git
				synced 2025-10-30 18:07:38 +00:00 
			
		
		
		
	Merge pull request #77 from mendhak/master
Allow asynchronous execution without handler
This commit is contained in:
		
						commit
						bd33e65090
					
				| @ -224,7 +224,7 @@ public abstract class RemoteOperation implements Runnable { | ||||
| 	 * @param client			Client object to reach an ownCloud server | ||||
|      *                          during the execution of the operation. | ||||
| 	 * @param listener			Listener to be notified about the execution of the operation. | ||||
| 	 * @param listenerHandler	Handler associated to the thread where the methods of | ||||
| 	 * @param listenerHandler	Handler, if passed in, associated to the thread where the methods of | ||||
|      *                          the listener objects must be called. | ||||
| 	 * @return					Thread were the remote operation is executed. | ||||
| 	 */ | ||||
| @ -243,18 +243,17 @@ public abstract class RemoteOperation implements Runnable { | ||||
| 		} | ||||
| 		mListener = listener; | ||||
| 		 | ||||
| 		if (listenerHandler == null) { | ||||
| 			throw new IllegalArgumentException | ||||
|                     ("Trying to execute a remote operation asynchronously " + | ||||
|                             "without a handler to the listener's thread"); | ||||
| 		if (listenerHandler != null) { | ||||
|             mListenerHandler = listenerHandler; | ||||
| 		} | ||||
| 		mListenerHandler = listenerHandler; | ||||
| 
 | ||||
| 		 | ||||
| 		Thread runnerThread = new Thread(this); | ||||
| 		runnerThread.start(); | ||||
| 		return runnerThread; | ||||
| 	} | ||||
| 	 | ||||
| 
 | ||||
| 
 | ||||
| 	/** | ||||
| 	 * Asynchronous execution of the operation  | ||||
| 	 * started by {@link RemoteOperation#execute(OwnCloudClient, | ||||
| @ -347,6 +346,9 @@ public abstract class RemoteOperation implements Runnable { | ||||
|                 } | ||||
|             }); | ||||
|         } | ||||
|         else if(mListener != null) { | ||||
|             mListener.onRemoteOperationFinish(RemoteOperation.this, resultToSend); | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
| 
 | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user