mirror of
				https://github.com/owncloud/android-library.git
				synced 2025-10-31 02:17:41 +00:00 
			
		
		
		
	Solve conflicts
This commit is contained in:
		
							parent
							
								
									3125c8047c
								
							
						
					
					
						commit
						ff6adc4cf9
					
				| @ -35,6 +35,8 @@ import java.util.List; | |||||||
| import com.owncloud.android.lib.common.network.OnDatatransferProgressListener; | import com.owncloud.android.lib.common.network.OnDatatransferProgressListener; | ||||||
| import com.owncloud.android.lib.common.OwnCloudClientFactory; | import com.owncloud.android.lib.common.OwnCloudClientFactory; | ||||||
| import com.owncloud.android.lib.common.OwnCloudClient; | import com.owncloud.android.lib.common.OwnCloudClient; | ||||||
|  | import com.owncloud.android.lib.refactor.OCContext; | ||||||
|  | import com.owncloud.android.lib.refactor.account.OCAccount; | ||||||
| import com.owncloud.android.lib.refactor.authentication.credentials.OwnCloudCredentialsFactory; | import com.owncloud.android.lib.refactor.authentication.credentials.OwnCloudCredentialsFactory; | ||||||
| import com.owncloud.android.lib.common.operations.OnRemoteOperationListener; | import com.owncloud.android.lib.common.operations.OnRemoteOperationListener; | ||||||
| import com.owncloud.android.lib.refactor.OwnCloudContext; | import com.owncloud.android.lib.refactor.OwnCloudContext; | ||||||
| @ -68,7 +70,7 @@ public class MainActivity extends Activity implements OnRemoteOperationListener, | |||||||
| 	 | 	 | ||||||
| 	private OwnCloudClient mClient; | 	private OwnCloudClient mClient; | ||||||
| 
 | 
 | ||||||
| 	private OwnCloudContext mOCContext; | 	private OCContext mOCContext; | ||||||
| 	 | 	 | ||||||
| 	private FilesArrayAdapter mFilesAdapter; | 	private FilesArrayAdapter mFilesAdapter; | ||||||
| 	 | 	 | ||||||
| @ -83,7 +85,7 @@ public class MainActivity extends Activity implements OnRemoteOperationListener, | |||||||
|         mHandler = new Handler(); |         mHandler = new Handler(); | ||||||
|          |          | ||||||
|     	Uri serverUri = Uri.parse(getString(R.string.server_base_url)); |     	Uri serverUri = Uri.parse(getString(R.string.server_base_url)); | ||||||
| //    	mClient = OwnCloudClientFactory.createOwnCloudClient(serverUri, this, true); |     	mClient = OwnCloudClientFactory.createOwnCloudClient(serverUri, this, true); | ||||||
| //    	mClient.setCredentials( | //    	mClient.setCredentials( | ||||||
| //    			OwnCloudCredentialsFactory.newBasicCredentials( | //    			OwnCloudCredentialsFactory.newBasicCredentials( | ||||||
| //    					getString(R.string.username), | //    					getString(R.string.username), | ||||||
| @ -91,13 +93,14 @@ public class MainActivity extends Activity implements OnRemoteOperationListener, | |||||||
| //				) | //				) | ||||||
| //		); | //		); | ||||||
| 
 | 
 | ||||||
|     	mOCContext = new OwnCloudContext.Builder() | 		OCAccount ocAccount = new OCAccount(serverUri, | ||||||
|                 .setBaseUri(serverUri) | 				OwnCloudCredentialsFactory.newBasicCredentials( | ||||||
|                 .setCredentials(OwnCloudCredentialsFactory.newBasicCredentials( |  | ||||||
|     					getString(R.string.username), |     					getString(R.string.username), | ||||||
|     					getString(R.string.password) |     					getString(R.string.password) | ||||||
|                 )) | 				) | ||||||
|                 .build(); | 		); | ||||||
|  | 
 | ||||||
|  |     	mOCContext = new OCContext(ocAccount); | ||||||
|     	 |     	 | ||||||
|     	mFilesAdapter = new FilesArrayAdapter(this, R.layout.file_in_list); |     	mFilesAdapter = new FilesArrayAdapter(this, R.layout.file_in_list); | ||||||
|     	((ListView)findViewById(R.id.list_view)).setAdapter(mFilesAdapter); |     	((ListView)findViewById(R.id.list_view)).setAdapter(mFilesAdapter); | ||||||
| @ -293,5 +296,4 @@ public class MainActivity extends Activity implements OnRemoteOperationListener, | |||||||
|             } |             } | ||||||
|         }); |         }); | ||||||
| 	} | 	} | ||||||
| 
 |  | ||||||
| } | } | ||||||
| @ -2,7 +2,6 @@ package com.owncloud.android.lib.refactor; | |||||||
| 
 | 
 | ||||||
| import com.owncloud.android.lib.refactor.account.OCAccount; | import com.owncloud.android.lib.refactor.account.OCAccount; | ||||||
| 
 | 
 | ||||||
| 
 |  | ||||||
| public class OCContext { | public class OCContext { | ||||||
|     private static final String TAG = OCContext.class.toString(); |     private static final String TAG = OCContext.class.toString(); | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -9,6 +9,7 @@ import okhttp3.Request; | |||||||
| public abstract class RemoteOperation { | public abstract class RemoteOperation { | ||||||
|     private final OCContext mContext; |     private final OCContext mContext; | ||||||
|     private static OkHttpClient httpClient = null; |     private static OkHttpClient httpClient = null; | ||||||
|  |     private static final String WEBDAV_PATH_4_0 = "/remote.php/dav"; | ||||||
| 
 | 
 | ||||||
|     protected RemoteOperation(OCContext context) { |     protected RemoteOperation(OCContext context) { | ||||||
|         mContext = context; |         mContext = context; | ||||||
| @ -22,19 +23,23 @@ public abstract class RemoteOperation { | |||||||
| 
 | 
 | ||||||
|     public abstract RemoteOperationResult exec(); |     public abstract RemoteOperationResult exec(); | ||||||
| 
 | 
 | ||||||
|     public OCContext getOCContext() { |     protected OCContext getOCContext() { | ||||||
|         return mContext; |         return mContext; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     public OkHttpClient getClient() { |     protected OkHttpClient getClient() { | ||||||
|         return httpClient; |         return httpClient; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     public Uri.Builder getBaseUriBuilder() { |     protected Uri.Builder getBaseUriBuilder() { | ||||||
|         return mContext.getOCAccount().getBaseUri().buildUpon(); |         return mContext.getOCAccount().getBaseUri().buildUpon(); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     public Request.Builder getRequestBuilder() { |     protected Uri.Builder getWebDAVUriBuilder() { | ||||||
|  |         return getBaseUriBuilder().appendEncodedPath(WEBDAV_PATH_4_0); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     protected Request.Builder getRequestBuilder() { | ||||||
|         Request.Builder builder = new Request.Builder(); |         Request.Builder builder = new Request.Builder(); | ||||||
| 
 | 
 | ||||||
|         for(Map.Entry<String, String> header |         for(Map.Entry<String, String> header | ||||||
|  | |||||||
| @ -150,5 +150,4 @@ public class OCAccount { | |||||||
|             return null; |             return null; | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| 
 |  | ||||||
| } | } | ||||||
| @ -54,10 +54,8 @@ public class OAuth2GetAccessTokenOperation extends RemoteOperation { | |||||||
|     private final String mClientSecret; |     private final String mClientSecret; | ||||||
|     private final String mRedirectUri; |     private final String mRedirectUri; | ||||||
|     private final String mAccessTokenEndpointPath; |     private final String mAccessTokenEndpointPath; | ||||||
| 
 |  | ||||||
|     private final OAuth2ResponseParser mResponseParser; |     private final OAuth2ResponseParser mResponseParser; | ||||||
| 
 | 
 | ||||||
| 
 |  | ||||||
|     public OAuth2GetAccessTokenOperation( |     public OAuth2GetAccessTokenOperation( | ||||||
|             OCContext context, |             OCContext context, | ||||||
|             String grantType, |             String grantType, | ||||||
|  | |||||||
| @ -26,7 +26,7 @@ public class PropfindOperation extends RemoteOperation { | |||||||
|     public RemoteOperationResult exec() { |     public RemoteOperationResult exec() { | ||||||
|         DavResource davResource = new DavResource( |         DavResource davResource = new DavResource( | ||||||
|                 getClient(), |                 getClient(), | ||||||
|                 HttpUrl.parse(getOCContext().getWebdavUri() + WebdavUtils.encodePath(mRemotePath)), |                 HttpUrl.parse(getWebDAVUriBuilder() + WebdavUtils.encodePath(mRemotePath)), | ||||||
|                 null); |                 null); | ||||||
| 
 | 
 | ||||||
|         try { |         try { | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user