aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/de/thedevstack/conversationsplus/utils/FileUtils.java
diff options
context:
space:
mode:
authorsteckbrief <steckbrief@chefmail.de>2016-03-12 21:14:55 +0100
committersteckbrief <steckbrief@chefmail.de>2016-03-12 21:14:55 +0100
commita95d2d9134508ec694cb48db361f1fd4387d1827 (patch)
treeb54e1da9964a71b9ceb5bb3fd1d3cd6697883c3d /src/main/java/de/thedevstack/conversationsplus/utils/FileUtils.java
parent14c2c72bc1a00c8b9839047cdc73116e561ecd62 (diff)
Fixes FS#155: Check FileHelper vs. FileUtils
Diffstat (limited to 'src/main/java/de/thedevstack/conversationsplus/utils/FileUtils.java')
-rw-r--r--src/main/java/de/thedevstack/conversationsplus/utils/FileUtils.java15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/main/java/de/thedevstack/conversationsplus/utils/FileUtils.java b/src/main/java/de/thedevstack/conversationsplus/utils/FileUtils.java
index 9b627f6b..b556b72b 100644
--- a/src/main/java/de/thedevstack/conversationsplus/utils/FileUtils.java
+++ b/src/main/java/de/thedevstack/conversationsplus/utils/FileUtils.java
@@ -11,25 +11,26 @@ import android.os.Environment;
import android.provider.DocumentsContract;
import android.provider.MediaStore;
-public class FileUtils {
+import de.thedevstack.conversationsplus.ConversationsPlusApplication;
+
+public final class FileUtils {
/**
* Get a file path from a Uri. This will get the the path for Storage Access
* Framework Documents, as well as the _data field for the MediaStore and
* other file-based ContentProviders.
*
- * @param context The context.
* @param uri The Uri to query.
* @author paulburke
*/
@SuppressLint("NewApi")
- public static String getPath(final Context context, final Uri uri) {
+ public static String getPath(final Uri uri) {
if (uri == null) {
return null;
}
final boolean isKitKat = Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT;
-
+ final Context context = ConversationsPlusApplication.getAppContext();
// DocumentProvider
if (isKitKat && DocumentsContract.isDocumentUri(context, uri)) {
// ExternalStorageProvider
@@ -98,7 +99,7 @@ public class FileUtils {
* @param selectionArgs (Optional) Selection arguments used in the query.
* @return The value of the _data column, which is typically a file path.
*/
- public static String getDataColumn(Context context, Uri uri, String selection,
+ private static String getDataColumn(Context context, Uri uri, String selection,
String[] selectionArgs) {
Cursor cursor = null;
@@ -176,4 +177,8 @@ public class FileUtils {
filename.substring(secondToLastDotPosition + 1, lastDotPosition) : "";
return secondToLastPart;
}
+
+ private FileUtils() {
+ // Utility class - do not instantiate
+ }
}