aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/eu/siacs
diff options
context:
space:
mode:
authorsteckbrief <steckbrief@chefmail.de>2016-03-12 21:22:44 +0100
committersteckbrief <steckbrief@chefmail.de>2016-03-12 21:22:44 +0100
commit340272ba841be12dcdf1317e183a45d8b46dce44 (patch)
tree4c4cf2121ccfdb1da3ab2825f6ee2de9132531be /src/main/java/eu/siacs
parent86afdc7aaff4ed6fa37e6d5fd9e5ffab20375f21 (diff)
parenta95d2d9134508ec694cb48db361f1fd4387d1827 (diff)
Merge remote-tracking branch 'remotes/origin/trz/rename' into trz/rebase
Diffstat (limited to 'src/main/java/eu/siacs')
-rw-r--r--src/main/java/eu/siacs/conversations/services/XmppConnectionService.java5
-rw-r--r--src/main/java/eu/siacs/conversations/ui/PublishProfilePictureActivity.java2
-rw-r--r--src/main/java/eu/siacs/conversations/utils/FileUtils.java15
3 files changed, 13 insertions, 9 deletions
diff --git a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java
index c9fbf297..f39460b3 100644
--- a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java
+++ b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java
@@ -47,7 +47,6 @@ import java.security.cert.CertificateException;
import java.security.cert.X509Certificate;
import java.util.ArrayList;
import java.util.Arrays;
-import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
@@ -63,7 +62,7 @@ import de.thedevstack.android.logcat.Logging;
import de.thedevstack.conversationsplus.ConversationsPlusApplication;
import de.thedevstack.conversationsplus.ConversationsPlusPreferences;
import de.thedevstack.conversationsplus.exceptions.FileCopyException;
-import de.thedevstack.conversationsplus.utils.FileHelper;
+import de.thedevstack.conversationsplus.utils.FileUtils;
import de.thedevstack.conversationsplus.utils.ImageUtil;
import de.thedevstack.conversationsplus.utils.MessageUtil;
import de.thedevstack.conversationsplus.utils.UiUpdateHelper;
@@ -402,7 +401,7 @@ public class XmppConnectionService extends Service implements OnPhoneContactsLoa
}
message.setCounterpart(conversation.getNextCounterpart());
message.setType(Message.TYPE_FILE);
- String path = FileHelper.getRealPathFromUri(uri);
+ String path = FileUtils.getPath(uri);
if (path != null) {
message.setRelativeFilePath(path);
MessageUtil.updateFileParams(message);
diff --git a/src/main/java/eu/siacs/conversations/ui/PublishProfilePictureActivity.java b/src/main/java/eu/siacs/conversations/ui/PublishProfilePictureActivity.java
index 8c10adf2..04868909 100644
--- a/src/main/java/eu/siacs/conversations/ui/PublishProfilePictureActivity.java
+++ b/src/main/java/eu/siacs/conversations/ui/PublishProfilePictureActivity.java
@@ -195,7 +195,7 @@ public class PublishProfilePictureActivity extends XmppActivity {
switch (requestCode) {
case REQUEST_CHOOSE_FILE_AND_CROP:
Uri source = data.getData();
- String original = FileUtils.getPath(this, source);
+ String original = FileUtils.getPath(source);
if (original != null) {
source = Uri.parse("file://"+original);
}
diff --git a/src/main/java/eu/siacs/conversations/utils/FileUtils.java b/src/main/java/eu/siacs/conversations/utils/FileUtils.java
index 967c9b41..b12c990b 100644
--- a/src/main/java/eu/siacs/conversations/utils/FileUtils.java
+++ b/src/main/java/eu/siacs/conversations/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
+ }
}