Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public override IBinder OnBind(Intent intent)
- {
- throw new System.NotImplementedException();
- }
- public bool OnTouch(View v, MotionEvent e)
- {
- switch (e.Action)
- {
- case MotionEventActions.Up:
- closeFloatingView.Visibility = ViewStates.Gone;
- initialX = layoutParams.X;
- initialY = layoutParams.Y;
- if (initialX + v.Width / 2 <= centerX + CLOSING_THRESHOLD && initialX + v.Width / 2 >= centerX - CLOSING_THRESHOLD)
- if (initialY + v.Height / 2 <= centerY + CLOSING_THRESHOLD && initialY + v.Height / 2 >= centerY - CLOSING_THRESHOLD)
- {
- floatingView.Visibility = ViewStates.Gone;
- StopSelf();
- }
- return true;
- case MotionEventActions.Down:
- initialX = layoutParams.X;
- initialY = layoutParams.Y;
- initialTouchX = e.RawX;
- initialTouchY = e.RawY;
- return true;
- case MotionEventActions.Move:
- layoutParams.X = initialX + (int)(e.RawX - initialTouchX);
- layoutParams.Y = initialY + (int)(e.RawY - initialTouchY);
- closeFloatingView.Visibility = ViewStates.Visible;
- windowManager.UpdateViewLayout(floatingView, layoutParams);
- return true;
- }
- return false;
- }
Add Comment
Please, Sign In to add comment