Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
This repository was archived by the owner on Aug 31, 2021. It is now read-only.

Commit 731c89a

Browse filesBrowse files
committed
[[ Bug 22763 ]] Fix resizing mobilePickPhoto for API Level < 24
This patch ensures that calling mobilePickPhoto with width and height params works in older Android versions too. Previously, a constructor for "ExifInterface" was used, that was available in API 24+ (Android 7+). This patch checks the Android version of the device and uses a different constructor on Android < 7.
1 parent cd7d1b7 commit 731c89a
Copy full SHA for 731c89a

File tree

Expand file treeCollapse file tree

2 files changed

+11
-4
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+11
-4
lines changed

‎docs/notes/bugfix-22763.md

Copy file name to clipboard
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Ensure mobilePickPhoto with width and height params works on older Android versions

‎engine/src/java/com/runrev/android/Engine.java

Copy file name to clipboardExpand all lines: engine/src/java/com/runrev/android/Engine.java
+10-4Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2231,10 +2231,16 @@ else if (resultCode == Activity.RESULT_OK)
22312231
// scale to required max width/height
22322232
float t_width = t_bitmap.getWidth();
22332233
float t_height = t_bitmap.getHeight();
2234-
2235-
InputStream t_exif_in = ((LiveCodeActivity)getContext()).getContentResolver().openInputStream(t_photo_uri);
2236-
2237-
ExifInterface t_exif = new ExifInterface(t_exif_in);
2234+
2235+
ExifInterface t_exif;
2236+
// On Android 7+ (API 24+) use a content resolver
2237+
if (Build.VERSION.SDK_INT >= 24)
2238+
{
2239+
InputStream t_exif_in = ((LiveCodeActivity)getContext()).getContentResolver().openInputStream(t_photo_uri);
2240+
t_exif = new ExifInterface(t_exif_in);
2241+
}
2242+
else
2243+
t_exif = new ExifInterface(t_photo_uri.getPath());
22382244

22392245
int t_orientation = t_exif.getAttributeInt(ExifInterface.TAG_ORIENTATION,
22402246
ExifInterface.ORIENTATION_NORMAL);

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.