mirror of
				https://github.com/owncloud/android-library.git
				synced 2025-10-31 10:27:45 +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 | 	 * @param client			Client object to reach an ownCloud server | ||||||
|      *                          during the execution of the operation. |      *                          during the execution of the operation. | ||||||
| 	 * @param listener			Listener to be notified about 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. |      *                          the listener objects must be called. | ||||||
| 	 * @return					Thread were the remote operation is executed. | 	 * @return					Thread were the remote operation is executed. | ||||||
| 	 */ | 	 */ | ||||||
| @ -243,18 +243,17 @@ public abstract class RemoteOperation implements Runnable { | |||||||
| 		} | 		} | ||||||
| 		mListener = listener; | 		mListener = listener; | ||||||
| 		 | 		 | ||||||
| 		if (listenerHandler == null) { | 		if (listenerHandler != null) { | ||||||
| 			throw new IllegalArgumentException |  | ||||||
|                     ("Trying to execute a remote operation asynchronously " + |  | ||||||
|                             "without a handler to the listener's thread"); |  | ||||||
| 		} |  | ||||||
|             mListenerHandler = listenerHandler; |             mListenerHandler = listenerHandler; | ||||||
|  | 		} | ||||||
|  | 
 | ||||||
| 		 | 		 | ||||||
| 		Thread runnerThread = new Thread(this); | 		Thread runnerThread = new Thread(this); | ||||||
| 		runnerThread.start(); | 		runnerThread.start(); | ||||||
| 		return runnerThread; | 		return runnerThread; | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
|  | 
 | ||||||
| 	/** | 	/** | ||||||
| 	 * Asynchronous execution of the operation  | 	 * Asynchronous execution of the operation  | ||||||
| 	 * started by {@link RemoteOperation#execute(OwnCloudClient, | 	 * 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