package eu.alefzero.owncloud.files.services;\r
\r
import java.io.File;\r
+import java.io.IOException;\r
\r
import android.accounts.Account;\r
import android.accounts.AccountManager;\r
mNotification.contentView = new RemoteViews(getApplicationContext().getPackageName(), R.layout.progressbar_layout);\r
mNotification.contentView.setProgressBar(R.id.status_progress, 100, 0, mTotalDownloadSize == -1);\r
mNotification.contentView.setImageViewResource(R.id.status_icon, R.drawable.icon);\r
+ // dvelasco ; contentIntent MUST be assigned to avoid app crashes in versions previous to Android 4.x ;\r
+ // BUT an empty Intent is not a very elegant solution; something smart should happen when a user 'clicks' on a download in the notification bar\r
+ mNotification.contentIntent = PendingIntent.getActivity(getApplicationContext(), 0, new Intent(), PendingIntent.FLAG_UPDATE_CURRENT);\r
\r
mNotificationMngr.notify(1, mNotification);\r
\r
File sdCard = Environment.getExternalStorageDirectory();\r
- File dir = new File(sdCard.getAbsolutePath() + "/owncloud");\r
- dir.mkdirs();\r
- File file = new File(dir, mFilePath.replace('/', '.'));\r
+ File file = new File(sdCard.getAbsolutePath() + "/owncloud/" + mAccount.name + mFilePath);\r
+ try {\r
+ file.getParentFile().mkdirs();\r
+ file.createNewFile();\r
+ } catch (IOException e) {\r
+ e.printStackTrace();\r
+ }\r
\r
Log.e(TAG, file.getAbsolutePath() + " " + oc_url.toString());\r
Log.e(TAG, mFilePath+"");\r
}\r
mNotificationMngr.cancel(1);\r
Intent end = new Intent(DOWNLOAD_FINISH_MESSAGE);\r
+ end.putExtra(EXTRA_FILE_PATH, file.getAbsolutePath());\r
sendBroadcast(end);\r
}\r
\r