Inheritance: java.lang.Object, android.os.Parcelable
コード例 #1
0
ファイル: XobotWindow.cs プロジェクト: hakeemsm/XobotOS
		public override bool superDispatchTrackballEvent (MotionEvent @event)
		{
			throw new NotImplementedException ();
		}
コード例 #2
0
ファイル: XobotWindow.cs プロジェクト: hakeemsm/XobotOS
		public override bool superDispatchGenericMotionEvent (MotionEvent @event)
		{
			throw new NotImplementedException ();
		}
コード例 #3
0
ファイル: Touch.cs プロジェクト: hakeemsm/XobotOS
		/// <summary>Handles touch events for dragging.</summary>
		/// <remarks>
		/// Handles touch events for dragging.  You may want to do other actions
		/// like moving the cursor on touch as well.
		/// </remarks>
		public static bool onTouchEvent (TextView widget, Spannable buffer, MotionEvent @event)
		{
			DragState[] ds;
			switch (@event.getActionMasked ()) {
			case MotionEvent.ACTION_DOWN:
				{
					ds = buffer.getSpans<DragState> (0, buffer.Length);
					{
						for (int i = 0; i < ds.Length; i++) {
							buffer.removeSpan (ds [i]);
						}
					}
					buffer.setSpan (new DragState (@event.getX (), @event.getY (), widget.getScrollX (), widget.getScrollY ()), 0, 0, SpannedClass.SPAN_MARK_MARK);
					return true;
				}

			case MotionEvent.ACTION_UP:
				{
					ds = buffer.getSpans<DragState> (0, buffer.Length);
					{
						for (int i_1 = 0; i_1 < ds.Length; i_1++) {
							buffer.removeSpan (ds [i_1]);
						}
					}
					if (ds.Length > 0 && ds [0].mUsed) {
						return true;
					} else {
						return false;
					}
					goto case MotionEvent.ACTION_MOVE;
				}

			case android.view.MotionEvent.ACTION_MOVE:
				{
					ds = buffer.getSpans<Touch.DragState> (0, buffer.Length);
					if (ds.Length > 0) {
						if (ds [0].mFarEnough == false) {
							int slop = ViewConfiguration.get (widget.getContext ()).getScaledTouchSlop ();
							if (Math.Abs (@event.getX () - ds [0].mX) >= slop || Math.Abs (@event.getY () - ds [0].mY) >= slop) {
								ds [0].mFarEnough = true;
							}
						}
						if (ds [0].mFarEnough) {
							ds [0].mUsed = true;
							bool cap = (@event.getMetaState () & KeyEvent.META_SHIFT_ON) != 0 ||
								MetaKeyKeyListener.getMetaState (buffer, MetaKeyKeyListener.META_SHIFT_ON) == 1 ||
								MetaKeyKeyListener.getMetaState (buffer, MetaKeyKeyListener.META_SELECTING) != 0;
							float dx;
							float dy;
							if (cap) {
								// if we're selecting, we want the scroll to go in
								// the direction of the drag
								dx = @event.getX () - ds [0].mX;
								dy = @event.getY () - ds [0].mY;
							} else {
								dx = ds [0].mX - @event.getX ();
								dy = ds [0].mY - @event.getY ();
							}
							ds [0].mX = @event.getX ();
							ds [0].mY = @event.getY ();
							int nx = widget.getScrollX () + (int)dx;
							int ny = widget.getScrollY () + (int)dy;
							int padding = widget.getTotalPaddingTop () + widget.getTotalPaddingBottom ();
							Layout layout = widget.getLayout ();
							ny = Math.Min (ny, layout.getHeight () - (widget.getHeight () - padding));
							ny = Math.Max (ny, 0);
							int oldX = widget.getScrollX ();
							int oldY = widget.getScrollY ();
							scrollTo (widget, layout, nx, ny);
							// If we actually scrolled, then cancel the up action.
							if (oldX != widget.getScrollX () || oldY != widget.getScrollY ()) {
								widget.cancelLongPress ();
							}
							return true;
						}
					}
					return false;
				}
			}
			return false;
		}
コード例 #4
0
ファイル: XobotWindow.cs プロジェクト: hakeemsm/XobotOS
		public override bool superDispatchTouchEvent (MotionEvent @event)
		{
			return view.dispatchTouchEvent (@event);
		}
コード例 #5
0
ファイル: View.cs プロジェクト: exaphaser/JSC-Cross-Compiler
 public virtual bool onTouchEvent(MotionEvent @event)
 {
     throw null;
 }
コード例 #6
0
        public override bool onTouchEvent(MotionEvent @event)
        {
            //           assembly: Y:\staging\clr\PopupWebView.AndroidActivity.dll
            //           type: PopupWebView.Library.XWindow, PopupWebView.AndroidActivity, Version = 1.0.0.0, Culture = neutral, PublicKeyToken = null
            //offset:
            //           0x0083
            // method: Boolean onInterceptTouchEvent(android.view.MotionEvent) }
            //       script: error JSC1000: Java : unable to emit and at 'PopupWebView.Library.XWindow.onInterceptTouchEvent'#0085: multiple stack entries instead of one

            // handle touching outside
            if (@event.getAction() == MotionEvent.ACTION_OUTSIDE)
            {
                // unfocus window
                if (mContext.getFocusedWindow() == this)
                {
                    mContext.unfocus(this);
                }

                // notify implementation that ACTION_OUTSIDE occurred
                mContext.onTouchBody(id, this, this, @event);
            }

            // handle multitouch
            if (@event.getPointerCount() >= 2
                    && XUtils.isSet(flags,
                            XStandOutFlags.FLAG_WINDOW_PINCH_RESIZE_ENABLE))
            {
                // 2 fingers or more

                float x0 = @event.getX(0);
                float y0 = @event.getY(0);
                float x1 = @event.getX(1);
                float y1 = @event.getY(1);

                double dist = System.Math
                        .Sqrt(System.Math.Pow(x0 - x1, 2) + System.Math.Pow(y0 - y1, 2));

                if ((@event.getAction() & MotionEvent.ACTION_MASK) == MotionEvent.ACTION_MOVE)
                {
                    if (touchInfo.dist == -1)
                    {
                        touchInfo.dist = dist;
                    }
                    touchInfo.scale *= dist / touchInfo.dist;
                    touchInfo.dist = dist;

                    // scale the window with anchor point set to middle
                    edit().setAnchorPoint(.5f, .5f)
                            .setSize(
                                    (int)(touchInfo.firstWidth * touchInfo.scale),
                                    (int)(touchInfo.firstHeight * touchInfo.scale))
                            .commit();
                }
                mContext.onResize(id, this, this, @event);
            }

            return true;
        }
コード例 #7
0
        public virtual bool onTouchHandleResize(int id, XWindow window, View view, MotionEvent @event)
        {
            StandOutLayoutParams @params = (StandOutLayoutParams)window
                .getLayoutParams();

            if (@event.getAction() == MotionEvent.ACTION_DOWN)
            {
                window.touchInfo.lastX = (int)@event.getRawX();
                window.touchInfo.lastY = (int)@event.getRawY();

                window.touchInfo.firstX = window.touchInfo.lastX;
                window.touchInfo.firstY = window.touchInfo.lastY;
            }
            else
                if (@event.getAction() == MotionEvent.ACTION_MOVE)
                {
                    int deltaX = (int)@event.getRawX() - window.touchInfo.lastX;
                    int deltaY = (int)@event.getRawY() - window.touchInfo.lastY;

                    // update the size of the window
                    @params.width += deltaX;
                    @params.height += deltaY;

                    // keep window between min/max width/height
                    if (@params.width >= @params.minWidth
                            && @params.width <= @params.maxWidth)
                    {
                        window.touchInfo.lastX = (int)@event.getRawX();
                    }

                    if (@params.height >= @params.minHeight
                            && @params.height <= @params.maxHeight)
                    {
                        window.touchInfo.lastY = (int)@event.getRawY();
                    }

                    window.edit().setSize(@params.width, @params.height).commit();
                }

            onResize(id, window, view, @event);

            return true;
        }
コード例 #8
0
        public override bool dispatchTouchEvent(MotionEvent @event)
        {
            // never fired? why the duck?
            ondispatchTouchEvent(@event);


            return true;
        }
コード例 #9
0
 public virtual bool onTouchBody(int arg0, XWindow arg1, View arg2, MotionEvent arg3)
 {
     return false;
 }
コード例 #10
0
        public virtual bool onTouchHandleMove(int id, XWindow window, View view, MotionEvent @event)
        {
            var @params = (StandOutLayoutParams)window.getLayoutParams();

            // how much you have to move in either direction in order for the
            // gesture to be a move and not tap

            int totalDeltaX = window.touchInfo.lastX - window.touchInfo.firstX;
            int totalDeltaY = window.touchInfo.lastY - window.touchInfo.firstY;

            if (@event.getAction() == MotionEvent.ACTION_DOWN)
            {
                window.touchInfo.lastX = (int)@event.getRawX();
                window.touchInfo.lastY = (int)@event.getRawY();

                window.touchInfo.firstX = window.touchInfo.lastX;
                window.touchInfo.firstY = window.touchInfo.lastY;
            }
            else if (@event.getAction() == MotionEvent.ACTION_MOVE)
            {
                int deltaX = (int)@event.getRawX() - window.touchInfo.lastX;
                int deltaY = (int)@event.getRawY() - window.touchInfo.lastY;

                window.touchInfo.lastX = (int)@event.getRawX();
                window.touchInfo.lastY = (int)@event.getRawY();

                if (window.touchInfo.moving
                        || System.Math.Abs(totalDeltaX) >= @params.threshold
                        || System.Math.Abs(totalDeltaY) >= @params.threshold)
                {
                    window.touchInfo.moving = true;

                    // if window is moveable
                    if (XUtils.isSet(window.flags,
                            XStandOutFlags.FLAG_BODY_MOVE_ENABLE))
                    {

                        // update the position of the window
                        if (@event.getPointerCount() == 1)
                        {
                            @params.x += deltaX;
                            @params.y += deltaY;
                        }

                        window.edit().setPosition(@params.x, @params.y).commit();
                    }
                }
            }
            else if (@event.getAction() == MotionEvent.ACTION_UP)
            {
                window.touchInfo.moving = false;

                if (@event.getPointerCount() == 1)
                {

                    // bring to front on tap
                    var tap = System.Math.Abs(totalDeltaX) < @params.threshold
                            && System.Math.Abs(totalDeltaY) < @params.threshold;
                    if (tap
                            && XUtils.isSet(
                                    window.flags,
                                    XStandOutFlags.FLAG_WINDOW_BRING_TO_FRONT_ON_TAP))
                    {
                        this.bringToFront(id);
                    }
                }

                // bring to front on touch
                else if (XUtils.isSet(window.flags,
                        XStandOutFlags.FLAG_WINDOW_BRING_TO_FRONT_ON_TOUCH))
                {
                    this.bringToFront(id);
                }

            }

            onMove(id, window, view, @event);

            return true;
        }
コード例 #11
0
        //public event Action SizeChanged;

        public virtual void onResize(int arg0, XWindow arg1, View arg2, MotionEvent arg3)
        {
            //if (SizeChanged != null)
            //    SizeChanged();
        }
コード例 #12
0
 public virtual void onMove(int arg0, XWindow arg1, View arg2, MotionEvent arg3)
 { }
コード例 #13
0
 public virtual bool onInterceptTouchEvent(MotionEvent ev)
 {
     throw null;
 }
コード例 #14
0
ファイル: XobotWindow.cs プロジェクト: hakeemsm/XobotOS
		internal void SendMotionEvent (MotionEvent me)
		{
			getCallback ().dispatchTouchEvent (me);
		}
コード例 #15
0
 public virtual bool onTouchEvent(MotionEvent _event)
 {
     return default(bool);
 }
コード例 #16
0
 public override bool dispatchTouchEvent(MotionEvent @event)
 {
     return ondispatchTouchEvent(@event);
 }
コード例 #17
0
			public override bool onTouchEvent(MotionEvent e)
			{
				if (e != null)
				{
					if (e.getAction() == MotionEvent.ACTION_DOWN)
					{

						// Ensure we call switchMode() on the OpenGL thread.
						// queueEvent() is a method of GLSurfaceView that will do this for us.

						// X:\jsc.svn\core\ScriptCoreLib.Ultra\ScriptCoreLib.Ultra\Android\Extensions\GLSurfaceViewExtensions.cs
						this.queueEvent(
							() =>
							{
								if (ontouchdown != null)
									ontouchdown();

							}
						);

						return true;
					}
				}

				return base.onTouchEvent(e);
			}
コード例 #18
0
ファイル: View.cs プロジェクト: exaphaser/JSC-Cross-Compiler
 public bool dispatchTouchEvent(MotionEvent e) { throw null; }
コード例 #19
0
 public virtual bool dispatchTouchEvent(MotionEvent @event)
 {
     throw null;
 }
コード例 #20
0
        public override bool onInterceptTouchEvent(MotionEvent @event)
        {
            XStandOutWindow.StandOutLayoutParams @params = (XStandOutWindow.StandOutLayoutParams)getLayoutParams();

            // focus window
            if (@event.getAction() == MotionEvent.ACTION_DOWN)
            {
                if (mContext.getFocusedWindow() != this)
                {
                    mContext.focus(id);
                }
            }

            // multitouch

            // script: error JSC1000: Java : Opcode not implemented: brfalse.s at PopupWebView.Library.XWindow.onInterceptTouchEvent

            var flag1 = @event.getPointerCount() >= 2;
            var flag2 = (@event.getAction() & MotionEvent.ACTION_MASK) == MotionEvent.ACTION_POINTER_DOWN;

            var flag = flag1
                    && XUtils.isSet(flags, XStandOutFlags.FLAG_WINDOW_PINCH_RESIZE_ENABLE)
                    && flag2;

            if (flag)
            {
                touchInfo.scale = 1;
                touchInfo.dist = -1;
                touchInfo.firstWidth = @params.width;
                touchInfo.firstHeight = @params.height;
                return true;
            }

            return false;
        }
コード例 #21
0
        public virtual bool onTouchEvent(MotionEvent e)
        {
            return false;

        }
コード例 #22
0
 public bool onTouch(View arg0, MotionEvent arg1)
 {
     return yield(arg0, arg1);
 }
コード例 #23
0
ファイル: ColorFilters.cs プロジェクト: hakeemsm/XobotOS
		public override bool onTouchEvent (MotionEvent @event)
		{
			switch (@event.getAction ()) {
			case MotionEvent.ACTION_DOWN:
				break;
			case MotionEvent.ACTION_MOVE:
				break;
			case MotionEvent.ACTION_UP:
				// update mode every other time we change paint colors
				if (mPaint.getColor () == unchecked((int)0xFFFFFFFF)) {
					mModeIndex = (mModeIndex + 1) % mModes.Length;
					updateTitle ();
				}
				swapPaintColors ();
				invalidate ();
				break;
			}
			return true;
		}