mirror of
				https://github.com/owncloud/android-library.git
				synced 2025-10-30 01:48:14 +00:00 
			
		
		
		
	Keep previous owncloudclient implementation
This commit is contained in:
		
							parent
							
								
									275a0f0f10
								
							
						
					
					
						commit
						b9ba124541
					
				| @ -53,6 +53,8 @@ import com.owncloud.android.lib.resources.files.FileUtils; | ||||
| import com.owncloud.android.lib.resources.files.ReadRemoteFolderOperation; | ||||
| import com.owncloud.android.lib.resources.files.RemoteFile; | ||||
| 
 | ||||
| import at.bitfire.dav4android.DavResource; | ||||
| 
 | ||||
| import java.io.File; | ||||
| import java.io.FileOutputStream; | ||||
| import java.io.IOException; | ||||
| @ -61,8 +63,6 @@ import java.util.ArrayList; | ||||
| import java.util.Iterator; | ||||
| import java.util.List; | ||||
| 
 | ||||
| import at.bitfire.dav4android.DavResource; | ||||
| 
 | ||||
| public class MainActivity extends Activity implements OnRemoteOperationListener, OnDatatransferProgressListener { | ||||
| 	 | ||||
| 	private static String LOG_TAG = MainActivity.class.getCanonicalName(); | ||||
| @ -164,10 +164,11 @@ public class MainActivity extends Activity implements OnRemoteOperationListener, | ||||
| 						Toast.makeText(this, result.getLogMessage(), Toast.LENGTH_LONG).show()); | ||||
| 				return; | ||||
| 			} | ||||
| 			for(DavResource el : result.getData().getMembers()) { | ||||
| 				remoteFiles.add(new RemoteFile(el)); | ||||
| 			} | ||||
| //			for(DavResource el : result.getData().getMembers()) { | ||||
| //				remoteFiles.add(new RemoteFile(el)); | ||||
| //			} | ||||
| 			handler.post(() -> { | ||||
| 				Toast.makeText(this, result.getData().getMembers().toString(), Toast.LENGTH_LONG).show(); | ||||
| 				mFilesAdapter.clear(); | ||||
| 				mFilesAdapter.addAll(remoteFiles); | ||||
| 			}); | ||||
|  | ||||
| @ -40,12 +40,15 @@ import com.owncloud.android.lib.resources.status.OwnCloudVersion; | ||||
| import org.apache.commons.httpclient.Cookie; | ||||
| import org.apache.commons.httpclient.Header; | ||||
| import org.apache.commons.httpclient.HostConfiguration; | ||||
| import org.apache.commons.httpclient.HttpClient; | ||||
| import org.apache.commons.httpclient.HttpConnectionManager; | ||||
| import org.apache.commons.httpclient.HttpMethod; | ||||
| import org.apache.commons.httpclient.HttpMethodBase; | ||||
| import org.apache.commons.httpclient.HttpStatus; | ||||
| import org.apache.commons.httpclient.HttpVersion; | ||||
| import org.apache.commons.httpclient.URI; | ||||
| import org.apache.commons.httpclient.URIException; | ||||
| import org.apache.commons.httpclient.cookie.CookiePolicy; | ||||
| import org.apache.commons.httpclient.params.HttpMethodParams; | ||||
| import org.apache.commons.httpclient.params.HttpParams; | ||||
| 
 | ||||
| @ -56,7 +59,7 @@ import java.util.Arrays; | ||||
| import okhttp3.OkHttpClient; | ||||
| import okhttp3.Protocol; | ||||
| 
 | ||||
| public class OwnCloudClient { | ||||
| public class OwnCloudClient extends HttpClient { | ||||
| 
 | ||||
|     public static final String WEBDAV_PATH_4_0 = "/remote.php/webdav"; | ||||
|     public static final String STATUS_PATH = "/status.php"; | ||||
| @ -107,6 +110,36 @@ public class OwnCloudClient { | ||||
|      */ | ||||
|     public OwnCloudClient(Uri baseUri, HttpConnectionManager connectionMgr) { | ||||
| 
 | ||||
|         super(connectionMgr); | ||||
| 
 | ||||
|         if (baseUri == null) { | ||||
|             throw new IllegalArgumentException("Parameter 'baseUri' cannot be NULL"); | ||||
|         } | ||||
|         mBaseUri = baseUri; | ||||
| 
 | ||||
|         mInstanceNumber = sIntanceCounter++; | ||||
|         Log_OC.d(TAG + " #" + mInstanceNumber, "Creating OwnCloudClient"); | ||||
| 
 | ||||
|         String userAgent = OwnCloudClientManagerFactory.getUserAgent(); | ||||
|         getParams().setParameter(HttpMethodParams.USER_AGENT, userAgent); | ||||
|         getParams().setParameter( | ||||
|                 PARAM_PROTOCOL_VERSION, | ||||
|                 HttpVersion.HTTP_1_1 | ||||
|         ); | ||||
| 
 | ||||
|         getParams().setCookiePolicy(CookiePolicy.IGNORE_COOKIES); | ||||
|         getParams().setParameter( | ||||
|                 PARAM_SINGLE_COOKIE_HEADER,             // to avoid problems with some web servers | ||||
|                 PARAM_SINGLE_COOKIE_HEADER_VALUE | ||||
|         ); | ||||
| 
 | ||||
|         applyProxySettings(); | ||||
| 
 | ||||
|         clearCredentials(); | ||||
|     } | ||||
| 
 | ||||
|     public OwnCloudClient(Uri baseUri) { | ||||
| 
 | ||||
|         String userAgent = OwnCloudClientManagerFactory.getUserAgent(); | ||||
| 
 | ||||
|         if (mClient == null) { | ||||
| @ -142,6 +175,7 @@ public class OwnCloudClient { | ||||
| //        applyProxySettings(); | ||||
| 
 | ||||
|         clearCredentials(); | ||||
| 
 | ||||
|     } | ||||
| 
 | ||||
| 
 | ||||
|  | ||||
| @ -92,11 +92,11 @@ public class UploadRemoteFileOperation extends RemoteOperation<Void> { | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     public void cancel() { | ||||
|         synchronized (mCancellationRequested) { | ||||
|             mCancellationRequested.set(true); | ||||
|             if (mPutMethod != null) | ||||
|                 mPutMethod.abort(); | ||||
|         } | ||||
|     } | ||||
| //    public void cancel() { | ||||
| //        synchronized (mCancellationRequested) { | ||||
| //            mCancellationRequested.set(true); | ||||
| //            if (mPutMethod != null) | ||||
| //                mPutMethod.abort(); | ||||
| //        } | ||||
| //    } | ||||
| } | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user