当前位置: 首页>>代码示例>>C#>>正文


C# android.getKeyCode方法代码示例

本文整理汇总了C#中android.getKeyCode方法的典型用法代码示例。如果您正苦于以下问题:C# android.getKeyCode方法的具体用法?C# android.getKeyCode怎么用?C# android.getKeyCode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android的用法示例。


在下文中一共展示了android.getKeyCode方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: onKeyOther

		public virtual bool onKeyOther(android.widget.TextView widget, android.text.Spannable
			 text, android.view.KeyEvent @event)
		{
			int movementMetaState = getMovementMetaState(text, @event);
			int keyCode = @event.getKeyCode();
			if (keyCode != android.view.KeyEvent.KEYCODE_UNKNOWN && @event.getAction() == android.view.KeyEvent
				.ACTION_MULTIPLE)
			{
				int repeat = @event.getRepeatCount();
				bool handled = false;
				{
					for (int i = 0; i < repeat; i++)
					{
						if (!handleMovementKey(widget, text, keyCode, movementMetaState, @event))
						{
							break;
						}
						handled = true;
					}
				}
				if (handled)
				{
					android.text.method.MetaKeyKeyListener.adjustMetaAfterKeypress(text);
					android.text.method.MetaKeyKeyListener.resetLockedMeta(text);
				}
				return handled;
			}
			return false;
		}
开发者ID:hakeemsm,项目名称:XobotOS,代码行数:29,代码来源:BaseMovementMethod.cs

示例2: dispatchKeyEvent

			public override bool dispatchKeyEvent(android.view.KeyEvent @event)
			{
				if (@event.getKeyCode() == android.view.KeyEvent.KEYCODE_BACK)
				{
					if (this.getKeyDispatcherState() == null)
					{
						return base.dispatchKeyEvent(@event);
					}
					if (@event.getAction() == android.view.KeyEvent.ACTION_DOWN && @event.getRepeatCount
						() == 0)
					{
						android.view.KeyEvent.DispatcherState state = this.getKeyDispatcherState();
						if (state != null)
						{
							state.startTracking(@event, this);
						}
						return true;
					}
					else
					{
						if (@event.getAction() == android.view.KeyEvent.ACTION_UP)
						{
							android.view.KeyEvent.DispatcherState state = this.getKeyDispatcherState();
							if (state != null && state.isTracking(@event) && [email protected]())
							{
								this._enclosing.dismiss();
								return true;
							}
						}
					}
					return base.dispatchKeyEvent(@event);
				}
				else
				{
					return base.dispatchKeyEvent(@event);
				}
			}
开发者ID:hakeemsm,项目名称:XobotOS,代码行数:37,代码来源:PopupWindow.cs

示例3: onContainerKey

		private bool onContainerKey(android.view.KeyEvent @event)
		{
			int keyCode = @event.getKeyCode();
			if (isInterestingKey(keyCode))
			{
				if (keyCode == android.view.KeyEvent.KEYCODE_BACK)
				{
					if (@event.getAction() == android.view.KeyEvent.ACTION_DOWN && @event.getRepeatCount
						() == 0)
					{
						if (mOwnerView != null)
						{
							android.view.KeyEvent.DispatcherState ds = mOwnerView.getKeyDispatcherState();
							if (ds != null)
							{
								ds.startTracking(@event, this);
							}
						}
						return true;
					}
					else
					{
						if (@event.getAction() == android.view.KeyEvent.ACTION_UP && @event.isTracking() 
							&& [email protected]())
						{
							setVisible(false);
							return true;
						}
					}
				}
				else
				{
					dismissControlsDelayed(ZOOM_CONTROLS_TIMEOUT);
				}
				// Let the container handle the key
				return false;
			}
			else
			{
				android.view.ViewRootImpl viewRoot = getOwnerViewRootImpl();
				if (viewRoot != null)
				{
					viewRoot.dispatchKey(@event);
				}
				// We gave the key to the owner, don't let the container handle this key
				return true;
			}
		}
开发者ID:hakeemsm,项目名称:XobotOS,代码行数:48,代码来源:ZoomButtonsController.cs

示例4: onKeyEvent

		/// <summary>Checks a key event.</summary>
		/// <remarks>Checks a key event.</remarks>
		/// <param name="event">The event.</param>
		/// <param name="nestingLevel">
		/// The nesting level: 0 if called from the base class,
		/// or 1 from a subclass.  If the event was already checked by this consistency verifier
		/// at a higher nesting level, it will not be checked again.  Used to handle the situation
		/// where a subclass dispatching method delegates to its superclass's dispatching method
		/// and both dispatching methods call into the consistency verifier.
		/// </param>
		public void onKeyEvent(android.view.KeyEvent @event, int nestingLevel)
		{
			if (!startEvent(@event, nestingLevel, EVENT_TYPE_KEY))
			{
				return;
			}
			try
			{
				ensureMetaStateIsNormalized(@event.getMetaState());
				int action = @event.getAction();
				int deviceId = @event.getDeviceId();
				int source = @event.getSource();
				int keyCode = @event.getKeyCode();
				switch (action)
				{
					case android.view.KeyEvent.ACTION_DOWN:
					{
						android.view.InputEventConsistencyVerifier.KeyState state = findKeyState(deviceId
							, source, keyCode, false);
						if (state != null)
						{
							// If the key is already down, ensure it is a repeat.
							// We don't perform this check when processing raw device input
							// because the input dispatcher itself is responsible for setting
							// the key repeat count before it delivers input events.
							if (state.unhandled)
							{
								state.unhandled = false;
							}
							else
							{
								if ((mFlags & FLAG_RAW_DEVICE_INPUT) == 0 && @event.getRepeatCount() == 0)
								{
									problem("ACTION_DOWN but key is already down and this event " + "is not a key repeat."
										);
								}
							}
						}
						else
						{
							addKeyState(deviceId, source, keyCode);
						}
						break;
					}

					case android.view.KeyEvent.ACTION_UP:
					{
						android.view.InputEventConsistencyVerifier.KeyState state = findKeyState(deviceId
							, source, keyCode, true);
						if (state == null)
						{
							problem("ACTION_UP but key was not down.");
						}
						else
						{
							state.recycle();
						}
						break;
					}

					case android.view.KeyEvent.ACTION_MULTIPLE:
					{
						break;
					}

					default:
					{
						problem("Invalid action " + android.view.KeyEvent.actionToString(action) + " for key event."
							);
						break;
					}
				}
			}
			finally
			{
				finishEvent();
			}
		}
开发者ID:hakeemsm,项目名称:XobotOS,代码行数:88,代码来源:InputEventConsistencyVerifier.cs

示例5: dispatchKeyShortcutEvent

		public virtual bool dispatchKeyShortcutEvent(android.view.KeyEvent @event)
		{
			onUserInteraction();
			if (getWindow().superDispatchKeyShortcutEvent(@event))
			{
				return true;
			}
			return onKeyShortcut(@event.getKeyCode(), @event);
		}
开发者ID:hakeemsm,项目名称:XobotOS,代码行数:9,代码来源:Activity.cs

示例6: dispatchKeyEvent

		public override bool dispatchKeyEvent(android.view.KeyEvent @event)
		{
			int keyCode = @event.getKeyCode();
			if (keyCode == android.view.KeyEvent.KEYCODE_DPAD_CENTER || keyCode == android.view.KeyEvent
				.KEYCODE_ENTER)
			{
				removeAllCallbacks();
			}
			return base.dispatchKeyEvent(@event);
		}
开发者ID:hakeemsm,项目名称:XobotOS,代码行数:10,代码来源:NumberPicker.cs

示例7: executeKeyEvent

		/// <summary>
		/// You can call this function yourself to have the scroll view perform
		/// scrolling from a key event, just as if the event had been dispatched to
		/// it by the view hierarchy.
		/// </summary>
		/// <remarks>
		/// You can call this function yourself to have the scroll view perform
		/// scrolling from a key event, just as if the event had been dispatched to
		/// it by the view hierarchy.
		/// </remarks>
		/// <param name="event">The key event to execute.</param>
		/// <returns>Return true if the event was handled, else false.</returns>
		public virtual bool executeKeyEvent(android.view.KeyEvent @event)
		{
			mTempRect.setEmpty();
			if (!canScroll())
			{
				if (isFocused())
				{
					android.view.View currentFocused = findFocus();
					if (currentFocused == this)
					{
						currentFocused = null;
					}
					android.view.View nextFocused = android.view.FocusFinder.getInstance().findNextFocus
						(this, currentFocused, android.view.View.FOCUS_RIGHT);
					return nextFocused != null && nextFocused != this && nextFocused.requestFocus(android.view.View
						.FOCUS_RIGHT);
				}
				return false;
			}
			bool handled = false;
			if (@event.getAction() == android.view.KeyEvent.ACTION_DOWN)
			{
				switch (@event.getKeyCode())
				{
					case android.view.KeyEvent.KEYCODE_DPAD_LEFT:
					{
						if ([email protected]())
						{
							handled = arrowScroll(android.view.View.FOCUS_LEFT);
						}
						else
						{
							handled = fullScroll(android.view.View.FOCUS_LEFT);
						}
						break;
					}

					case android.view.KeyEvent.KEYCODE_DPAD_RIGHT:
					{
						if ([email protected]())
						{
							handled = arrowScroll(android.view.View.FOCUS_RIGHT);
						}
						else
						{
							handled = fullScroll(android.view.View.FOCUS_RIGHT);
						}
						break;
					}

					case android.view.KeyEvent.KEYCODE_SPACE:
					{
						pageScroll(@event.isShiftPressed() ? android.view.View.FOCUS_LEFT : android.view.View
							.FOCUS_RIGHT);
						break;
					}
				}
			}
			return handled;
		}
开发者ID:hakeemsm,项目名称:XobotOS,代码行数:72,代码来源:HorizontalScrollView.cs

示例8: dispatchKeyEvent

		public override bool dispatchKeyEvent(android.view.KeyEvent @event)
		{
			bool handled = base.dispatchKeyEvent(@event);
			// unhandled key ups change focus to tab indicator for embedded activities
			// when there is nothing that will take focus from default focus searching
			if (!handled && (@event.getAction() == android.view.KeyEvent.ACTION_DOWN) && (@event
				.getKeyCode() == android.view.KeyEvent.KEYCODE_DPAD_UP) && (mCurrentView != null
				) && (mCurrentView.isRootNamespace()) && (mCurrentView.hasFocus()) && (mCurrentView
				.findFocus().focusSearch(android.view.View.FOCUS_UP) == null))
			{
				mTabWidget.getChildTabViewAt(mCurrentTab).requestFocus();
				playSoundEffect(android.view.SoundEffectConstants.NAVIGATION_UP);
				return true;
			}
			return handled;
		}
开发者ID:hakeemsm,项目名称:XobotOS,代码行数:16,代码来源:TabHost.cs

示例9: onKeyOther

		public virtual bool onKeyOther(android.view.View view, android.text.Editable content
			, android.view.KeyEvent @event)
		{
			if (@event.getAction() != android.view.KeyEvent.ACTION_MULTIPLE || @event.getKeyCode
				() != android.view.KeyEvent.KEYCODE_UNKNOWN)
			{
				// Not something we are interested in.
				return false;
			}
			int selectionStart = android.text.Selection.getSelectionStart(content);
			int selectionEnd = android.text.Selection.getSelectionEnd(content);
			if (selectionEnd < selectionStart)
			{
				int temp = selectionEnd;
				selectionEnd = selectionStart;
				selectionStart = temp;
			}
			java.lang.CharSequence text = java.lang.CharSequenceProxy.Wrap(@event.getCharacters
				());
			if (text == null)
			{
				return false;
			}
			content.replace(selectionStart, selectionEnd, text);
			return true;
		}
开发者ID:hakeemsm,项目名称:XobotOS,代码行数:26,代码来源:BaseKeyListener.cs

示例10: dispatchKeyEvent

		/// <hide></hide>
		public void dispatchKeyEvent(android.content.Context context, int seq, android.view.KeyEvent
			 key, [email protected] callback)
		{
			lock (mH)
			{
				if (mCurMethod == null)
				{
					try
					{
						callback.finishedEvent(seq, false);
					}
					catch (android.os.RemoteException)
					{
					}
					return;
				}
				if (key.getAction() == android.view.KeyEvent.ACTION_DOWN && key.getKeyCode() == android.view.KeyEvent
					.KEYCODE_SYM)
				{
					showInputMethodPicker();
					try
					{
						callback.finishedEvent(seq, true);
					}
					catch (android.os.RemoteException)
					{
					}
					return;
				}
				try
				{
					mCurMethod.dispatchKeyEvent(seq, key, callback);
				}
				catch (android.os.RemoteException e)
				{
					android.util.Log.w(TAG, "IME died: " + mCurId + " dropping: " + key, e);
					try
					{
						callback.finishedEvent(seq, false);
					}
					catch (android.os.RemoteException)
					{
					}
				}
			}
		}
开发者ID:hakeemsm,项目名称:XobotOS,代码行数:47,代码来源:InputMethodManager.cs


注:本文中的android.getKeyCode方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。