Skip to content

Commit

Permalink
style: refactor according to checkstyle
Browse files Browse the repository at this point in the history
  • Loading branch information
eprendre authored and gejiaheng committed May 21, 2017
1 parent 797948d commit ac28619
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,7 @@ public void dispatchCaptureIntent(Context context, int requestCode) {
File photoFile = null;
try {
photoFile = createImageFile();
}
catch (IOException e) {
} catch (IOException e) {
e.printStackTrace();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,18 +42,14 @@ public static String getPath(final Context context, final Uri uri) {
}

// TODO handle non-primary volumes
}
// DownloadsProvider
else if (isDownloadsDocument(uri)) {
} else if (isDownloadsDocument(uri)) { // DownloadsProvider

final String id = DocumentsContract.getDocumentId(uri);
final Uri contentUri = ContentUris.withAppendedId(
Uri.parse("content://downloads/public_downloads"), Long.valueOf(id));

return getDataColumn(context, contentUri, null, null);
}
// MediaProvider
else if (isMediaDocument(uri)) {
} else if (isMediaDocument(uri)) { // MediaProvider
final String docId = DocumentsContract.getDocumentId(uri);
final String[] split = docId.split(":");
final String type = split[0];
Expand All @@ -74,13 +70,9 @@ else if (isMediaDocument(uri)) {

return getDataColumn(context, contentUri, selection, selectionArgs);
}
}
// MediaStore (and general)
else if ("content".equalsIgnoreCase(uri.getScheme())) {
} else if ("content".equalsIgnoreCase(uri.getScheme())) { // MediaStore (and general)
return getDataColumn(context, uri, null, null);
}
// File
else if ("file".equalsIgnoreCase(uri.getScheme())) {
} else if ("file".equalsIgnoreCase(uri.getScheme())) { // File
return uri.getPath();
}

Expand Down Expand Up @@ -109,11 +101,10 @@ public static String getDataColumn(Context context, Uri uri, String selection,
try {
cursor = context.getContentResolver().query(uri, projection, selection, selectionArgs, null);
if (cursor != null && cursor.moveToFirst()) {
final int column_index = cursor.getColumnIndexOrThrow(column);
return cursor.getString(column_index);
final int columnIndex = cursor.getColumnIndexOrThrow(column);
return cursor.getString(columnIndex);
}
}
finally {
} finally {
if (cursor != null)
cursor.close();
}
Expand Down

0 comments on commit ac28619

Please sign in to comment.