Exemple #1
0
        public void OnKey(Android.Views.Keycode primaryCode, Android.Views.Keycode[] keyCodes)
        {
            if (Key != null)
            {
                Key(this, new KeyboardOnKeyEventArgs
                {
                    KeyCodes    = keyCodes,
                    PrimaryCode = primaryCode
                });
            }

            //View focusCurrent = _activity.Window.CurrentFocus;
            //EditText edittext = (EditText)focusCurrent;
            //IEditable editable = edittext.EditableText;
            //int start = edittext.SelectionStart;

            //if (primaryCode.ToString() == CodeBackSpace.ToString())
            //{
            //    if (editable != null && start > 0) editable.Delete(start - 1, start);
            //}
            //else if (primaryCode.ToString() == CodeEnter.ToString())
            //{

            //}
            //else
            //{
            //    editable.Insert(start, Character.ToString((char)primaryCode));
            //}
        }
Exemple #2
0
        public static av.Keycode ToSWF(this Key key)
        {
            var code = key & Key.KeyMask;

            av.Keycode modifiers = av.Keycode.Unknown;

#if TODO
            // convert the modifiers
            // Shift
            if ((key & Key.Shift) == Key.Shift)
            {
                modifiers |= av.Keycode.Shift;
            }

            // Control
            if ((key & Key.Control) == Key.Control)
            {
                modifiers |= av.Keycode.Control;
            }

            // Alt
            if ((key & Key.Alt) == Key.Alt)
            {
                modifiers |= av.Keycode.Alt;
            }
#endif

            return(Find(code) | modifiers);
        }
        public override bool OnKeyUp([GeneratedEnum] Android.Views.Keycode keyCode, KeyEvent e)
        {
            inputMethodManager = (InputMethodManager)GetSystemService(Context.InputMethodService);
            inputMethodManager.HideSoftInputFromWindow(ScoreEditText.WindowToken, 0);

            return(true);
        }
Exemple #4
0
        public override bool OnKeyDown(Android.Views.Keycode keyCode, KeyEvent e)
        {
            if (e.KeyCode == Android.Views.Keycode.Back)
            {
                switch (_viewPager.CurrentItem)
                {
                case 0:
                    _fm1.WebViewGoBack();
                    break;

                case 1:
                    _fm2.WebViewGoBack();
                    break;

                case 2:
                    _fm3.WebViewGoBack();
                    break;

                case 3:
                    _fm4.WebViewGoBack();
                    break;

                case 4:
                    _fm5.WebViewGoBack();
                    break;
                }
            }
            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));
            }
        }
Exemple #6
0
        public static Key ToEto(this av.Keycode keyData)
        {
            // convert the modifiers
            Key modifiers = Key.None;

#if TODO
            // Shift
            if ((keyData & av.Keycode.Shift) == av.Keycode.Shift)
            {
                modifiers |= Key.Shift;
            }

            // Control
            if ((keyData & av.Keycode.Control) == av.Keycode.Control)
            {
                modifiers |= Key.Control;
            }

            // Alt
            if ((keyData & av.Keycode.Alt) == av.Keycode.Alt)
            {
                modifiers |= Key.Alt;
            }

            var keyCode =
                Find(keyData & ~(av.Keycode.Shift | av.Keycode.Control | av.Keycode.Alt));
#else
            var keyCode = Find(keyData); // This is incomplete; modifiers are not currently handled
#endif

            return(keyCode | modifiers);
        }
Exemple #7
0
        public void OnKey(Android.Views.Keycode primaryCode, Android.Views.Keycode[] keyCodes)
        {
            var eventTime = DateTime.Now.Ticks;
            var keyEvent  = new KeyEvent(eventTime, eventTime, KeyEventActions.Down, primaryCode, 0);

            _activity.DispatchKeyEvent(keyEvent);
        }
Exemple #8
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));
 }
Exemple #9
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));
 }
 public override bool OnKeyDown(Android.Views.Keycode keyCode, KeyEvent e)
 {
     if (e.KeyCode == Android.Views.Keycode.Back)
     {
         CommonFrag.GetFragmentById(-1, null, ViewPager.CurrentItem).WebViewGoBack();
     }
     return(false);
 }
 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));
 }
Exemple #12
0
 public void OnPress(Android.Views.Keycode primaryCode)
 {
     if (Press != null)
     {
         Press(this, new KeyboardKeyCodeEventArgs {
             PrimaryCode = primaryCode
         });
     }
 }
Exemple #13
0
 public void OnRelease(Android.Views.Keycode primaryCode)
 {
     if (Release != null)
     {
         Release(this, new KeyboardKeyCodeEventArgs {
             PrimaryCode = primaryCode
         });
     }
 }
 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));
 }
Exemple #15
0
        public bool OnKeyDown(Android.Views.Keycode keyCode, KeyEvent e)
        {
            if (keyCode == Keycode.Menu)
            {
                return(true);
            }

            return(false);
        }
Exemple #16
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));
 }
Exemple #17
0
        public bool OnKeyLongPress(Android.Views.Keycode keyCode, KeyEvent e)
        {
            if (keyCode == Keycode.Back)
            {
                GoHome();
                return(true);
            }

            return(false);
        }
Exemple #18
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));
        }
Exemple #19
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));
        }
Exemple #20
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));
        }
 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));
 }
Exemple #22
0
        public override bool OnKeyDown(Android.Views.Keycode keyCode, Android.Views.KeyEvent e)
        {
            if (keyCode == Keycode.Back)
            {
                updateActivityReturnCodes("backButton");
                Finish();
                return(true);
            }

            return(base.OnKeyDown(keyCode, e));
        }
Exemple #23
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));
        }
 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));
 }
Exemple #25
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));
        }
Exemple #26
0
        private static Key Find(av.Keycode key)
        {
            Key mapped;

            if (keymap.TryGetValue(key, out mapped))
            {
                return(mapped);
            }
            else
            {
                return(Key.None);
            }
        }
Exemple #27
0
        public override bool OnKeyDown([GeneratedEnum] Android.Views.Keycode keyCode, KeyEvent e)
        {
            var existingFragment = GetOverFragment() as NewCardRecyclerViewFragment;

            if (keyCode == Android.Views.Keycode.Back && existingFragment != null)
            {
                var saved = existingFragment.SaveCardIfPossible();
                if (!saved)
                {
                    return(true);
                }
            }
            return(base.OnKeyDown(keyCode, e));
        }
Exemple #28
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);
            }
Exemple #29
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));
        }
Exemple #30
0
        public void OnPress([GeneratedEnum] Android.Views.Keycode primaryCode)
        {
            string code = primaryCode.GetHashCode().ToString(); //Get hashcode of button pressed on keyboard

            switch (code)
            {
            case "0":     //Back button
                break;

            case "1":     //Camera button
                camera_onbuttonClick();
                break;

            case "2":     //Gallery button
                gallery_onbuttonClick();
                break;
            }
        }