projects
/
pub
/
Android
/
ownCloud.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fixed: Rotating screen after viewing a file would return you to the
[pub/Android/ownCloud.git]
/
src
/
eu
/
alefzero
/
webdav
/
WebdavClient.java
diff --git
a/src/eu/alefzero/webdav/WebdavClient.java
b/src/eu/alefzero/webdav/WebdavClient.java
index
6e1d287
..
f7cc060
100644
(file)
--- 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;
\r
final private static String TAG = "WebdavClient";
\r
private static final String USER_AGENT = "Android-ownCloud";
\r
private Credentials mCredentials;
\r
final private static String TAG = "WebdavClient";
\r
private static final String USER_AGENT = "Android-ownCloud";
\r
+ private OnUploadProgressListener mUploadProgressListener;
\r
\r
public WebdavClient(Uri uri) {
\r
mUri = uri;
\r
\r
public WebdavClient(Uri uri) {
\r
mUri = uri;
\r
@@
-74,17
+75,23
@@
public class WebdavClient extends HttpClient {
public boolean downloadFile(String filepath, File targetPath) {
\r
// HttpGet get = new HttpGet(mUri.toString() + filepath.replace(" ",
\r
// "%20"));
\r
public boolean downloadFile(String filepath, File targetPath) {
\r
// HttpGet get = new HttpGet(mUri.toString() + filepath.replace(" ",
\r
// "%20"));
\r
+ String[] splitted_filepath = filepath.split("/");
\r
+ filepath = "";
\r
+ for (String s : splitted_filepath) {
\r
+ if (s.equals("")) continue;
\r
+ filepath += "/" + URLEncoder.encode(s);
\r
+ }
\r
\r
\r
- Log.e("ASD", mUri.toString() +
URLDecoder.decode(filepath
) + "");
\r
+ Log.e("ASD", mUri.toString() +
filepath.replace(" ", "%20"
) + "");
\r
GetMethod get = new GetMethod(mUri.toString()
\r
GetMethod get = new GetMethod(mUri.toString()
\r
- +
URLEncoder.encode(filepath
));
\r
+ +
filepath.replace(" ", "%20"
));
\r
\r
// get.setHeader("Host", mUri.getHost());
\r
// get.setHeader("User-Agent", "Android-ownCloud");
\r
\r
try {
\r
\r
// get.setHeader("Host", mUri.getHost());
\r
// get.setHeader("User-Agent", "Android-ownCloud");
\r
\r
try {
\r
- Log.e("ASD", get.toString());
\r
int status = executeMethod(get);
\r
int status = executeMethod(get);
\r
+ Log.e(TAG, "status return: " + status);
\r
if (status != HttpStatus.SC_OK) {
\r
return false;
\r
}
\r
if (status != HttpStatus.SC_OK) {
\r
return false;
\r
}
\r
@@
-104,6
+111,10
@@
public class WebdavClient extends HttpClient {
return true;
\r
}
\r
\r
return true;
\r
}
\r
\r
+ public void setUploadListener(OnUploadProgressListener listener) {
\r
+ mUploadProgressListener = listener;
\r
+ }
\r
+
\r
public boolean putFile(String localFile, String remoteTarget,
\r
String contentType) {
\r
boolean result = true;
\r
public boolean putFile(String localFile, String remoteTarget,
\r
String contentType) {
\r
boolean result = true;
\r
@@
-111,7
+122,8
@@
public class WebdavClient extends HttpClient {
try {
\r
Log.e("ASD", contentType + "");
\r
File f = new File(localFile);
\r
try {
\r
Log.e("ASD", contentType + "");
\r
File f = new File(localFile);
\r
- RequestEntity entity = new FileRequestEntity(f, contentType);
\r
+ FileRequestEntity entity = new FileRequestEntity(f, contentType);
\r
+ entity.setOnUploadProgressListener(mUploadProgressListener);
\r
Log.e("ASD", f.exists() + " " + entity.getContentLength());
\r
PutMethod put = new PutMethod(mUri.toString() + remoteTarget);
\r
put.setRequestEntity(entity);
\r
Log.e("ASD", f.exists() + " " + entity.getContentLength());
\r
PutMethod put = new PutMethod(mUri.toString() + remoteTarget);
\r
put.setRequestEntity(entity);
\r