List of usage examples for android.media ExifInterface ORIENTATION_UNDEFINED
int ORIENTATION_UNDEFINED
To view the source code for android.media ExifInterface ORIENTATION_UNDEFINED.
Click Source Link
From source file:activities.PaintActivity.java
protected void onActivityResult(int requestCode, int resultCode, Intent data) { switch (requestCode) { case PaintUtility.CAMERA_PIC_REQUEST: case PaintUtility.LIBRARY_PIC_REQUEST: int orientation = ExifInterface.ORIENTATION_UNDEFINED; if (data != null) { orientation = data.getIntExtra(MediaStore.Images.ImageColumns.ORIENTATION, ExifInterface.ORIENTATION_UNDEFINED); }//from www .j a v a 2 s.c o m Uri imageUri = PaintUtility.getPhotoUri(this, requestCode, resultCode, data); this.painter.closedCamera(); if (imageUri != null) { this.painter.loadCompressedImage(imageUri, requestCode == PaintUtility.CAMERA_PIC_REQUEST, orientation); } setDefaultToolMode(); break; case RS_CODE_SHARE_FB: deleteTempImage(); FlurryAgent.logEvent(FLURRY_EV_SHARE_FB); break; case RS_CODE_SHARE_GMAIL: deleteTempImage(); FlurryAgent.logEvent(FLURRY_EV_SHARE_EMAIL); break; case RS_CODE_SHARE_TWITTER: deleteTempImage(); //en caso de que si haya compartido if (resultCode == -1) FlurryAgent.logEvent(FLURRY_EV_SHARE_TWITTER); break; } }
From source file:me.ccrama.redditslide.Views.SubsamplingScaleImageView.java
/** * Helper method for load tasks. Examines the EXIF info on the image file to determine the orientation. * This will only work for external files, not assets, resources or other URIs. *//* ww w . java 2 s . co m*/ private int getExifOrientation(String sourceUri) { int exifOrientation = ORIENTATION_0; if (sourceUri.startsWith(ContentResolver.SCHEME_CONTENT)) { try { final String[] columns = { MediaStore.Images.Media.ORIENTATION }; final Cursor cursor = getContext().getContentResolver().query(Uri.parse(sourceUri), columns, null, null, null); if (cursor != null) { if (cursor.moveToFirst()) { int orientation = cursor.getInt(0); if (VALID_ORIENTATIONS.contains(orientation) && orientation != ORIENTATION_USE_EXIF) { exifOrientation = orientation; } else { Log.w(TAG, "Unsupported orientation: " + orientation); } } cursor.close(); } } catch (Exception e) { Log.w(TAG, "Could not get orientation of image from media store"); } } else if (sourceUri.startsWith(ImageSource.FILE_SCHEME) && !sourceUri.startsWith(ImageSource.ASSET_SCHEME)) { try { ExifInterface exifInterface = new ExifInterface( sourceUri.substring(ImageSource.FILE_SCHEME.length() - 1)); int orientationAttr = exifInterface.getAttributeInt(ExifInterface.TAG_ORIENTATION, ExifInterface.ORIENTATION_NORMAL); if (orientationAttr == ExifInterface.ORIENTATION_NORMAL || orientationAttr == ExifInterface.ORIENTATION_UNDEFINED) { exifOrientation = ORIENTATION_0; } else if (orientationAttr == ExifInterface.ORIENTATION_ROTATE_90) { exifOrientation = ORIENTATION_90; } else if (orientationAttr == ExifInterface.ORIENTATION_ROTATE_180) { exifOrientation = ORIENTATION_180; } else if (orientationAttr == ExifInterface.ORIENTATION_ROTATE_270) { exifOrientation = ORIENTATION_270; } else { Log.w(TAG, "Unsupported EXIF orientation: " + orientationAttr); } } catch (Exception e) { Log.w(TAG, "Could not get EXIF orientation of image"); } } return exifOrientation; }