Code example for ShapeDrawable

Methods: getBounds

	public boolean onTouchEvent(MotionEvent event) {
		final Rect r = mBar.getBounds();
		final int newX = (int)event.getX();
		final int newY = (int)event.getY();
		final int coverBottom = Math.min(r.bottom, Math.max(, newY));
		final int coverRight = Math.min(r.right, Math.max(r.left, newX));
		final int action = event.getAction();
		// begin of touch event, check if touch was in range 
		if(MotionEvent.ACTION_DOWN == action) {
			mEmbraceTouch = (r.left <= newX && newX <= r.right);
		// we can ignore all further touch events 
		if(!mEmbraceTouch) {
			return false; 
Stop searching for code, let great code find you!  Add Codota to your java IDE