Skip to content

Commit f7c50e3

Browse files
committed
fix(Android): exifinterface unsupported image format file
1 parent f30198a commit f7c50e3

3 files changed

Lines changed: 25 additions & 10 deletions

File tree

‎tns-core-modules/image-asset/image-asset.android.ts‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -71,17 +71,17 @@ export class ImageAsset extends common.ImageAsset {
7171

7272
var calculateAngleFromFile = function (filename: string) {
7373
let rotationAngle = 0;
74-
const ei = new android.media.ExifInterface(filename);
75-
const orientation = ei.getAttributeInt(android.media.ExifInterface.TAG_ORIENTATION, android.media.ExifInterface.ORIENTATION_NORMAL);
74+
const ei = new android.support.media.ExifInterface(filename);
75+
const orientation = ei.getAttributeInt(android.support.media.ExifInterface.TAG_ORIENTATION, android.support.media.ExifInterface.ORIENTATION_NORMAL);
7676

7777
switch (orientation) {
78-
case android.media.ExifInterface.ORIENTATION_ROTATE_90:
78+
case android.support.media.ExifInterface.ORIENTATION_ROTATE_90:
7979
rotationAngle = 90;
8080
break;
81-
case android.media.ExifInterface.ORIENTATION_ROTATE_180:
81+
case android.support.media.ExifInterface.ORIENTATION_ROTATE_180:
8282
rotationAngle = 180;
8383
break;
84-
case android.media.ExifInterface.ORIENTATION_ROTATE_270:
84+
case android.support.media.ExifInterface.ORIENTATION_ROTATE_270:
8585
rotationAngle = 270;
8686
break;
8787
}

‎tns-core-modules/image-source/image-source.android.ts‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -79,17 +79,17 @@ export class ImageSource implements ImageSourceDefinition {
7979

8080
private setRotationAngleFromFile(filename: string) {
8181
this.rotationAngle = 0;
82-
const ei = new android.media.ExifInterface(filename);
83-
const orientation = ei.getAttributeInt(android.media.ExifInterface.TAG_ORIENTATION, android.media.ExifInterface.ORIENTATION_NORMAL);
82+
const ei = new android.support.media.ExifInterface(filename);
83+
const orientation = ei.getAttributeInt(android.support.media.ExifInterface.TAG_ORIENTATION, android.support.media.ExifInterface.ORIENTATION_NORMAL);
8484

8585
switch (orientation) {
86-
case android.media.ExifInterface.ORIENTATION_ROTATE_90:
86+
case android.support.media.ExifInterface.ORIENTATION_ROTATE_90:
8787
this.rotationAngle = 90;
8888
break;
89-
case android.media.ExifInterface.ORIENTATION_ROTATE_180:
89+
case android.support.media.ExifInterface.ORIENTATION_ROTATE_180:
9090
this.rotationAngle = 180;
9191
break;
92-
case android.media.ExifInterface.ORIENTATION_ROTATE_270:
92+
case android.support.media.ExifInterface.ORIENTATION_ROTATE_270:
9393
this.rotationAngle = 270;
9494
break;
9595
}

‎tns-core-modules/ui/frame/transition-definitions.android.d.ts‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,21 @@
44

55
// Definitions for Android API lvl 21 transitions
66
declare module android {
7+
export module support {
8+
export module media {
9+
export class ExifInterface {
10+
public static TAG_ORIENTATION: number;
11+
public static ORIENTATION_NORMAL: number;
12+
public static ORIENTATION_ROTATE_90: number;
13+
public static ORIENTATION_ROTATE_180: number;
14+
public static ORIENTATION_ROTATE_270: number;
15+
16+
constructor(filename?: string);
17+
18+
public getAttributeInt(attr: number, attr2: number): number;
19+
}
20+
}
21+
}
722
export module transition {
823
export abstract class Transition extends java.lang.Object {
924
addListener(transition: Transition.TransitionListener): Transition;

0 commit comments

Comments
 (0)