Пример #1
0
		public virtual bool onGenericMotionEvent(android.widget.TextView widget, android.text.Spannable
			 text, android.view.MotionEvent @event)
		{
			if ((@event.getSource() & android.view.InputDevice.SOURCE_CLASS_POINTER) != 0)
			{
				switch (@event.getAction())
				{
					case android.view.MotionEvent.ACTION_SCROLL:
					{
						float vscroll;
						float hscroll;
						if ((@event.getMetaState() & android.view.KeyEvent.META_SHIFT_ON) != 0)
						{
							vscroll = 0;
							hscroll = @event.getAxisValue(android.view.MotionEvent.AXIS_VSCROLL);
						}
						else
						{
							vscroll = [email protected](android.view.MotionEvent.AXIS_VSCROLL);
							hscroll = @event.getAxisValue(android.view.MotionEvent.AXIS_HSCROLL);
						}
						bool handled = false;
						if (hscroll < 0)
						{
							handled |= scrollLeft(widget, text, (int)System.Math.Ceiling(-hscroll));
						}
						else
						{
							if (hscroll > 0)
							{
								handled |= scrollRight(widget, text, (int)System.Math.Ceiling(hscroll));
							}
						}
						if (vscroll < 0)
						{
							handled |= scrollUp(widget, text, (int)System.Math.Ceiling(-vscroll));
						}
						else
						{
							if (vscroll > 0)
							{
								handled |= scrollDown(widget, text, (int)System.Math.Ceiling(vscroll));
							}
						}
						return handled;
					}
				}
			}
			return false;
		}