/** Set's the ImageView's ScaleType to Matrix. */
 private static void setImageViewScaleTypeMatrix(ImageView imageView) {
   /**
    * PhotoView sets it's own ScaleType to Matrix, then diverts all calls setScaleType to
    * this.setScaleType automatically.
    */
   if (null != imageView && !(imageView instanceof IPhotoView)) {
     if (!ScaleType.MATRIX.equals(imageView.getScaleType())) {
       imageView.setScaleType(ScaleType.MATRIX);
     }
   }
 }
  private void checkImageViewScaleType() {
    ImageView imageView = getImageView();

    /**
     * PhotoView's getScaleType() will just divert to this.getScaleType() so only call if we're not
     * attached to a PhotoView.
     */
    if (null != imageView && !(imageView instanceof IPhotoView)) {
      if (!ScaleType.MATRIX.equals(imageView.getScaleType())) {
        throw new IllegalStateException(
            "The ImageView's ScaleType has been changed since attaching a PhotoViewAttacher");
      }
    }
  }