Java Code Examples for android.widget.ImageView#getLeft()

The following examples show how to use android.widget.ImageView#getLeft() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PhotoViewAttacher.java    From android-project-wo2b with Apache License 2.0 5 votes vote down vote up
@Override
public final void onGlobalLayout() {
    ImageView imageView = getImageView();

    if (null != imageView) {
        if (mZoomEnabled) {
            final int top = imageView.getTop();
            final int right = imageView.getRight();
            final int bottom = imageView.getBottom();
            final int left = imageView.getLeft();

            /**
             * 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.getDrawable());

                // Update values as something has changed
                mIvTop = top;
                mIvRight = right;
                mIvBottom = bottom;
                mIvLeft = left;
            }
        } else {
            updateBaseMatrix(imageView.getDrawable());
        }
    }
}
 
Example 2
Source File: PhotoViewAttacher.java    From FanXin-based-HuanXin with GNU General Public License v2.0 5 votes vote down vote up
@Override
public final void onGlobalLayout() {
	ImageView imageView = getImageView();

	if (null != imageView && mZoomEnabled) {
		final int top = imageView.getTop();
		final int right = imageView.getRight();
		final int bottom = imageView.getBottom();
		final int left = imageView.getLeft();

		/**
		 * 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.getDrawable());

			// Update values as something has changed
			mIvTop = top;
			mIvRight = right;
			mIvBottom = bottom;
			mIvLeft = left;
		}
	}
}
 
Example 3
Source File: ImageViewScaler.java    From MultiView with Apache License 2.0 5 votes vote down vote up
@Override
public void onGlobalLayout() {
    ImageView imageView = getImageView();

    if (null != imageView) {
        if (mZoomEnabled) {
            final int top = imageView.getTop();
            final int right = imageView.getRight();
            final int bottom = imageView.getBottom();
            final int left = imageView.getLeft();

            /**
             * 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.getDrawable());

                // Update values as something has changed
                mIvTop = top;
                mIvRight = right;
                mIvBottom = bottom;
                mIvLeft = left;
            }
        } else {
            updateBaseMatrix(imageView.getDrawable());
        }
    }
}
 
Example 4
Source File: PhotoViewAttacher.java    From jmessage-android-uikit with MIT License 5 votes vote down vote up
@Override
public final void onGlobalLayout() {
	ImageView imageView = getImageView();

	if (null != imageView && mZoomEnabled) {
		final int top = imageView.getTop();
		final int right = imageView.getRight();
		final int bottom = imageView.getBottom();
		final int left = imageView.getLeft();

		/**
		 * 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.getDrawable());

			// Update values as something has changed
			mIvTop = top;
			mIvRight = right;
			mIvBottom = bottom;
			mIvLeft = left;
		}
	}
}
 
Example 5
Source File: CropPhotoViewAttacher.java    From ImageSelector with Apache License 2.0 5 votes vote down vote up
@Override
public void onGlobalLayout() {
 ImageView imageView = getImageView();

 if (null != imageView) {
  if (mZoomEnabled) {
   final int top = imageView.getTop();
   final int right = imageView.getRight();
   final int bottom = imageView.getBottom();
   final int left = imageView.getLeft();

   /**
	* 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.getDrawable());

	   // Update values as something has changed
	   mIvTop = top;
	   mIvRight = right;
	   mIvBottom = bottom;
	   mIvLeft = left;
   }
  } else {
   updateBaseMatrix(imageView.getDrawable());
  }
 }
}
 
Example 6
Source File: PhotoViewAttacher.java    From Favorite-Android-Client with Apache License 2.0 5 votes vote down vote up
@Override
public final void onGlobalLayout() {
    ImageView imageView = getImageView();

    if (null != imageView && mZoomEnabled) {
        final int top = imageView.getTop();
        final int right = imageView.getRight();
        final int bottom = imageView.getBottom();
        final int left = imageView.getLeft();

        /**
         * 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.getDrawable());

            // Update values as something has changed
            mIvTop = top;
            mIvRight = right;
            mIvBottom = bottom;
            mIvLeft = left;
        }
    }
}
 
Example 7
Source File: PhotoViewAttacher.java    From jmessage-android-uikit with MIT License 5 votes vote down vote up
@Override
public final void onGlobalLayout() {
	ImageView imageView = getImageView();

	if (null != imageView && mZoomEnabled) {
		final int top = imageView.getTop();
		final int right = imageView.getRight();
		final int bottom = imageView.getBottom();
		final int left = imageView.getLeft();

		/**
		 * 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.getDrawable());

			// Update values as something has changed
			mIvTop = top;
			mIvRight = right;
			mIvBottom = bottom;
			mIvLeft = left;
		}
	}
}
 
Example 8
Source File: PhotoViewAttacher.java    From LLApp with Apache License 2.0 5 votes vote down vote up
@Override
public final void onGlobalLayout() {
	ImageView imageView = getImageView();

	if (null != imageView && mZoomEnabled) {
		final int top = imageView.getTop();
		final int right = imageView.getRight();
		final int bottom = imageView.getBottom();
		final int left = imageView.getLeft();

		/**
		 * 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.getDrawable());

			// Update values as something has changed
			mIvTop = top;
			mIvRight = right;
			mIvBottom = bottom;
			mIvLeft = left;
		}
	}
}
 
Example 9
Source File: PhotoViewAttacher.java    From light-novel-library_Wenku8_Android with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void onGlobalLayout() {
    ImageView imageView = getImageView();

    if (null != imageView) {
        if (mZoomEnabled) {
            final int top = imageView.getTop();
            final int right = imageView.getRight();
            final int bottom = imageView.getBottom();
            final int left = imageView.getLeft();

            /**
             * 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.getDrawable());

                // Update values as something has changed
                mIvTop = top;
                mIvRight = right;
                mIvBottom = bottom;
                mIvLeft = left;
            }
        } else {
            updateBaseMatrix(imageView.getDrawable());
        }
    }
}
 
Example 10
Source File: PhotoViewAttacher.java    From iBeebo with GNU General Public License v3.0 5 votes vote down vote up
@Override
public final void onGlobalLayout() {
    ImageView imageView = getImageView();

    if (null != imageView && mZoomEnabled) {
        final int top = imageView.getTop();
        final int right = imageView.getRight();
        final int bottom = imageView.getBottom();
        final int left = imageView.getLeft();

        /**
         * 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.getDrawable());

            // Update values as something has changed
            mIvTop = top;
            mIvRight = right;
            mIvBottom = bottom;
            mIvLeft = left;
        }
    }
}
 
Example 11
Source File: PhotoViewAttacher.java    From RotatePhotoView with Apache License 2.0 5 votes vote down vote up
@Override
public void onGlobalLayout() {
    ImageView imageView = getImageView();

    if (null != imageView) {
        if (mZoomEnabled) {
            final int top = imageView.getTop();
            final int right = imageView.getRight();
            final int bottom = imageView.getBottom();
            final int left = imageView.getLeft();

            /**
             * 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.getDrawable());

                // Update values as something has changed
                mIvTop = top;
                mIvRight = right;
                mIvBottom = bottom;
                mIvLeft = left;
            }
        } else {
            updateBaseMatrix(imageView.getDrawable());
        }
    }
}
 
Example 12
Source File: RectIndicator.java    From ViewPagerHelper with Apache License 2.0 5 votes vote down vote up
@Override
protected void onLayout(boolean changed, int l, int t, int r, int b) {
    super.onLayout(changed, l, t, r, b);
    ImageView child = (ImageView) getChildAt(0);
    if (child != null) {
        float cl = child.getLeft();
        float ct = child.getTop();
        float cr = cl + child.getMeasuredWidth();
        float cb = ct + child.getMeasuredHeight();
        mRect.set(cl, ct, cr, cb);
        mMoveSize = mMargin + mRectWidth;
        moveToPosition(mViewPager.getCurrentItem());
    }
}
 
Example 13
Source File: CircleIndicator.java    From ViewPagerHelper with Apache License 2.0 5 votes vote down vote up
@Override
protected void onLayout(boolean changed, int l, int t, int r, int b) {
    super.onLayout(changed, l, t, r, b);

    ImageView child = (ImageView) getChildAt(0);
    if (child != null) {
        float cl;
        float cr;
        if (mType == CircleIndicatorType.CIRTORECT) {
            int offset = (mRectWidth - mSize) / 2;
            cl = child.getLeft() - offset;
            cr = cl + mRectWidth;
        } else {
            cl = child.getLeft();
            cr = cl + child.getMeasuredWidth();

        }
        float ct = child.getTop();

        float cb = ct + child.getMeasuredHeight();
        mRect.set(cl, ct, cr, cb);
        mMoveSize = mMargin + mSize;

        int currentItem = mViewPager.getCurrentItem();
        if (mType == CircleIndicatorType.SCALE) {
            if (currentItem % mCount == 0) {
                doScaleAnim(child, ANIM_OUT);
            }
        }

        moveToPosition(mViewPager.getCurrentItem());

    }
}
 
Example 14
Source File: PhotoViewAttacher.java    From UltimateAndroid with Apache License 2.0 5 votes vote down vote up
@Override
public void onGlobalLayout() {
    ImageView imageView = getImageView();

    if (null != imageView) {
        if (mZoomEnabled) {
            final int top = imageView.getTop();
            final int right = imageView.getRight();
            final int bottom = imageView.getBottom();
            final int left = imageView.getLeft();

            /**
             * 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.getDrawable());

                // Update values as something has changed
                mIvTop = top;
                mIvRight = right;
                mIvBottom = bottom;
                mIvLeft = left;
            }
        } else {
            updateBaseMatrix(imageView.getDrawable());
        }
    }
}
 
Example 15
Source File: MediaView.java    From Wiv with MIT License 5 votes vote down vote up
void layoutImage(int i, int left, int top, int right, int bottom) {
    final ImageView view = imageViews[i];
    if (view.getLeft() == left && view.getTop() == top && view.getRight() == right
            && view.getBottom() == bottom) {
        return;
    }

    view.layout(left, top, right, bottom);
}
 
Example 16
Source File: PhotoViewAttacher.java    From ZoomPreviewPicture with Apache License 2.0 5 votes vote down vote up
@Override
public void onGlobalLayout() {
    ImageView imageView = getImageView();

    if (null != imageView) {
        if (mZoomEnabled) {
            final int top = imageView.getTop();
            final int right = imageView.getRight();
            final int bottom = imageView.getBottom();
            final int left = imageView.getLeft();

            /**
             * 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.getDrawable());

                // Update values as something has changed
                mIvTop = top;
                mIvRight = right;
                mIvBottom = bottom;
                mIvLeft = left;
            }
        } else {
            updateBaseMatrix(imageView.getDrawable());
        }
    }
}
 
Example 17
Source File: PhotoViewAttacher.java    From Android with MIT License 5 votes vote down vote up
@Override
public void onGlobalLayout() {
    ImageView imageView = getImageView();

    if (null != imageView) {
        if (mZoomEnabled) {
            final int top = imageView.getTop();
            final int right = imageView.getRight();
            final int bottom = imageView.getBottom();
            final int left = imageView.getLeft();

            /**
             * 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.getDrawable());

                // Update values as something has changed
                mIvTop = top;
                mIvRight = right;
                mIvBottom = bottom;
                mIvLeft = left;
            }
        } else {
            updateBaseMatrix(imageView.getDrawable());
        }
    }
}
 
Example 18
Source File: MeJoystick.java    From Makeblock-App-For-Android with MIT License 5 votes vote down vote up
public void setEnable(Handler handler){
	mHandler = handler;
	if(view==null)return;
	bar = (ImageView) view.findViewById(R.id.joystickBar);
	initTop = bar.getTop();
	initLeft = bar.getLeft();
	bar.setOnTouchListener(this);
	return;
}
 
Example 19
Source File: PhotoViewAttacher.java    From zen4android with MIT License 5 votes vote down vote up
@Override
public final void onGlobalLayout() {
    ImageView imageView = getImageView();

    if (null != imageView && mZoomEnabled) {
        final int top = imageView.getTop();
        final int right = imageView.getRight();
        final int bottom = imageView.getBottom();
        final int left = imageView.getLeft();

        /**
         * 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.getDrawable());

            // Update values as something has changed
            mIvTop = top;
            mIvRight = right;
            mIvBottom = bottom;
            mIvLeft = left;
        }
    }
}
 
Example 20
Source File: PhotoViewAttacher.java    From imsdk-android with MIT License 5 votes vote down vote up
@Override
public void onGlobalLayout() {
    ImageView imageView = getImageView();

    if (null != imageView) {
        if (mZoomEnabled) {
            final int top = imageView.getTop();
            final int right = imageView.getRight();
            final int bottom = imageView.getBottom();
            final int left = imageView.getLeft();

            /**
             * 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.getDrawable());

                // Update values as something has changed
                mIvTop = top;
                mIvRight = right;
                mIvBottom = bottom;
                mIvLeft = left;
            }
        } else {
            updateBaseMatrix(imageView.getDrawable());
        }
    }
}