Example #1
0
        bool IsViewInBounds(AView view, int x, int y)
        {
            ARect outRect = new ARect();

            view.GetHitRect(outRect);

            return(x > outRect.Left && x < outRect.Right && y > outRect.Top && y < outRect.Bottom);
        }
        /// <summary>
        /// Determines whether the specified point is hit.
        /// </summary>
        /// <param name="view">The view.</param>
        /// <param name="point">The point.</param>
        /// <returns><c>true</c> if the specified point is hit; otherwise, <c>false</c>.</returns>
        public static bool IsHit(this Android.Views.View view, PointF point)
        {
            var r = new Rect();

            view.GetHitRect(r);

            var touch = new Rect((int)point.X, (int)point.Y, (int)point.X, (int)point.Y);

            return(r.Intersect(touch));
        }
		private Boolean isPinnedViewTouched(View view, float x, float y) {
			view.GetHitRect(mTouchRect);

			// by taping top or bottom padding, the list performs on click on a border item.
			// we don't add top padding here to keep behavior consistent.
			mTouchRect.Top += mTranslateY;

			mTouchRect.Bottom += mTranslateY + PaddingTop;
			mTouchRect.Left += PaddingLeft;
			mTouchRect.Right -= PaddingRight;
			return mTouchRect.Contains((int)x, (int)y);
		}
Example #4
0
        public static Animator CreateCircularReveal(View view, int centreX, int centreY, float startRadius,
            float endRadius)
        {
            var api = (int)Build.VERSION.SdkInt;

//            if (api >= 21)
//            {
//                return ViewAnimationUtils.CreateCircularReveal(view, centreX, centreY, startRadius, endRadius);
//            }

            var animator = view.Parent as IRevealAnimator;
            animator.CentreX = centreX;
            animator.CentreY = centreY;
            animator.Target = view;
            animator.ClipOutlines = true;

            var bounds = new Rect();
            view.GetHitRect(bounds);

            var reveal = ObjectAnimator.OfFloat((Object)animator, "Radius", startRadius, endRadius);
            reveal.SetDuration(300);
            reveal.SetInterpolator(new AccelerateDecelerateInterpolator()); 
            reveal.AddListener(CreateRevealFinishedListener(animator, bounds, api));

            return reveal;
        }