Example usage for android.media ExifInterface ORIENTATION_ROTATE_180

List of usage examples for android.media ExifInterface ORIENTATION_ROTATE_180

Introduction

In this page you can find the example usage for android.media ExifInterface ORIENTATION_ROTATE_180.

Prototype

int ORIENTATION_ROTATE_180

To view the source code for android.media ExifInterface ORIENTATION_ROTATE_180.

Click Source Link

Usage

From source file:com.haru.ui.image.workers.MediaProcessorThread.java

private String compressAndSaveImage(String fileImage, int scale) throws Exception {
    try {/*from w  ww.  ja v  a2s  . com*/
        ExifInterface exif = new ExifInterface(fileImage);
        String width = exif.getAttribute(ExifInterface.TAG_IMAGE_WIDTH);
        String length = exif.getAttribute(ExifInterface.TAG_IMAGE_LENGTH);
        int orientation = exif.getAttributeInt(ExifInterface.TAG_ORIENTATION, ExifInterface.ORIENTATION_NORMAL);
        int rotate = 0;
        if (/* TODO: DEBUG */ true) {
            Log.i(TAG, "Before: " + width + "x" + length);
        }

        switch (orientation) {
        case ExifInterface.ORIENTATION_ROTATE_270:
            rotate = -90;
            break;
        case ExifInterface.ORIENTATION_ROTATE_180:
            rotate = 180;
            break;
        case ExifInterface.ORIENTATION_ROTATE_90:
            rotate = 90;
            break;
        }

        int w = Integer.parseInt(width);
        int l = Integer.parseInt(length);

        int what = w > l ? w : l;

        Options options = new Options();
        if (what > 1500) {
            options.inSampleSize = scale * 4;
        } else if (what > 1000 && what <= 1500) {
            options.inSampleSize = scale * 3;
        } else if (what > 400 && what <= 1000) {
            options.inSampleSize = scale * 2;
        } else {
            options.inSampleSize = scale;
        }
        if (/* TODO: DEBUG */ true) {
            Log.i(TAG, "Scale: " + (what / options.inSampleSize));
            Log.i(TAG, "Rotate: " + rotate);
        }
        Bitmap bitmap = BitmapFactory.decodeFile(fileImage, options);
        File original = new File(fileImage);
        File file = new File((original.getParent() + File.separator
                + original.getName().replace(".", "_fact_" + scale + ".")));
        FileOutputStream stream = new FileOutputStream(file);
        if (rotate != 0) {
            Matrix matrix = new Matrix();
            matrix.setRotate(rotate);
            bitmap = Bitmap.createBitmap(bitmap, 0, 0, bitmap.getWidth(), bitmap.getHeight(), matrix, false);
        }
        bitmap.compress(Bitmap.CompressFormat.JPEG, 100, stream);

        if (/* TODO: DEBUG */ true) {
            ExifInterface exifAfter = new ExifInterface(file.getAbsolutePath());
            String widthAfter = exifAfter.getAttribute(ExifInterface.TAG_IMAGE_WIDTH);
            String lengthAfter = exifAfter.getAttribute(ExifInterface.TAG_IMAGE_LENGTH);
            if (/* TODO: DEBUG */ true) {
                Log.i(TAG, "After: " + widthAfter + "x" + lengthAfter);
            }
        }
        stream.flush();
        stream.close();
        return file.getAbsolutePath();

    } catch (IOException e) {
        e.printStackTrace();
        throw e;
    } catch (Exception e) {
        e.printStackTrace();
        throw new Exception("Corrupt or deleted file???");
    }
}

From source file:com.cars.manager.utils.imageChooser.threads.MediaProcessorThread.java

private String compressAndSaveImage(String fileImage, int scale) throws Exception {
    try {//w  w w . j av  a2  s.  co  m
        ExifInterface exif = new ExifInterface(fileImage);
        String width = exif.getAttribute(ExifInterface.TAG_IMAGE_WIDTH);
        String length = exif.getAttribute(ExifInterface.TAG_IMAGE_LENGTH);
        int orientation = exif.getAttributeInt(ExifInterface.TAG_ORIENTATION, ExifInterface.ORIENTATION_NORMAL);
        int rotate = 0;
        if (Config.DEBUG) {
            Log.i(TAG, "Before: " + width + "x" + length);
        }

        switch (orientation) {
        case ExifInterface.ORIENTATION_ROTATE_270:
            rotate = -90;
            break;
        case ExifInterface.ORIENTATION_ROTATE_180:
            rotate = 180;
            break;
        case ExifInterface.ORIENTATION_ROTATE_90:
            rotate = 90;
            break;
        }

        int w = Integer.parseInt(width);
        int l = Integer.parseInt(length);

        int what = w > l ? w : l;

        Options options = new Options();
        if (what > 1500) {
            options.inSampleSize = scale * 4;
        } else if (what > 1000 && what <= 1500) {
            options.inSampleSize = scale * 3;
        } else if (what > 400 && what <= 1000) {
            options.inSampleSize = scale * 2;
        } else {
            options.inSampleSize = scale;
        }
        if (Config.DEBUG) {
            Log.i(TAG, "Scale: " + (what / options.inSampleSize));
            Log.i(TAG, "Rotate: " + rotate);
        }
        Bitmap bitmap = BitmapFactory.decodeFile(fileImage, options);
        File original = new File(fileImage);
        File file = new File((original.getParent() + File.separator
                + original.getName().replace(".", "_fact_" + scale + ".")));
        FileOutputStream stream = new FileOutputStream(file);
        if (rotate != 0) {
            Matrix matrix = new Matrix();
            matrix.setRotate(rotate);
            bitmap = Bitmap.createBitmap(bitmap, 0, 0, bitmap.getWidth(), bitmap.getHeight(), matrix, false);
        }
        bitmap.compress(Bitmap.CompressFormat.JPEG, 100, stream);

        if (Config.DEBUG) {
            ExifInterface exifAfter = new ExifInterface(file.getAbsolutePath());
            String widthAfter = exifAfter.getAttribute(ExifInterface.TAG_IMAGE_WIDTH);
            String lengthAfter = exifAfter.getAttribute(ExifInterface.TAG_IMAGE_LENGTH);
            if (Config.DEBUG) {
                Log.i(TAG, "After: " + widthAfter + "x" + lengthAfter);
            }
        }
        stream.flush();
        stream.close();
        return file.getAbsolutePath();

    } catch (IOException e) {
        e.printStackTrace();
        throw e;
    } catch (Exception e) {
        e.printStackTrace();
        throw new Exception("Corrupt or deleted file???");
    }
}

From source file:com.wots.lutmaar.CustomView.imagechooser.threads.MediaProcessorThread.java

private String compressAndSaveImage(String fileImage, int scale) throws Exception {
    try {//from w  ww  . j  a v a 2s .  c o m
        ExifInterface exif = new ExifInterface(fileImage);
        String width = exif.getAttribute(ExifInterface.TAG_IMAGE_WIDTH);
        String length = exif.getAttribute(ExifInterface.TAG_IMAGE_LENGTH);
        int orientation = exif.getAttributeInt(ExifInterface.TAG_ORIENTATION, ExifInterface.ORIENTATION_NORMAL);
        int rotate = 0;
        if (BuildConfig.DEBUG) {
            Log.i(TAG, "Before: " + width + "x" + length);
        }

        switch (orientation) {
        case ExifInterface.ORIENTATION_ROTATE_270:
            rotate = -90;
            break;
        case ExifInterface.ORIENTATION_ROTATE_180:
            rotate = 180;
            break;
        case ExifInterface.ORIENTATION_ROTATE_90:
            rotate = 90;
            break;
        }

        int w = Integer.parseInt(width);
        int l = Integer.parseInt(length);

        int what = w > l ? w : l;

        Options options = new Options();
        if (what > 1500) {
            options.inSampleSize = scale * 4;
        } else if (what > 1000 && what <= 1500) {
            options.inSampleSize = scale * 3;
        } else if (what > 400 && what <= 1000) {
            options.inSampleSize = scale * 2;
        } else {
            options.inSampleSize = scale;
        }
        if (BuildConfig.DEBUG) {
            Log.i(TAG, "Scale: " + (what / options.inSampleSize));
            Log.i(TAG, "Rotate: " + rotate);
        }
        Bitmap bitmap = BitmapFactory.decodeFile(fileImage, options);
        File original = new File(fileImage);
        File file = new File((original.getParent() + File.separator
                + original.getName().replace(".", "_fact_" + scale + ".")));
        FileOutputStream stream = new FileOutputStream(file);
        if (rotate != 0) {
            Matrix matrix = new Matrix();
            matrix.setRotate(rotate);
            bitmap = Bitmap.createBitmap(bitmap, 0, 0, bitmap.getWidth(), bitmap.getHeight(), matrix, false);

        }
        /* if (scale == 1)
        bitmap = Bitmap.createScaledBitmap(bitmap, 240, 260, true);*/
        bitmap.compress(Bitmap.CompressFormat.JPEG, 100, stream);

        if (BuildConfig.DEBUG) {
            ExifInterface exifAfter = new ExifInterface(file.getAbsolutePath());
            String widthAfter = exifAfter.getAttribute(ExifInterface.TAG_IMAGE_WIDTH);
            String lengthAfter = exifAfter.getAttribute(ExifInterface.TAG_IMAGE_LENGTH);
            if (BuildConfig.DEBUG) {
                Log.i(TAG, "After: " + widthAfter + "x" + lengthAfter);
            }
        }
        stream.flush();
        stream.close();
        return file.getAbsolutePath();

    } catch (IOException e) {
        e.printStackTrace();
        throw e;
    } catch (Exception e) {
        e.printStackTrace();
        throw new Exception("Corrupt or deleted file???");
    }
}

From source file:com.amytech.android.library.views.imagechooser.threads.MediaProcessorThread.java

private String compressAndSaveImage(String fileImage, int scale) throws Exception {
    try {//from w  w w.  j ava  2s.  c  o m
        ExifInterface exif = new ExifInterface(fileImage);
        String width = exif.getAttribute(ExifInterface.TAG_IMAGE_WIDTH);
        String length = exif.getAttribute(ExifInterface.TAG_IMAGE_LENGTH);
        int orientation = exif.getAttributeInt(ExifInterface.TAG_ORIENTATION, ExifInterface.ORIENTATION_NORMAL);
        int rotate = 0;
        if (BuildConfig.DEBUG) {
            Log.i(TAG, "Before: " + width + "x" + length);
        }

        switch (orientation) {
        case ExifInterface.ORIENTATION_ROTATE_270:
            rotate = -90;
            break;
        case ExifInterface.ORIENTATION_ROTATE_180:
            rotate = 180;
            break;
        case ExifInterface.ORIENTATION_ROTATE_90:
            rotate = 90;
            break;
        }

        int w = Integer.parseInt(width);
        int l = Integer.parseInt(length);

        int what = w > l ? w : l;

        Options options = new Options();
        if (what > 1500) {
            options.inSampleSize = scale * 4;
        } else if (what > 1000 && what <= 1500) {
            options.inSampleSize = scale * 3;
        } else if (what > 400 && what <= 1000) {
            options.inSampleSize = scale * 2;
        } else {
            options.inSampleSize = scale;
        }
        if (BuildConfig.DEBUG) {
            Log.i(TAG, "Scale: " + (what / options.inSampleSize));
            Log.i(TAG, "Rotate: " + rotate);
        }
        Bitmap bitmap = BitmapFactory.decodeFile(fileImage, options);
        File original = new File(fileImage);
        File file = new File((original.getParent() + File.separator
                + original.getName().replace(".", "_fact_" + scale + ".")));
        FileOutputStream stream = new FileOutputStream(file);
        if (rotate != 0) {
            Matrix matrix = new Matrix();
            matrix.setRotate(rotate);
            bitmap = Bitmap.createBitmap(bitmap, 0, 0, bitmap.getWidth(), bitmap.getHeight(), matrix, false);
        }
        bitmap.compress(Bitmap.CompressFormat.JPEG, 100, stream);

        if (BuildConfig.DEBUG) {
            ExifInterface exifAfter = new ExifInterface(file.getAbsolutePath());
            String widthAfter = exifAfter.getAttribute(ExifInterface.TAG_IMAGE_WIDTH);
            String lengthAfter = exifAfter.getAttribute(ExifInterface.TAG_IMAGE_LENGTH);
            if (BuildConfig.DEBUG) {
                Log.i(TAG, "After: " + widthAfter + "x" + lengthAfter);
            }
        }
        stream.flush();
        stream.close();
        return file.getAbsolutePath();

    } catch (IOException e) {
        e.printStackTrace();
        throw e;
    } catch (Exception e) {
        e.printStackTrace();
        throw new Exception("Corrupt or deleted file???");
    }
}

From source file:com.pdftron.pdf.utils.ViewerUtils.java

public static Map readImageIntent(Intent data, Context context, Uri outputFileUri)
        throws FileNotFoundException, Exception {
    final boolean isCamera;
    if (data == null || data.getData() == null) {
        isCamera = true;/*from  w  w  w  .jav a2  s.  co  m*/
    } else {
        final String action = data.getAction();
        if (action == null) {
            isCamera = false;
        } else {
            isCamera = action.equals(MediaStore.ACTION_IMAGE_CAPTURE);
        }
    }

    Uri imageUri;
    if (isCamera) {
        imageUri = outputFileUri;
        AnalyticsHandlerAdapter.getInstance().sendEvent(AnalyticsHandlerAdapter.CATEGORY_FILEBROWSER,
                "Create new document from camera selected");
    } else {
        imageUri = data.getData();
        AnalyticsHandlerAdapter.getInstance().sendEvent(AnalyticsHandlerAdapter.CATEGORY_FILEBROWSER,
                "Create new document from local image file selected");
    }

    String filePath;
    if (isCamera) {
        filePath = imageUri.getPath();
    } else {
        filePath = Utils.getRealPathFromImageURI(context, imageUri);
        if (Utils.isNullOrEmpty(filePath)) {
            filePath = imageUri.getPath();
        }
    }

    // try to get bitmap
    Bitmap bitmap = Utils.getBitmapFromImageUri(context, imageUri, filePath);

    // if a file is selected, check if it is an image file
    if (!isCamera) {
        // if type is null
        if (context.getContentResolver().getType(imageUri) == null) {
            String extension = MimeTypeMap.getFileExtensionFromUrl(imageUri.getPath());
            final String[] extensions = { "jpeg", "jpg", "tiff", "tif", "gif", "png", "bmp" };

            // if file extension is not an image extension
            if (!Arrays.asList(extensions).contains(extension) && extension != null && !extension.equals("")) {
                throw new FileNotFoundException("file extension is not an image extension");
            }
            // if type is not an image
        } else if (!context.getContentResolver().getType(imageUri).startsWith("image/")) {
            throw new FileNotFoundException("type is not an image");
        }
    }

    //////////////////  Determine if image needs to be rotated   ///////////////////
    File imageFile = new File(imageUri.getPath());
    ExifInterface exif = new ExifInterface(imageFile.getAbsolutePath());
    int orientation = exif.getAttributeInt(ExifInterface.TAG_ORIENTATION, ExifInterface.ORIENTATION_UNDEFINED);

    int imageRotation = 0;
    switch (orientation) {
    case ExifInterface.ORIENTATION_ROTATE_270:
        imageRotation = 270;
        break;
    case ExifInterface.ORIENTATION_ROTATE_180:
        imageRotation = 180;
        break;
    case ExifInterface.ORIENTATION_ROTATE_90:
        imageRotation = 90;
        break;
    }

    // in some devices (mainly Samsung), the EXIF is not saved with the image so look at the content
    // resolver as a second source of the image's rotation
    if (imageRotation == 0) {
        String[] orientationColumn = { MediaStore.Images.Media.ORIENTATION };
        Cursor cur = context.getContentResolver().query(imageUri, orientationColumn, null, null, null);
        orientation = -1;
        if (cur != null && cur.moveToFirst()) {
            orientation = cur.getInt(cur.getColumnIndex(orientationColumn[0]));
        }

        if (orientation > 0) {
            imageRotation = orientation;
        }
    }

    if (imageRotation != 0) {
        Matrix matrix = new Matrix();
        matrix.postRotate(imageRotation);
        bitmap = Bitmap.createBitmap(bitmap, 0, 0, bitmap.getWidth(), bitmap.getHeight(), matrix, true);
    }

    Map<String, Object> output = new HashMap<>();
    output.put("bitmap", bitmap);
    output.put("uri", imageUri);
    output.put("path", filePath);
    output.put("camera", isCamera);
    return output;
}

From source file:ir.rasen.charsoo.controller.image_loader.core.decode.BaseImageDecoder.java

protected ExifInfo defineExifOrientation(String imageUri) {
    int rotation = 0;
    boolean flip = false;
    try {//  www .  j  a  v  a 2  s.co m
        ExifInterface exif = new ExifInterface(Scheme.FILE.crop(imageUri));
        int exifOrientation = exif.getAttributeInt(ExifInterface.TAG_ORIENTATION,
                ExifInterface.ORIENTATION_NORMAL);
        switch (exifOrientation) {
        case ExifInterface.ORIENTATION_FLIP_HORIZONTAL:
            flip = true;
        case ExifInterface.ORIENTATION_NORMAL:
            rotation = 0;
            break;
        case ExifInterface.ORIENTATION_TRANSVERSE:
            flip = true;
        case ExifInterface.ORIENTATION_ROTATE_90:
            rotation = 90;
            break;
        case ExifInterface.ORIENTATION_FLIP_VERTICAL:
            flip = true;
        case ExifInterface.ORIENTATION_ROTATE_180:
            rotation = 180;
            break;
        case ExifInterface.ORIENTATION_TRANSPOSE:
            flip = true;
        case ExifInterface.ORIENTATION_ROTATE_270:
            rotation = 270;
            break;
        }
    } catch (IOException e) {
        L.w("Can't read EXIF tags from file [%s]", imageUri);
    }
    return new ExifInfo(rotation, flip);
}

From source file:kr.wdream.ui.Components.AvatarUpdater.java

public void onActivityResult(int requestCode, int resultCode, Intent data) {
    if (resultCode == Activity.RESULT_OK) {
        if (requestCode == 13) {
            PhotoViewer.getInstance().setParentActivity(parentFragment.getParentActivity());
            int orientation = 0;
            try {
                ExifInterface ei = new ExifInterface(currentPicturePath);
                int exif = ei.getAttributeInt(ExifInterface.TAG_ORIENTATION, ExifInterface.ORIENTATION_NORMAL);
                switch (exif) {
                case ExifInterface.ORIENTATION_ROTATE_90:
                    orientation = 90;//from  w ww  . j a v  a 2  s .c o  m
                    break;
                case ExifInterface.ORIENTATION_ROTATE_180:
                    orientation = 180;
                    break;
                case ExifInterface.ORIENTATION_ROTATE_270:
                    orientation = 270;
                    break;
                }
            } catch (Exception e) {
                FileLog.e("tmessages", e);
            }
            final ArrayList<Object> arrayList = new ArrayList<>();
            arrayList.add(new MediaController.PhotoEntry(0, 0, 0, currentPicturePath, orientation, false));
            PhotoViewer.getInstance().openPhotoForSelect(arrayList, 0, 1,
                    new PhotoViewer.EmptyPhotoViewerProvider() {
                        @Override
                        public void sendButtonPressed(int index) {
                            String path = null;
                            MediaController.PhotoEntry photoEntry = (MediaController.PhotoEntry) arrayList
                                    .get(0);
                            if (photoEntry.imagePath != null) {
                                path = photoEntry.imagePath;
                            } else if (photoEntry.path != null) {
                                path = photoEntry.path;
                            }
                            Bitmap bitmap = ImageLoader.loadBitmap(path, null, 800, 800, true);
                            processBitmap(bitmap);
                        }

                        @Override
                        public boolean allowCaption() {
                            return false;
                        }
                    }, null);
            AndroidUtilities.addMediaToGallery(currentPicturePath);
            currentPicturePath = null;
        } else if (requestCode == 14) {
            if (data == null || data.getData() == null) {
                return;
            }
            startCrop(null, data.getData());
        }
    }
}

From source file:com.cpjd.roblu.ui.images.ImageGalleryActivity.java

/**
 * Receives the picture that was taken by the user
 * @param requestCode the request code of the child activity
 * @param resultCode the result code of the child activity
 * @param data the picture that was taken
 *///from  w w w. j  a  v  a  2s  . co  m
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    if (requestCode == Constants.GENERAL && resultCode == FragmentActivity.RESULT_OK) {
        // fetch file from storage
        Bitmap bitmap = BitmapFactory.decodeFile(tempPictureFile.getPath());
        // fix rotation
        try {
            ExifInterface ei = new ExifInterface(tempPictureFile.getPath());
            int orientation = ei.getAttributeInt(ExifInterface.TAG_ORIENTATION,
                    ExifInterface.ORIENTATION_UNDEFINED);

            switch (orientation) {
            case ExifInterface.ORIENTATION_ROTATE_90:
                bitmap = rotateImage(bitmap, 90);
                break;
            case ExifInterface.ORIENTATION_ROTATE_180:
                bitmap = rotateImage(bitmap, 180);
                break;
            case ExifInterface.ORIENTATION_ROTATE_270:
                bitmap = rotateImage(bitmap, 270);
                break;
            default:
                break;
            }
        } catch (IOException e) {
            Log.d("RBS", "Failed to remove EXIF rotation data from the picture.");
        }

        /*
         * Convert the image into a byte[] and save it to the gallery
         */

        // Convert the bitmap to a byte array
        ByteArrayOutputStream stream = new ByteArrayOutputStream();
        bitmap.compress(Bitmap.CompressFormat.JPEG, 30, stream);
        byte[] array = stream.toByteArray();

        int newID = new IO(getApplicationContext()).savePicture(eventID, array);

        // Add the image to the current array
        if (IMAGES == null)
            IMAGES = new ArrayList<>();
        IMAGES.add(array);

        // save the ID to the gallery
        for (int i = 0; i < TeamViewer.team.getTabs().get(rTabIndex).getMetrics().size(); i++) {
            if (TeamViewer.team.getTabs().get(rTabIndex).getMetrics().get(i).getID() == galleryID) {
                if (((RGallery) TeamViewer.team.getTabs().get(rTabIndex).getMetrics().get(i))
                        .getPictureIDs() == null) {
                    ((RGallery) TeamViewer.team.getTabs().get(rTabIndex).getMetrics().get(i))
                            .setPictureIDs(new ArrayList<Integer>());
                }
                ((RGallery) TeamViewer.team.getTabs().get(rTabIndex).getMetrics().get(i)).getPictureIDs()
                        .add(newID);
                break;
            }
        }
        TeamViewer.team.setLastEdit(System.currentTimeMillis());

        new IO(getApplicationContext()).saveTeam(eventID, TeamViewer.team);
        imageGalleryAdapter.notifyDataSetChanged();
    }
    /*
     * User edited an image
     */
    else if (resultCode == Constants.IMAGE_EDITED) {
        TeamViewer.team.setLastEdit(System.currentTimeMillis());

        /*
         * Update the image in the gallery
         */
        for (int i = 0; i < TeamViewer.team.getTabs().get(rTabIndex).getMetrics().size(); i++) {
            if (TeamViewer.team.getTabs().get(rTabIndex).getMetrics().get(i).getID() == galleryID) {
                if (((RGallery) TeamViewer.team.getTabs().get(rTabIndex).getMetrics().get(i))
                        .getPictureIDs() == null) {
                    ((RGallery) TeamViewer.team.getTabs().get(rTabIndex).getMetrics().get(i))
                            .setPictureIDs(new ArrayList<Integer>());
                }
                ((RGallery) TeamViewer.team.getTabs().get(rTabIndex).getMetrics().get(i)).getPictureIDs()
                        .add(new IO(getApplicationContext()).savePicture(eventID,
                                IMAGES.get(data.getIntExtra("position", 0))));
                break;
            }
        }

        new IO(getApplicationContext()).saveTeam(eventID, TeamViewer.team);
        imageGalleryAdapter.notifyDataSetChanged();
    }
    /*
     * User deleted an image
     */
    else if (resultCode == Constants.IMAGE_DELETED) {
        // Remove the image from the gallery ID list
        for (int i = 0; i < TeamViewer.team.getTabs().get(rTabIndex).getMetrics().size(); i++) {
            if (TeamViewer.team.getTabs().get(rTabIndex).getMetrics().get(i).getID() == galleryID) {
                int pictureID = ((RGallery) TeamViewer.team.getTabs().get(rTabIndex).getMetrics().get(i))
                        .getPictureIDs().remove(data.getIntExtra("position", 0));
                // delete from file system
                new IO(getApplicationContext()).deletePicture(eventID, pictureID);
                break;
            }
        }

        IMAGES.remove(data.getIntExtra("position", 0));
        imageGalleryAdapter.notifyDataSetChanged();

        TeamViewer.team.setLastEdit(System.currentTimeMillis());

        new IO(getApplicationContext()).saveTeam(eventID, TeamViewer.team);
    }
}

From source file:com.daiv.android.twitter.services.SendTweet.java

public static Bitmap rotateBitmap(Bitmap bitmap, int orientation) {

    Log.v("Test_composing_image", "rotation: " + orientation);

    try {//  w ww.  ja v a 2  s  .c om
        Matrix matrix = new Matrix();
        switch (orientation) {
        case ExifInterface.ORIENTATION_NORMAL:
            return bitmap;
        case ExifInterface.ORIENTATION_FLIP_HORIZONTAL:
            matrix.setScale(-1, 1);
            break;
        case ExifInterface.ORIENTATION_ROTATE_180:
            matrix.setRotate(180);
            break;
        case ExifInterface.ORIENTATION_FLIP_VERTICAL:
            matrix.setRotate(180);
            matrix.postScale(-1, 1);
            break;
        case ExifInterface.ORIENTATION_TRANSPOSE:
            matrix.setRotate(90);
            matrix.postScale(-1, 1);
            break;
        case ExifInterface.ORIENTATION_ROTATE_90:
            matrix.setRotate(90);
            break;
        case ExifInterface.ORIENTATION_TRANSVERSE:
            matrix.setRotate(-90);
            matrix.postScale(-1, 1);
            break;
        case ExifInterface.ORIENTATION_ROTATE_270:
            matrix.setRotate(-90);
            break;
        default:
            return bitmap;
        }
        try {
            Bitmap bmRotated = Bitmap.createBitmap(bitmap, 0, 0, bitmap.getWidth(), bitmap.getHeight(), matrix,
                    true);
            bitmap.recycle();
            return bmRotated;
        } catch (OutOfMemoryError e) {
            e.printStackTrace();
            return null;
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
    return bitmap;
}

From source file:com.almalence.opencam.PluginManagerBase.java

protected PluginManagerBase() {
    pluginList = new Hashtable<String, Plugin>();
    processingPluginList = new HashMap<Long, Plugin>();

    sharedMemory = new Hashtable<String, String>();

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP)
        createRAWCaptureResultHashtable();

    activeVF = new ArrayList<String>();
    // activeFilter = new ArrayList<String>();

    listVF = new ArrayList<Plugin>();
    listCapture = new ArrayList<Plugin>();
    listProcessing = new ArrayList<Plugin>();
    // listFilter = new ArrayList<Plugin>();
    listExport = new ArrayList<Plugin>();

    createPlugins();/*  w ww  .ja v  a2 s.c o m*/

    // parsing configuration file to setup modes
    parseConfig();

    exifOrientationMap = new HashMap<Integer, Integer>() {
        {
            put(0, ExifInterface.ORIENTATION_NORMAL);
            put(90, ExifInterface.ORIENTATION_ROTATE_90);
            put(180, ExifInterface.ORIENTATION_ROTATE_180);
            put(270, ExifInterface.ORIENTATION_ROTATE_270);
        }
    };
}