aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSamuel Tardieu <sam@rfc1149.net>2014-01-24 09:49:43 +0100
committerSamuel Tardieu <sam@rfc1149.net>2014-01-24 09:49:43 +0100
commitb180e1bba2d5db3d1448d78b91e714a3418fee0b (patch)
treefeadf6f0f13c3b12f76f00476e3adea314cc5154
parent7552e307fb0fef1a1dd197a8d8bded697b467a11 (diff)
parent168df9fecb962db473d0e931523f628636c98a1e (diff)
downloadcgeo-b180e1bba2d5db3d1448d78b91e714a3418fee0b.zip
cgeo-b180e1bba2d5db3d1448d78b91e714a3418fee0b.tar.gz
cgeo-b180e1bba2d5db3d1448d78b91e714a3418fee0b.tar.bz2
Merge branch 'release' into upstream
-rw-r--r--main/res/values/changelog_release.xml6
-rw-r--r--main/src/cgeo/geocaching/ImageSelectActivity.java84
2 files changed, 50 insertions, 40 deletions
diff --git a/main/res/values/changelog_release.xml b/main/res/values/changelog_release.xml
index 599adc5..bf751ac 100644
--- a/main/res/values/changelog_release.xml
+++ b/main/res/values/changelog_release.xml
@@ -2,6 +2,12 @@
<resources>
<!-- changelog for the release branch -->
<string name="changelog_release" translatable="false">\n
+ <b>Next bugfix release</b>\n
+ <b>Bugfixes:</b>\n
+ · Twitter problem fixed\n
+ · Some phones wouldn\'t let c:geo add new pictures to logs\n
+ · ...
+ \n
<b>2014.01.22</b>\n
<b>Bugfixes:</b>\n
· Select log photo from alternate sources on Android 4.4\n
diff --git a/main/src/cgeo/geocaching/ImageSelectActivity.java b/main/src/cgeo/geocaching/ImageSelectActivity.java
index d6d32ec..766149c 100644
--- a/main/src/cgeo/geocaching/ImageSelectActivity.java
+++ b/main/src/cgeo/geocaching/ImageSelectActivity.java
@@ -227,51 +227,55 @@ public class ImageSelectActivity extends AbstractActivity {
return;
}
- final Uri selectedImage = data.getData();
- if (Build.VERSION.SDK_INT < VERSION_CODES.KITKAT) {
- String[] filePathColumn = { MediaColumns.DATA };
-
- Cursor cursor = null;
- try {
- cursor = getContentResolver().query(selectedImage, filePathColumn, null, null, null);
- if (cursor == null) {
+ // null is an acceptable result if the image has been placed in the imageUri file by the
+ // camera application.
+ if (data != null) {
+ final Uri selectedImage = data.getData();
+ if (Build.VERSION.SDK_INT < VERSION_CODES.KITKAT) {
+ String[] filePathColumn = { MediaColumns.DATA };
+
+ Cursor cursor = null;
+ try {
+ cursor = getContentResolver().query(selectedImage, filePathColumn, null, null, null);
+ if (cursor == null) {
+ showFailure();
+ return;
+ }
+ cursor.moveToFirst();
+
+ int columnIndex = cursor.getColumnIndex(filePathColumn[0]);
+ String filePath = cursor.getString(columnIndex);
+ if (StringUtils.isBlank(filePath)) {
+ showFailure();
+ return;
+ }
+ imageUri = Uri.parse(filePath);
+ } catch (Exception e) {
+ Log.e("ImageSelectActivity.onActivityResult", e);
showFailure();
- return;
+ } finally {
+ if (cursor != null) {
+ cursor.close();
+ }
}
- cursor.moveToFirst();
- int columnIndex = cursor.getColumnIndex(filePathColumn[0]);
- String filePath = cursor.getString(columnIndex);
- if (StringUtils.isBlank(filePath)) {
- showFailure();
- return;
- }
- imageUri = Uri.parse(filePath);
- } catch (Exception e) {
- Log.e("ImageSelectActivity.onActivityResult", e);
- showFailure();
- } finally {
- if (cursor != null) {
- cursor.close();
+ Log.d("SELECT IMAGE data = " + data.toString());
+ } else {
+ InputStream input = null;
+ OutputStream output = null;
+ try {
+ input = getContentResolver().openInputStream(selectedImage);
+ final File outputFile = ImageUtils.getOutputImageFile();
+ output = new FileOutputStream(outputFile);
+ LocalStorage.copy(input, output);
+ imageUri = Uri.fromFile(outputFile);
+ } catch (FileNotFoundException e) {
+ Log.e("ImageSelectActivity.onStartResult", e);
+ } finally {
+ IOUtils.closeQuietly(input);
+ IOUtils.closeQuietly(output);
}
}
-
- Log.d("SELECT IMAGE data = " + data.toString());
- } else {
- InputStream input = null;
- OutputStream output = null;
- try {
- input = getContentResolver().openInputStream(selectedImage);
- final File outputFile = ImageUtils.getOutputImageFile();
- output = new FileOutputStream(outputFile);
- LocalStorage.copy(input, output);
- imageUri = Uri.fromFile(outputFile);
- } catch (FileNotFoundException e) {
- Log.e("ImageSelectActivity.onStartResult", e);
- } finally {
- IOUtils.closeQuietly(input);
- IOUtils.closeQuietly(output);
- }
}
if (requestCode == SELECT_NEW_IMAGE) {