Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/news-android.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/helper/FileUtils.java')
-rw-r--r--News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/helper/FileUtils.java46
1 files changed, 45 insertions, 1 deletions
diff --git a/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/helper/FileUtils.java b/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/helper/FileUtils.java
index d329987c..cb230b35 100644
--- a/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/helper/FileUtils.java
+++ b/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/helper/FileUtils.java
@@ -21,6 +21,9 @@
package de.luhmer.owncloudnewsreader.helper;
+import android.content.Context;
+import android.os.Environment;
+
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
@@ -35,7 +38,7 @@ public class FileUtils {
* <br/>
* <i> Note: <code>fromFile</code> and <code>toFile</code> will be closed by
* this function.</i>
- *
+ *
* @param fromFile
* - FileInputStream for the file to copy from.
* @param toFile
@@ -60,4 +63,45 @@ public class FileUtils {
}
}
}
+
+
+
+
+
+ public static String getPath(Context context) {
+ String url;
+ Boolean isSDPresent = android.os.Environment.getExternalStorageState().equals(android.os.Environment.MEDIA_MOUNTED);
+ if(isSDPresent)
+ {
+ url = Environment.getExternalStorageDirectory().getAbsolutePath();
+ if (android.os.Build.DEVICE.contains("Samsung") || android.os.Build.MANUFACTURER.contains("Samsung")) {
+ url = url + "/external_sd";
+ }
+ //url = url + "/" + context.getString(R.string.app_name);
+ url = url + "/ownCloud News Reader";
+ }
+ else
+ url = context.getCacheDir().getAbsolutePath();
+
+ return url;
+ }
+
+
+
+
+ public static String getPathPodcasts(Context context)
+ {
+ return getPath(context) + "/podcasts";
+ }
+
+ public static String getPathFavIcons(Context context)
+ {
+ return getPath(context) + "/favIcons";
+ }
+
+ public static String getPathImageCache(Context context)
+ {
+ return getPath(context) + "/imgCache";
+ }
+
}