public void OnGlobalLayout()
{
ImageView imageView = GetImageView();
if (null != imageView) {
if (mZoomEnabled) {
int top = imageView.Top;
int right = imageView.Right;
int bottom = imageView.Bottom;
int left = imageView.Left;
/**
* We need to check whether the ImageView's bounds have changed.
* This would be easier if we targeted API 11+ as we could just use
* View.OnLayoutChangeListener. Instead we have to replicate the
* work, keeping track of the ImageView's bounds and then checking
* if the values change.
*/
if (top != mIvTop || bottom != mIvBottom || left != mIvLeft
|| right != mIvRight) {
// Update our base matrix, as the bounds have changed
UpdateBaseMatrix(imageView.Drawable);
// Update values as something has changed
mIvTop = top;
mIvRight = right;
mIvBottom = bottom;
mIvLeft = left;
}
} else {
UpdateBaseMatrix(imageView.Drawable);
}
}
}