-->\r
<manifest package="eu.alefzero.owncloud"\r
android:versionCode="1"\r
- android:versionName="0.1.140B" xmlns:android="http://schemas.android.com/apk/res/android">\r
+ android:versionName="0.1.141B" 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
<string name="uploader_upload_succeed">Uploading completed successfully</string>
<string name="uploader_upload_failed">Upload failed: </string>
<string name="uploader_files_uploaded_suffix"> files uploaded</string>
+ <string name="downloader_download_failed">Download could not be completed</string>
<string name="common_choose_account">Choose account</string>
<string name="sync_string_contacts">Contacts</string>
<string name="use_ssl">Use Secure Connection</string>
\r
public class FileDownloader extends Service implements OnDatatransferProgressListener {\r
public static final String DOWNLOAD_FINISH_MESSAGE = "DOWNLOAD_FINISH";\r
+ public static final String BAD_DOWNLOAD_MESSAGE = "BAD_DOWNLOAD"; \r
public static final String EXTRA_ACCOUNT = "ACCOUNT";\r
public static final String EXTRA_FILE_PATH = "FILE_PATH";\r
public static final String EXTRA_REMOTE_PATH = "REMOTE_PATH";\r
\r
Log.e(TAG, file.getAbsolutePath() + " " + oc_url.toString());\r
Log.e(TAG, mFilePath+"");\r
+ String message;\r
if (wdc.downloadFile(mRemotePath, file)) {\r
ContentValues cv = new ContentValues();\r
cv.put(ProviderTableMeta.FILE_STORAGE_PATH, file.getAbsolutePath());\r
new String[] {\r
mFilePath.substring(mFilePath.lastIndexOf('/') + 1),\r
mAccount.name }); \r
+ message = DOWNLOAD_FINISH_MESSAGE;\r
+ } else {\r
+ message = BAD_DOWNLOAD_MESSAGE;\r
}\r
+ \r
mNotificationMngr.cancel(1);\r
- Intent end = new Intent(DOWNLOAD_FINISH_MESSAGE);\r
+ Intent end = new Intent(message);\r
end.putExtra(EXTRA_FILE_PATH, file.getAbsolutePath());\r
sendBroadcast(end);\r
}\r
message = getString(R.string.uploader_upload_failed);
if (mLocalPaths.length > 1)
message += " (" + mSuccessCounter + " / " + mLocalPaths.length + getString(R.string.uploader_files_uploaded_suffix) + ")";
- Toast.makeText(this, "Upload could not be completed", Toast.LENGTH_SHORT).show();
}
Toast.makeText(this, message, Toast.LENGTH_SHORT).show();
}
\r
Log.d(TAG, "syncing owncloud account " + account.name);\r
\r
- sendStickyBroadcast(true, -1); // starting message to the main IU\r
+ sendStickyBroadcast(true, -1); // starting message to UI\r
\r
PropFindMethod query;\r
try {\r
getStorageManager().removeFile(file);\r
}\r
\r
- // synched folder -> notice to main thread\r
+ // synched folder -> notice to IU\r
sendStickyBroadcast(true, parentId);\r
\r
// recursive fetch\r
case R.id.startSync: {\r
Bundle bundle = new Bundle();\r
bundle.putBoolean(ContentResolver.SYNC_EXTRAS_MANUAL, true);\r
- bundle.putString("PROBANDO", "PARAMETRO PASADO AL SYNC");\r
ContentResolver.requestSync(\r
AccountUtils.getCurrentOwnCloudAccount(this),\r
"org.owncloud", bundle);\r
private class DownloadFinishReceiver extends BroadcastReceiver {\r
@Override\r
public void onReceive(Context context, Intent intent) {\r
- ((OCFile)mIntent.getParcelableExtra(EXTRA_FILE)).setStoragePath(intent.getStringExtra(FileDownloader.EXTRA_FILE_PATH));\r
- updateFileDetails(mIntent);\r
+ if (intent.getAction().equals(FileDownloader.BAD_DOWNLOAD_MESSAGE)) {\r
+ Toast.makeText(context, R.string.downloader_download_failed , Toast.LENGTH_SHORT).show();\r
+ \r
+ } else if (intent.getAction().equals(FileDownloader.DOWNLOAD_FINISH_MESSAGE)) {\r
+ ((OCFile)mIntent.getParcelableExtra(EXTRA_FILE)).setStoragePath(intent.getStringExtra(FileDownloader.EXTRA_FILE_PATH));\r
+ updateFileDetails(mIntent);\r
+ }\r
}\r
\r
}\r