Пример #1
0
 public override bool OnKeyUp(Keycode keyCode, KeyEvent keyEvent)
 {
     //Log.Info(TAG, "OnKeyUp=" + (int)keyCode);
     int playerNum = OuyaController.getPlayerNumByDeviceId(keyEvent.DeviceId);
     if (playerNum >= 0 && playerNum < 4)
     {
         if ((int)keyCode == OuyaController.BUTTON_DPAD_DOWN)
         {
             _game.GetFocusManager().FocusDown();
         }
         if ((int)keyCode == OuyaController.BUTTON_DPAD_LEFT)
         {
             _game.GetFocusManager().FocusLeft();
         }
         if ((int)keyCode == OuyaController.BUTTON_DPAD_RIGHT)
         {
             _game.GetFocusManager().FocusRight();
         }
         if ((int)keyCode == OuyaController.BUTTON_DPAD_UP)
         {
             _game.GetFocusManager().FocusUp();
         }
         if ((int)keyCode == OuyaController.BUTTON_O)
         {
             _game.GetFocusManager().InvokeClick();
         }
         if ((int)keyCode == OuyaController.BUTTON_A)
         {
             _game.Exit();
         }
     }
     return true;
 }
Пример #2
0
 public bool OnKey(View v, Keycode keyCode, KeyEvent e)
 {
     if (e.KeyCode == Keycode.Enter && e.Action == 0) {
         activity.EnterKeyPressed ();
     }
     return false;
 }
        public override bool OnKeyDown(Android.Views.Keycode keyCode, Android.Views.KeyEvent e)
        {
            if (keyCode == Keycode.Back && FragmentManager.BackStackEntryCount > 1)        //Button Back and we have some fragments in Backstack
            {
                FragmentManager.PopBackStackImmediate();
                string visibleFragmentTag = FragmentManager.FindFragmentById(Resource.Id.content_frame).Tag;
                if (visibleFragmentTag == "settingsfragment")
                {
                    ActionBar.Title = GetString(Resource.String.Preferences);
                }
                else
                {
                    var fragmentTagMenuArray = Resources.GetStringArray(Resource.Array.FragmentTagMenuArray);
                    int index = Array.IndexOf(fragmentTagMenuArray, visibleFragmentTag);
                    _drawerList.SetItemChecked(index, true);

                    ActionBar.Title = Resources.GetStringArray(Resource.Array.MenuArray)[index];               //ActionBar.Title = _drawerList.CheckedItemPosition.ToString();
                    InvalidateOptionsMenu();
                }
                return(true);
            }
            else
            {
                return(base.OnKeyDown(keyCode, e));
            }
        }
Пример #4
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.Main);

            mKeyboard = new Keyboard(this, Resource.Xml.keyboard2);
            mTargetView = (EditText)FindViewById(Resource.Id.target);

            mKeyboardView = (CustomKeyboardView)FindViewById(Resource.Id.keyboard_view);
            mKeyboardView.Keyboard = mKeyboard;

            mTargetView.Touch += (sender, e) => {
                Log.Info("onTouch", "true");
                ShowKeyboardWithAnimation();
                e.Handled = true;
            };

            mKeyboardView.Key += (sender, e) => {
                long eventTime = JavaSystem.CurrentTimeMillis();
                KeyEvent ev = new KeyEvent(eventTime, eventTime, KeyEventActions.Down, e.PrimaryCode, 0, 0, 0, 0, KeyEventFlags.SoftKeyboard | KeyEventFlags.KeepTouchMode);

                this.DispatchKeyEvent(ev);
            };
        }
Пример #5
0
		public bool OnKeyDown (Android.Views.Keycode keyCode, KeyEvent e)
		{
			if (keyCode == Keycode.Menu)
				return true;

			return false;
		}
Пример #6
0
 public override bool OnKeyUp(Keycode keyCode, KeyEvent e)
 {
     if (keyCode == Keycode.Back)
         return base.OnKeyUp (keyCode, e);
     else
         return jetboy_thread.DoKeyUp (keyCode, e);
 }
Пример #7
0
        public override bool OnKeyDown(Keycode keyCode, KeyEvent e)
        {
            if (keyCode == Keycode.Back) {

                Finish ();
            }
            return base.OnKeyDown (keyCode, e);
        }
Пример #8
0
 public override bool OnKeyDown(Android.Views.Keycode keyCode, Android.Views.KeyEvent e)
 {
     if (Forms9Patch.Droid.HardwareKeyListener.OnKeyDown(keyCode, e))
     {
         return(true);
     }
     return(base.OnKeyDown(keyCode, e));
 }
Пример #9
0
        // If Back button is pressed, return previous fragment.
        public override bool OnKeyDown(Keycode keyCode, KeyEvent e)
        {
            if (keyCode == Keycode.Back) {
                return PopFragment();
            }

            return base.OnKeyDown(keyCode, e);
        }
Пример #10
0
 public override bool OnKeyUp(Android.Views.Keycode keyCode, Android.Views.KeyEvent e)
 {
     if (keyCode == Android.Views.Keycode.Back && !BackEvent())
     {
         return(false);
     }
     return(base.OnKeyUp(keyCode, e));
 }
Пример #11
0
 public override bool DispatchKeyEvent(KeyEvent keyEvent)
 {
     if (null != _ouyaInputView)
     {
         return _ouyaInputView.DispatchKeyEvent(keyEvent);
     }
     return base.DispatchKeyEvent(keyEvent);
 }
Пример #12
0
 public override bool OnKeyDown(Android.Views.Keycode keyCode, Android.Views.KeyEvent e)
 {
     if (keyCode == Android.Views.Keycode.Back)
     {
         game.shouldShutdown = true;
     }
     return(base.OnKeyDown(keyCode, e));
 }
            public override bool SendKeyEvent(KeyEvent e)
            {
                if (e.Action == KeyEventActions.Down && e.KeyCode == Keycode.Del)
                {
                    noCursorMovingEditText.OnBackKeyPressed();
                }

                return base.SendKeyEvent(e);
            }
Пример #14
0
 public bool OnKeyUp(Keycode keycode, KeyEvent keyEvent)
 {
     if (keycode == Keycode.Back && _slidingMenu.IsMenuShowing)
     {
         ShowContent();
         return true;
     }
     return false;
 }
Пример #15
0
        public override bool DispatchKeyEvent(KeyEvent e)
        {
            if (_contentView != null)
            {
                _contentView.View.DispatchKeyEvent(e);
            }

            return base.DispatchKeyEvent(e);
        }
Пример #16
0
        public override bool OnKeyDown(Keycode keyCode, KeyEvent e)
        {
            if (keyCode == Keycode.Menu) {
                StartActivity (typeof(SettingsActivity));
                return true;
            }

            return base.OnKeyDown (keyCode, e);
        }
Пример #17
0
        public override bool OnKeyDown(Keycode keyCode, KeyEvent e)
        {
            if (keyCode == Keycode.Back && WaveServices.Platform != null)
            {
                WaveServices.Platform.Exit();
            }

            return base.OnKeyDown(keyCode, e);
        }
Пример #18
0
		public bool OnKeyLongPress (Android.Views.Keycode keyCode, KeyEvent e)
		{
			if (keyCode == Keycode.Back) {
				GoHome ();
				return true;
			}

			return false;
		}
Пример #19
0
			bool View.IOnKeyListener.OnKey (View v, Keycode keyCode, KeyEvent e)
			{
				if (e.Action == KeyEventActions.Down && keyCode == Keycode.Enter) {
					Logger.Debug ("entered pressed");
					OnSend ();
					return true;
				}
				return false;
			}
Пример #20
0
 public override bool OnKeyUp(Keycode keyCode, KeyEvent e)
 {
     if (keyCode == Keycode.Back)
     {
         WaveEngine.Adapter.Input.InputManager inputManager = (WaveEngine.Adapter.Input.InputManager)adapter.InputManager;
         inputManager.GamePadState.Buttons.Back = ButtonState.Release;
     }
     return true;
 }
Пример #21
0
		public override bool OnKeyDown(Keycode keyCode, KeyEvent e)
		{
			if (keyCode == Keycode.Back) {
				oauthWebView.close (true);
				return true;
			} else {
				return base.OnKeyDown (keyCode, e);
			}
		}
Пример #22
0
		public override bool DispatchKeyEvent (KeyEvent e)
		{
			if (e.KeyCode == Keycode.Back && !isMapOpen) {
				horizontalMenu.RestoreInitalState ();
				return true;
			} else {
				return base.DispatchKeyEvent (e);
			}
		}
 public bool OnEditorAction(TextView v, ImeAction actionId, KeyEvent e)
 {
     if (actionId == ImeAction.Search)
     {
         ViewModel.SearchCommand.Execute(null);
         return true;
     }
     return false;
 }
Пример #24
0
 public override bool OnKeyDown(Android.Views.Keycode keyCode, Android.Views.KeyEvent e)
 {
     if (keyCode == Keycode.Back && web_google_forms.CanGoBack())
     {
         web_google_forms.GoBack();
         return(true);
     }
     return(base.OnKeyDown(keyCode, e));
 }
 public override bool OnKeyDown(Android.Views.Keycode keyCode, Android.Views.KeyEvent e)
 {
     if (keyCode == Keycode.Back && _webview.CanGoBack())
     {
         _webview.GoBack();
         return(true);
     }
     return(base.OnKeyDown(keyCode, e));
 }
        public override bool OnKeyUp(Keycode keyCode, KeyEvent e)
        {
            if (keyCode == Keycode.Back)
            {
                webView.ClearCache(true);
                Finish();
            }

            return base.OnKeyUp (keyCode, e);
        }
Пример #27
0
		public override bool OnKeyUp (Keycode keyCode, KeyEvent e)
		{
			if (keyCode == Keycode.Back) {
				Intent intent = new Intent(Intent.ActionMain);
				intent.AddCategory(Intent.CategoryHome);
				intent.SetFlags(ActivityFlags.NewTask);
				StartActivity(intent);
			}
			return true;
		}
Пример #28
0
		public override bool OnKeyPreIme(Keycode keyCode, KeyEvent e)
		{
			if (keyCode == Keycode.Back && e.Action == KeyEventActions.Down)
			{
				EventHandler handler = OnKeyboardBackPressed;
				if (handler != null)
					handler(this, EventArgs.Empty);
			}
			return base.OnKeyPreIme(keyCode, e);
		}
Пример #29
0
        public override bool OnKeyDown(Android.Views.Keycode keyCode, Android.Views.KeyEvent e)
        {
            if (keyCode == Keycode.Back)
            {
                this.Finish( );
                return(true);
            }

            return(base.OnKeyDown(keyCode, e));
        }
Пример #30
0
        public override bool OnKeyUp(Android.Views.Keycode keyCode, Android.Views.KeyEvent e)
        {
            if ((keyCode == Android.Views.Keycode.F1 || keyCode == Android.Views.Keycode.Menu || keyCode == Android.Views.Keycode.VolumeUp || keyCode == Android.Views.Keycode.VolumeDown || keyCode == Android.Views.Keycode.VolumeMute) && UXDivers.Gorilla.Coordinator.Instance != null)
            {
                UXDivers.Gorilla.ActionManager.ShowMenu();
                return(true);
            }

            return(base.OnKeyUp(keyCode, e));
        }
Пример #31
0
        public override bool OnKeyUp(Keycode keyCode, KeyEvent e)
        {
            if (keyCode == Keycode.Back || e.KeyCode == Keycode.Back)
            {
                var activity = this.Context as Activity;

                activity.FragmentManager.PopBackStack();
            }

            return true;
        }
		public override bool DispatchKeyEvent(KeyEvent e)
		{
			if (e.KeyCode == Keycode.Back)
			{
				if (this.editTextMessage.HasFocus)
				{
					this.editTextMessage.ClearFocus();
				}
			}
			return base.DispatchKeyEvent(e);
		}
Пример #33
0
 public override bool OnKeyDown(Keycode keyCode, KeyEvent e)
 {
     if (keyCode == Keycode.Back)
     {
         status = DialogManager.ShowStatus(this, Database.GetText("Communicating", "System"));
         backFuncs[model]();
         this.Finish();
         return true;
     }
     return base.OnKeyDown(keyCode, e);
 }
Пример #34
0
 public bool OnKey(IDialogInterface dialog, Keycode keyCode, KeyEvent e)
 {
     if (e.KeyCode == Keycode.Back)
         switch (e.Action)
         {
             case KeyEventActions.Down: return Down;
             case KeyEventActions.Multiple: return Multiple;
             case KeyEventActions.Up: return Up;
         }
     return false;
 }
 public override bool OnKeyDown(Android.Views.Keycode keyCode, Android.Views.KeyEvent e)
 {
     if (keyCode == Keycode.Back && web_google_forms.CanGoBack())
     {
         web_google_forms.GoBack();
         return(true);
     }
     this.Finish();
     this.StartActivity(typeof(ResultActivity));
     return(base.OnKeyDown(keyCode, e));
 }
Пример #36
0
        public bool OnKey(View v, Keycode keyCode, KeyEvent e)
        {
            EditText barcode = (EditText)v;
            if (keyCode == Keycode.Enter||e.KeyCode== Keycode.NumpadEnter) {
                Txtbarcode_AfterTextChanged (barcode);
                return true;
            }

            //barcode.Text = barcode.Text + keyCode;
            return false;
        }
Пример #37
0
        public override bool OnKeyDown(Android.Views.Keycode keyCode, Android.Views.KeyEvent e)
        {
            //System.Diagnostics.Debug.WriteLine("MainActivity.OnKeyUp[" + keyCode + "] e.Action[" + e.Action + "] e.Characters[" + e.Characters + "] e.DisplayLabel[" + e.DisplayLabel + "] e.Flags[" + e.Flags + "] e.MetaStates[" + e.MetaState + "] e.Modifiers[" + e.Modifiers + "] e.Unicode[" + (char)e.UnicodeChar + "] " + e.Characters + "");
            var handled = Forms9Patch.Droid.HardwareKeyListener.OnKeyDown(keyCode, e);

            if (handled)
            {
                return(true);
            }
            return(base.OnKeyDown(keyCode, e));
        }
Пример #38
0
        public override bool OnKeyDown(Keycode keyCode, KeyEvent e)
        {
            if (keyCode == Keycode.Back) {

                this.SupportFragmentManager.PopBackStack ();

                return true;
            }

            return base.OnKeyDown (keyCode, e);
        }
Пример #39
0
        public override bool OnKeyDown(Android.Views.Keycode keyCode, Android.Views.KeyEvent e)
        {
            var pageInstance = ((AnnexioWebAppPage)appInstance.MainPage);

            if (keyCode == Keycode.Back && pageInstance.CanGoBack)
            {
                pageInstance.GoBack();
                return(true); //Prevent the default key down closing the app
            }
            return(base.OnKeyDown(keyCode, e));
        }
Пример #40
0
        public bool OnKeyUp(Keycode keyCode, KeyEvent e)
        {
            if (keyCode != Keycode.Back) return false;

            if (!_hostScreen.Router.NavigateBack.CanExecute(null)) return false;

            if (_inner == null) return false;

            _hostScreen.Router.NavigateBack.Execute(null);
            return true;
        }
Пример #41
0
 public bool OnEditorAction(TextView v, ImeAction actionId, KeyEvent e)
 {
     if (actionId == ImeAction.Done) {
         if (this.FinishEditCallback != null) {
             this.FinishEditCallback(v.Text);
         }
         this.Dismiss();
         return true;
     }
     return false;
 }
Пример #42
0
 public override bool OnKeyDown(Android.Views.Keycode keyCode, Android.Views.KeyEvent e)
 {
     if (wv != null)
     {
         if (keyCode == Keycode.Back && wv.CanGoBack())
         {
             wv.GoBack();
             return(true);
         }
     }
     return(base.OnKeyDown(keyCode, e));
 }
Пример #43
0
        public override bool OnKeyPreIme(Android.Views.Keycode keyCode, Android.Views.KeyEvent e)
        {
            // intercept the back button to hide the keyboard
            if (e.KeyCode == Keycode.Back)
            {
                ClearFocus();
                this.HideKeyboard();
                return(true);
            }

            return(base.OnKeyPreIme(keyCode, e));
        }
Пример #44
0
 private bool OnKey(Keycode keyCode, Android.Views.KeyEvent e)
 {
     lock (KeyboardInputEvents)
     {
         KeyboardInputEvents.Add(new KeyboardInputEvent
         {
             Key  = ConvertKeyFromAndroid(keyCode),
             Type = e.Action == KeyEventActions.Down ? InputEventType.Down : InputEventType.Up,
         });
     }
     return(true);
 }
Пример #45
0
            public bool OnKey(View v, Keycode keyCode, Android.Views.KeyEvent e)
            {
                var strideKey = ConvertKeyFromAndroid(keyCode);

                if (e.Action == KeyEventActions.Down)
                {
                    keyboard.HandleKeyDown(strideKey);
                }
                else
                {
                    keyboard.HandleKeyUp(strideKey);
                }

                return(true);
            }
Пример #46
0
        /*public override bool OnCreateOptionsMenu (IMenu menu)
         * {
         *
         *      var drawerOpen = _Drawer.IsDrawerOpen(_DrawerList);
         *      //when open don't show anything
         *      for (int i = 0; i < menu.Size(); i++)
         *              menu.GetItem(i).SetVisible(!drawerOpen);
         *
         *
         *      return base.OnCreateOptionsMenu(menu);
         * }*/

        public override bool OnKeyDown(Android.Views.Keycode keyCode, Android.Views.KeyEvent e)
        {
            Android.App.Fragment fragment = null;

            foreach (string sec in MenuItems)
            {
                fragment = FragmentManager.FindFragmentByTag(sec.ToLower());

                if (fragment == null)
                {
                    continue;
                }

                if (fragment.GetType() == typeof(EdicolaFragment))
                {
                    var f = fragment as EdicolaFragment;

                    if (!f.OnBackPressed())
                    {
                        return(false);
                    }
                }
                else if (fragment.GetType() == typeof(DownloadFragment))
                {
                    var f = fragment as DownloadFragment;

                    if (!f.OnBackPressed())
                    {
                        return(false);
                    }
                }
            }

            /*EdicolaFragment fragment = SupportFragmentManager.FindFragmentByTag("edicola") as EdicolaFragment;
             *
             * if(keyCode == Keycode.Back)
             * {
             *      if(!fragment.OnBackPressed())
             *      {
             *              return false;
             *      }
             * }*/

            return(base.OnKeyDown(keyCode, e));
        }
Пример #47
0
        public bool OnKey(View v, Keycode keyCode, Android.Views.KeyEvent e)
        {
            if (e.Action == KeyEventActions.Multiple)
            {
                return(false);
            }

            lock (this)
            {
                Interfaces.KeyEvent ke = _keyEventPool.NewObject();
                int kcode = (int)keyCode;
                ke.keyCode = kcode;
                ke.keyChar = (char)e.UnicodeChar;
                if (e.Action == KeyEventActions.Down)
                {
                    ke.type = Interfaces.KeyEvent.KEY_DOWN;
                    if (kcode > 0 && kcode < 128)
                    {
                        _pressedKeys[kcode] = true;
                    }
                }

                if (e.Action == KeyEventActions.Up)
                {
                    ke.type = Interfaces.KeyEvent.KEY_UP;
                    if (kcode > 0 && kcode < 128)
                    {
                        _pressedKeys[kcode] = false;
                    }
                }

                _keyEventsBuffer.Add(ke);
            }

            return(false);
        }
Пример #48
0
 public bool OnKey(View v, Keycode keyCode, Android.Views.KeyEvent e)
 {
     return(inputManager.OnKey(keyCode, e));
 }
Пример #49
0
 public bool IsShortcutKey(int keyCode, Android.Views.KeyEvent e)
 {
     throw new NotSupportedException();
 }
Пример #50
0
 public bool PerformShortcut(int keyCode, Android.Views.KeyEvent e, Android.Views.MenuFlags flags)
 {
     throw new NotSupportedException();
 }
        bool TextView.IOnEditorActionListener.OnEditorAction(TextView v, ImeAction actionId, Android.Views.KeyEvent e)
        {
            if (actionId == ImeAction.Done ||
                (actionId == ImeAction.ImeNull && e.KeyCode == Keycode.Enter))
            {
                HideKeyboard(v);
                DoneEdit();
            }

            return(true);
        }