Commit 0fc56bae authored by Stéphane Poinsart's avatar Stéphane Poinsart
Browse files

harmless cleanup : indent fix

parent c28d7a59
......@@ -12,29 +12,31 @@ import android.provider.MediaStore;
public class PathFromUri {
// based on Neil on stackoverflow : http://stackoverflow.com/a/28453016
// modified for more compatibility with different file managers
// i.e. : es explorer return a media:// path, gira returns a file:// path...
/**
* Gets the real path from file
*
* @param context
* @param contentUri
* @return path
*/
public static String getRealPathFromURI(Context context, Uri contentUri) {
String filePath=null;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
filePath=getPathForV19AndUp(context, contentUri);
}
if (filePath==null) {
filePath=getPathForPreV19(context, contentUri);
}
return filePath;
String filePath = null;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
filePath = getPathForV19AndUp(context, contentUri);
}
if (filePath == null) {
filePath = getPathForPreV19(context, contentUri);
}
return filePath;
}
/**
* Handles pre V19 uri's
*
* @param context
* @param contentUri
* @return
......@@ -63,6 +65,7 @@ public class PathFromUri {
/**
* Handles V19 and up uri's
*
* @param context
* @param contentUri
* @return path
......@@ -72,30 +75,29 @@ public class PathFromUri {
if (!DocumentsContract.isDocumentUri(context, contentUri)) {
return null;
}
String wholeID = DocumentsContract.getDocumentId(contentUri);
if (wholeID==null) {
return null;
}
String wholeID = DocumentsContract.getDocumentId(contentUri);
if (wholeID == null) {
return null;
}
// Split at colon, use second item in the array
String id = wholeID.split(":")[1];
String[] column = { MediaStore.Images.Media.DATA };
// Split at colon, use second item in the array
String id = wholeID.split(":")[1];
String[] column = { MediaStore.Images.Media.DATA };
// where id is equal to
String sel = MediaStore.Images.Media._ID + "=?";
Cursor cursor = context.getContentResolver().
query(MediaStore.Images.Media.EXTERNAL_CONTENT_URI,
column, sel, new String[]{ id }, null);
if (cursor==null)
return null;
// where id is equal to
String sel = MediaStore.Images.Media._ID + "=?";
Cursor cursor = context.getContentResolver().query(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, column, sel,
new String[] { id }, null);
if (cursor == null)
return null;
String filePath = "";
int columnIndex = cursor.getColumnIndex(column[0]);
if (cursor.moveToFirst()) {
filePath = cursor.getString(columnIndex);
}
String filePath = "";
int columnIndex = cursor.getColumnIndex(column[0]);
if (cursor.moveToFirst()) {
filePath = cursor.getString(columnIndex);
}
cursor.close();
return filePath;
cursor.close();
return filePath;
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment