-->\r
<manifest package="eu.alefzero.owncloud"\r
android:versionCode="1"\r
- android:versionName="0.1.161B" xmlns:android="http://schemas.android.com/apk/res/android">\r
+ android:versionName="0.1.162B" xmlns:android="http://schemas.android.com/apk/res/android">\r
\r
<uses-permission android:name="android.permission.GET_ACCOUNTS" />\r
<uses-permission android:name="android.permission.USE_CREDENTIALS" />\r
for (int i=0; i < files.size() && !mCancellation; i++) {\r
OCFile newFile = files.get(i);\r
if (newFile.getMimetype().equals("DIR")) {\r
- fetchData(getUri().toString() + WebdavUtils.encode(newFile.getRemotePath()), syncResult, newFile.getFileId());\r
+ fetchData(getUri().toString() + WebdavUtils.encodePath(newFile.getRemotePath()), syncResult, newFile.getFileId());\r
}\r
}\r
if (mCancellation) Log.d(TAG, "Leaving " + uri + " because cancellation request");\r
import eu.alefzero.owncloud.R;
import eu.alefzero.owncloud.authenticator.AccountAuthenticator;
import eu.alefzero.owncloud.db.ProviderMeta.ProviderTableMeta;
+import eu.alefzero.webdav.WebdavUtils;
import android.accounts.Account;
import android.accounts.AccountManager;
import android.content.Context;
.getSystemService(Context.ACCOUNT_SERVICE);
String ocurl = accm.getUserData(mAccount,
AccountAuthenticator.KEY_OC_URL);
- ocurl += mFilePath + Uri.encode(mFilename);
+ ocurl += WebdavUtils.encodePath(mFilePath + mFilename);
intent.setData(Uri.parse(ocurl));
} else {
intent.putExtra("toDownload", false);
IntentFilter filter = new IntentFilter(\r
FileDownloader.DOWNLOAD_FINISH_MESSAGE);\r
getActivity().registerReceiver(mDownloadFinishReceiver, filter);\r
+ mPreview = (ImageView)mView.findViewById(R.id.fdPreview);\r
}\r
\r
@Override\r
@Override\r
public void onClick(View v) {\r
String storagePath = mFile.getStoragePath();\r
+ String encodedStoragePath = WebdavUtils.encodePath(storagePath);\r
try {\r
Intent i = new Intent(Intent.ACTION_VIEW);\r
- i.setDataAndType(Uri.parse("file://"+ storagePath), mFile.getMimetype());\r
+ i.setDataAndType(Uri.parse("file://"+ encodedStoragePath), mFile.getMimetype());\r
i.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION | Intent.FLAG_GRANT_WRITE_URI_PERMISSION);\r
startActivity(i);\r
\r
Intent i = new Intent(Intent.ACTION_VIEW);\r
mimeType = MimeTypeMap.getSingleton().getMimeTypeFromExtension(storagePath.substring(storagePath.lastIndexOf('.') + 1));\r
if (mimeType != null && !mimeType.equals(mFile.getMimetype())) {\r
- i.setDataAndType(Uri.parse("file://"+mFile.getStoragePath()), mimeType);\r
+ i.setDataAndType(Uri.parse("file://"+ encodedStoragePath), mimeType);\r
i.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION | Intent.FLAG_GRANT_WRITE_URI_PERMISSION);\r
startActivity(i);\r
toastIt = false;\r
String baseUrl = am.getUserData(mAccount, AccountAuthenticator.KEY_OC_BASE_URL);\r
OwnCloudVersion ocv = new OwnCloudVersion(am.getUserData(mAccount, AccountAuthenticator.KEY_OC_VERSION));\r
String webdav_path = AccountUtils.getWebdavPath(ocv);\r
- Log.d("ASD", ""+baseUrl + webdav_path + WebdavUtils.encode(mOld.getRemotePath()));\r
+ Log.d("ASD", ""+baseUrl + webdav_path + WebdavUtils.encodePath(mOld.getRemotePath()));\r
\r
- Log.e("ASD", Uri.parse(baseUrl).getPath() == null ? "" : Uri.parse(baseUrl).getPath() + webdav_path + WebdavUtils.encode(mNew.getRemotePath()));\r
- LocalMoveMethod move = new LocalMoveMethod(baseUrl + webdav_path + WebdavUtils.encode(mOld.getRemotePath()),\r
- Uri.parse(baseUrl).getPath() == null ? "" : Uri.parse(baseUrl).getPath() + webdav_path + WebdavUtils.encode(mNew.getRemotePath()));\r
+ Log.e("ASD", Uri.parse(baseUrl).getPath() == null ? "" : Uri.parse(baseUrl).getPath() + webdav_path + WebdavUtils.encodePath(mNew.getRemotePath()));\r
+ LocalMoveMethod move = new LocalMoveMethod(baseUrl + webdav_path + WebdavUtils.encodePath(mOld.getRemotePath()),\r
+ Uri.parse(baseUrl).getPath() == null ? "" : Uri.parse(baseUrl).getPath() + webdav_path + WebdavUtils.encodePath(mNew.getRemotePath()));\r
\r
try {\r
int status = wc.executeMethod(move);\r
String baseUrl = am.getUserData(mAccount, AccountAuthenticator.KEY_OC_BASE_URL);\r
OwnCloudVersion ocv = new OwnCloudVersion(am.getUserData(mAccount, AccountAuthenticator.KEY_OC_VERSION));\r
String webdav_path = AccountUtils.getWebdavPath(ocv);\r
- Log.d("ASD", ""+baseUrl + webdav_path + WebdavUtils.encode(mFileToRemove.getRemotePath()));\r
+ Log.d("ASD", ""+baseUrl + webdav_path + WebdavUtils.encodePath(mFileToRemove.getRemotePath()));\r
\r
- DeleteMethod delete = new DeleteMethod(baseUrl + webdav_path + WebdavUtils.encode(mFileToRemove.getRemotePath()));\r
+ DeleteMethod delete = new DeleteMethod(baseUrl + webdav_path + WebdavUtils.encodePath(mFileToRemove.getRemotePath()));\r
HttpMethodParams params = delete.getParams();\r
params.setSoTimeout(1000);\r
delete.setParams(params);\r
*/\r
public boolean downloadFile(String remoteFilepath, File targetPath) {\r
boolean ret = false;\r
- GetMethod get = new GetMethod(mUri.toString() + WebdavUtils.encode(remoteFilepath));\r
+ GetMethod get = new GetMethod(mUri.toString() + WebdavUtils.encodePath(remoteFilepath));\r
HttpMethodParams params = get.getParams();\r
params.setSoTimeout(0); // that means "infinite timeout"; it's the default value, but let's make it explicit\r
get.setParams(params);\r
* @return\r
*/\r
public boolean deleteFile(String remoteFilePath){\r
- DavMethod delete = new DeleteMethod(mUri.toString() + WebdavUtils.encode(remoteFilePath));\r
+ DavMethod delete = new DeleteMethod(mUri.toString() + WebdavUtils.encodePath(remoteFilePath));\r
try {\r
executeMethod(delete);\r
} catch (Throwable e) {\r
FileRequestEntity entity = new FileRequestEntity(f, contentType);\r
entity.setOnDatatransferProgressListener(mDataTransferListener);\r
Log.e("ASD", f.exists() + " " + entity.getContentLength());\r
- PutMethod put = new PutMethod(mUri.toString() + WebdavUtils.encode(remoteTarget));\r
+ PutMethod put = new PutMethod(mUri.toString() + WebdavUtils.encodePath(remoteTarget));\r
HttpMethodParams params = put.getParams();\r
params.setSoTimeout(0); // that means "infinite timeout"; it's the default value, but let's make it explicit\r
put.setParams(params);\r
*/\r
public boolean createDirectory(String path) {\r
try {\r
- MkColMethod mkcol = new MkColMethod(mUri.toString() + WebdavUtils.encode(path));\r
+ MkColMethod mkcol = new MkColMethod(mUri.toString() + WebdavUtils.encodePath(path));\r
int status = executeMethod(mkcol);\r
Log.d(TAG, "Status returned " + status);\r
Log.d(TAG, "uri: " + mkcol.getURI().toString());\r
* @param remoteFilePath Path
* @return Encoded path according to RFC 2396, always starting with "/"
*/
- public static String encode(String remoteFilePath) {
+ public static String encodePath(String remoteFilePath) {
String encodedPath = Uri.encode(remoteFilePath, "/");
if (!encodedPath.startsWith("/"))
encodedPath = "/" + encodedPath;