X-Git-Url: http://git.linex4red.de/pub/Android/ownCloud.git/blobdiff_plain/576e2923ccbb2175b7177b26aca90b4b4c0253d0..5f61cb15552eb2fda01716078a9191b88cebf764:/src/eu/alefzero/webdav/WebdavClient.java diff --git a/src/eu/alefzero/webdav/WebdavClient.java b/src/eu/alefzero/webdav/WebdavClient.java index 3338f01f..f7cc060e 100644 --- a/src/eu/alefzero/webdav/WebdavClient.java +++ b/src/eu/alefzero/webdav/WebdavClient.java @@ -47,6 +47,7 @@ public class WebdavClient extends HttpClient { private Credentials mCredentials; final private static String TAG = "WebdavClient"; private static final String USER_AGENT = "Android-ownCloud"; + private OnUploadProgressListener mUploadProgressListener; public WebdavClient(Uri uri) { mUri = uri; @@ -74,6 +75,12 @@ public class WebdavClient extends HttpClient { public boolean downloadFile(String filepath, File targetPath) { // HttpGet get = new HttpGet(mUri.toString() + filepath.replace(" ", // "%20")); + String[] splitted_filepath = filepath.split("/"); + filepath = ""; + for (String s : splitted_filepath) { + if (s.equals("")) continue; + filepath += "/" + URLEncoder.encode(s); + } Log.e("ASD", mUri.toString() + filepath.replace(" ", "%20") + ""); GetMethod get = new GetMethod(mUri.toString() @@ -104,6 +111,10 @@ public class WebdavClient extends HttpClient { return true; } + public void setUploadListener(OnUploadProgressListener listener) { + mUploadProgressListener = listener; + } + public boolean putFile(String localFile, String remoteTarget, String contentType) { boolean result = true; @@ -111,7 +122,8 @@ public class WebdavClient extends HttpClient { try { Log.e("ASD", contentType + ""); File f = new File(localFile); - RequestEntity entity = new FileRequestEntity(f, contentType); + FileRequestEntity entity = new FileRequestEntity(f, contentType); + entity.setOnUploadProgressListener(mUploadProgressListener); Log.e("ASD", f.exists() + " " + entity.getContentLength()); PutMethod put = new PutMethod(mUri.toString() + remoteTarget); put.setRequestEntity(entity);