code: private void updateFromMatrix(boolean updateZoom, boolean updateRotation) {
          matrix.getValues(matrixValues);
          x = matrixValues[2];
          y = matrixValues[5];
          if (updateZoom) {
              zoom = (float) Math.hypot(matrixValues[1], matrixValues[4]);
          }
          if (updateRotation) {
              rotation = (float) Math.toDegrees(Math.atan2(matrixValues[3], matrixValues[4]));
          }
      }
docs: Applying state from current matrix.
  <p>
  Having matrix:
  <pre>
  | a  b  tx |
  A = | c  d  ty |
  | 0  0  1  |
  
  x = tx
  y = ty
  scale = sqrt(b^2+d^2)
  rotation = atan(c/d) = atan(-b/a)
  </pre>
  See <a href="http://stackoverflow.com/questions/4361242">here</a>.
  
  @param updateZoom Whether to extract zoom from matrix
  @param updateRotation Whether to extract rotation from matrix