Exif { public void flipHorizontally() { int orientation; switch (getOrientation()) { case ExifInterface.ORIENTATION_FLIP_HORIZONTAL: orientation = ExifInterface.ORIENTATION_NORMAL; break; case ExifInterface.ORIENTATION_ROTATE_180: orientation = ExifInterface.ORIENTATION_FLIP_VERTICAL; break; case ExifInterface.ORIENTATION_FLIP_VERTICAL: orientation = ExifInterface.ORIENTATION_ROTATE_180; break; case ExifInterface.ORIENTATION_TRANSPOSE: orientation = ExifInterface.ORIENTATION_ROTATE_90; break; case ExifInterface.ORIENTATION_ROTATE_90: orientation = ExifInterface.ORIENTATION_TRANSPOSE; break; case ExifInterface.ORIENTATION_TRANSVERSE: orientation = ExifInterface.ORIENTATION_ROTATE_270; break; case ExifInterface.ORIENTATION_ROTATE_270: orientation = ExifInterface.ORIENTATION_TRANSVERSE; break; case ExifInterface.ORIENTATION_NORMAL: case ExifInterface.ORIENTATION_UNDEFINED: default: orientation = ExifInterface.ORIENTATION_FLIP_HORIZONTAL; break; } mExifInterface.setAttribute(ExifInterface.TAG_ORIENTATION, String.valueOf(orientation)); } Exif(File file);  Exif(String filePath);  Exif(InputStream is); private  Exif(ExifInterface exifInterface); void save(); @Override String toString(); int getWidth(); int getHeight(); @Nullable String getDescription(); void setDescription(@Nullable String description); int getRotation(); boolean isFlippedVertically(); boolean isFlippedHorizontally(); long getLastModifiedTimestamp(); long getTimestamp(); @Nullable Location getLocation(); void rotate(int degrees); void flipVertically(); void flipHorizontally(); void attachTimestamp(); void removeTimestamp(); void attachLocation(Location location); void removeLocation();  }
@Test public void flipHorizontally() { assertEquals(false, exif.isFlippedHorizontally()); exif.flipHorizontally(); assertEquals(true, exif.isFlippedHorizontally()); exif.flipHorizontally(); assertEquals(false, exif.isFlippedHorizontally()); }