+/* ownCloud Android client application\r
+ * Copyright (C) 2012 Bartek Przybylski\r
+ *\r
+ * This program is free software: you can redistribute it and/or modify\r
+ * it under the terms of the GNU General Public License as published by\r
+ * the Free Software Foundation, either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.\r
+ *\r
+ */\r
+\r
package com.owncloud.android.files.services;\r
\r
import java.io.File;\r
import android.app.Service;\r
import android.content.ContentValues;\r
import android.content.Intent;\r
-import android.net.Uri;\r
import android.os.Binder;\r
-import android.os.Environment;\r
import android.os.Handler;\r
import android.os.HandlerThread;\r
import android.os.IBinder;\r
private String buildRemoteName(Account account, OCFile file) {\r
return account.name + file.getRemotePath();\r
}\r
- \r
- public static final String getSavePath(String accountName) {\r
- File sdCard = Environment.getExternalStorageDirectory();\r
- return sdCard.getAbsolutePath() + "/owncloud/" + Uri.encode(accountName, "@"); \r
- // URL encoding is an 'easy fix' to overcome that NTFS and FAT32 don't allow ":" in file names, that can be in the accountName since 0.1.190B\r
- }\r
- \r
- public static final String getTemporalPath(String accountName) {\r
- File sdCard = Environment.getExternalStorageDirectory();\r
- return sdCard.getAbsolutePath() + "/owncloud/tmp/" + Uri.encode(accountName, "@");\r
- // URL encoding is an 'easy fix' to overcome that NTFS and FAT32 don't allow ":" in file names, that can be in the accountName since 0.1.190B\r
- }\r
\r
\r
/**\r
showDetailsIntent.putExtra(FileDetailFragment.EXTRA_FILE, download.getFile());\r
showDetailsIntent.putExtra(FileDetailFragment.EXTRA_ACCOUNT, download.getAccount());\r
showDetailsIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);\r
- mNotification.contentIntent = PendingIntent.getActivity(getApplicationContext(), 0, showDetailsIntent, PendingIntent.FLAG_UPDATE_CURRENT);\r
+ mNotification.contentIntent = PendingIntent.getActivity(getApplicationContext(), (int)System.currentTimeMillis(), showDetailsIntent, 0);\r
\r
mNotificationManager.notify(R.string.downloader_download_in_progress_ticker, mNotification);\r
}\r
Notification finalNotification = new Notification(R.drawable.icon, getString(tickerId), System.currentTimeMillis());\r
finalNotification.flags |= Notification.FLAG_AUTO_CANCEL;\r
// TODO put something smart in the contentIntent below\r
- finalNotification.contentIntent = PendingIntent.getActivity(getApplicationContext(), 0, new Intent(), PendingIntent.FLAG_UPDATE_CURRENT);\r
+ finalNotification.contentIntent = PendingIntent.getActivity(getApplicationContext(), (int)System.currentTimeMillis(), new Intent(), 0);\r
finalNotification.setLatestEventInfo(getApplicationContext(), getString(tickerId), String.format(getString(contentId), new File(download.getSavePath()).getName()), finalNotification.contentIntent);\r
mNotificationManager.notify(tickerId, finalNotification);\r
}\r
end.putExtra(EXTRA_DOWNLOAD_RESULT, downloadResult.isSuccess());\r
end.putExtra(ACCOUNT_NAME, download.getAccount().name);\r
end.putExtra(EXTRA_REMOTE_PATH, download.getRemotePath());\r
- if (downloadResult.isSuccess()) {\r
- end.putExtra(EXTRA_FILE_PATH, download.getSavePath());\r
- }\r
+ end.putExtra(EXTRA_FILE_PATH, download.getSavePath());\r
sendBroadcast(end);\r
}\r
\r