Context handling made consistent
[pub/Android/ownCloud.git] / src / com / owncloud / android / files / services / FileDownloader.java
index 74e0db1..a07b082 100644 (file)
@@ -1,3 +1,21 @@
+/* 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
@@ -24,9 +42,7 @@ import android.app.PendingIntent;
 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
@@ -75,18 +91,6 @@ public class FileDownloader extends Service implements OnDatatransferProgressLis
     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
@@ -364,9 +368,7 @@ public class FileDownloader extends Service implements OnDatatransferProgressLis
         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