Exemplo n.º 1
0
 public async Task KeyUp(UIKeyboardEventArgs e)
 {
     if (e.Key == "Enter")
     {
         await SendMessage();
     }
 }
 protected void OnSearchByName(UIKeyboardEventArgs eventArgs)
 {
     if (eventArgs.Key == "Enter" && SearchTerm.Length > 0)
     {
         CategoryService.SearchByName(SearchTerm);
     }
 }
Exemplo n.º 3
0
        public void OnKeyUp(UIKeyboardEventArgs e)
        {
            if (keyPressState.Count == 99)
            {
                keyPressState = new PressState();
                TimerHelper.Stop();
                return;
            }

            string a = e.Key.ToLower();

            if (a.Contains("arrow"))
            {
                MoveDirection CurrDirection = StringToDirection(a.Replace("arrow", null));



                //if (keyPressState.Direction == MoveDirection.undefined)
                //{
                if (!e.CtrlKey)
                {
                    SelectNeightbourCell(CurrDirection);
                }
                //}
                //else
                //{
                //    if (CurrDirection == keyPressState.Direction && keyPressState.Count > 0)
                //    {
                //        SelectNeightbourCell(CurrDirection);
                //    }
                //}
            }
        }
Exemplo n.º 4
0
        private void OnKeyboardDidShow(object sender, UIKeyboardEventArgs e)
        {
            var contentInsets = new UIEdgeInsets(0, 0, e.FrameEnd.Height, 0);

            _scrollView.ContentInset          = contentInsets;
            _scrollView.ScrollIndicatorInsets = contentInsets;
        }
Exemplo n.º 5
0
        private void keyboardLowered(object sender, UIKeyboardEventArgs e)
        {
            // setting the phones screen back down now the keyboard has gone
            var mainWindow = UIApplication.SharedApplication.KeyWindow;

            mainWindow.Frame = new CoreGraphics.CGRect(0, 0, mainWindow.Frame.Width, mainWindow.Frame.Height);
        }
Exemplo n.º 6
0
        // Here we will resize and move our UI when Keyboard Shows/Hides
        void KeyboardWillToggle(object sender, UIKeyboardEventArgs e)
        {
            var duration       = e.AnimationDuration;
            var startFrame     = e.FrameBegin;
            var endFrame       = e.FrameEnd;
            int signCorrection = 1;

            if (startFrame.Y < 0 || startFrame.X < 0 || endFrame.Y < 0 || endFrame.X < 0)
            {
                signCorrection = -1;
            }

            var widthChange  = (endFrame.X - startFrame.X) * signCorrection;
            var heightChange = (endFrame.Y - startFrame.Y) * signCorrection;
            //var sizeChange = heightChange; //UIDevice.CurrentDevice.Orientation == UIDeviceOrientation.Portrait ? heightChange : widthChange;
            var sizeChange        = InterfaceOrientation == UIInterfaceOrientation.Portrait ? heightChange : widthChange;
            var newContainerFrame = container.Frame;

            newContainerFrame = new RectangleF(container.Frame.X, container.Frame.Y, container.Frame.Width, container.Frame.Height + sizeChange);
            var offsetY = Math.Max(0.0f, textView.ContentSize.Height - textView.Frame.Size.Height - sizeChange);
            var newTextViewContentOffset = new PointF(0, offsetY);

            UIView.Animate(duration, 0, UIViewAnimationOptions.BeginFromCurrentState, () => container.Frame = newContainerFrame, null);
            textView.SetContentOffset(newTextViewContentOffset, true);
        }
Exemplo n.º 7
0
 public void KeyWasPressed(UIKeyboardEventArgs args)
 {
     if (args.Key == "Enter")
     {
         SearchGo();
     }
 }
 private void OnKeyboardHide(object sender, UIKeyboardEventArgs args)
 {
     if (Element != null)
     {
         Element.HeightRequest = 0;
     }
 }
Exemplo n.º 9
0
 protected void HandleKeyPress(UIKeyboardEventArgs args, Action action)
 {
     if (args.Key == " " || args.Key == "Enter")
     {
         action?.Invoke();
     }
 }
Exemplo n.º 10
0
        protected override void KeyboardWillShow(object sender, UIKeyboardEventArgs e)
        {
            // this bit of code depends on the knowledge of the component tree:
            // - description label is inside of a container view which is placed in a stack view
            // - we want to know the vertical location of the container view in the whole view
            // - we actually want to know the Y coordinate of the bottom of the container and make
            //   sure we don't overaly it with the keyboard
            var container                   = DescriptionTextView.Superview;
            var absoluteLocation            = View.ConvertPointFromView(container.Frame.Location, container.Superview);
            var minimumVisibleContentHeight = View.Frame.Height - absoluteLocation.Y - container.Frame.Height;

            var coveredByKeyboard = e.FrameEnd.Height - minimumVisibleContentHeight;

            if (coveredByKeyboard < 0)
            {
                return;
            }

            var safeAreaOffset = UIDevice.CurrentDevice.CheckSystemVersion(11, 0)
                ? Math.Max(UIApplication.SharedApplication.KeyWindow.SafeAreaInsets.Top, UIApplication.SharedApplication.StatusBarFrame.Height)
                : 0;
            var distanceFromTop = Math.Max(safeAreaOffset, View.Frame.Y - coveredByKeyboard);

            View.Frame = new CGRect(View.Frame.X, distanceFromTop, View.Frame.Width, View.Frame.Height);
            UIView.Animate(Animation.Timings.EnterTiming, View.LayoutIfNeeded);
        }
Exemplo n.º 11
0
        private void OnKeyboardWillShow(object sender, UIKeyboardEventArgs e)
        {
            if (!IsViewLoaded || _isKeyboardShown)
            {
                return;
            }

            _isKeyboardShown = true;
            var activeView = View.FindFirstResponder();

            if (activeView == null)
            {
                return;
            }
            var keyboardFrame = UIKeyboard.FrameEndFromNotification(e.Notification);
            var isOverlapping = activeView.IsKeyboardOverlapping(View, keyboardFrame);

            if (!isOverlapping)
            {
                return;
            }

            _activeViewBottom = activeView.GetViewRelativeBottom(View);
            ShiftPageUp(keyboardFrame.Height, _activeViewBottom);
        }
Exemplo n.º 12
0
        private void KeyboardShowCallback(object sender, UIKeyboardEventArgs args)
        {
            softKeyboard.Visible = true;
            var screen = UIScreen.MainScreen.Bounds;
            var isOrientationDependent = UIDevice.CurrentDevice.CheckSystemVersion(8, 0) ||
                                         Application.CurrentDeviceOrientation == DeviceOrientation.Portrait;

            if (isOrientationDependent)
            {
                softKeyboard.Height = (float)(screen.Bottom - args.FrameEnd.Top);
            }
            else
            {
                switch (Application.CurrentDeviceOrientation)
                {
                case DeviceOrientation.PortraitUpsideDown:
                    softKeyboard.Height = (float)args.FrameEnd.Bottom;
                    break;

                case DeviceOrientation.LandscapeLeft:
                    softKeyboard.Height = (float)(screen.Right - args.FrameEnd.Left);
                    break;

                case DeviceOrientation.LandscapeRight:
                    softKeyboard.Height = (float)args.FrameEnd.Right;
                    break;
                }
            }
        }
Exemplo n.º 13
0
        System.nfloat GetKeyboardSize(UIKeyboardEventArgs args)
        {
            NSValue result       = (NSValue)args.Notification.UserInfo.ObjectForKey(new NSString(UIKeyboard.FrameEndUserInfoKey));
            CGSize  keyboardSize = result.RectangleFValue.Size;

            return(keyboardSize.Height);
        }
Exemplo n.º 14
0
 void OnHideKeyboard(object sender, UIKeyboardEventArgs args)
 {
     if (Element != null)
     {
         Element.Margin = new Thickness(0);
     }
 }
Exemplo n.º 15
0
 void OnShowKeyboard(object sender, UIKeyboardEventArgs args)
 {
     if (Element != null)
     {
         Element.Margin = new Thickness(0, 0, 0, GetKeyboardSize(args));
     }
 }
Exemplo n.º 16
0
 protected void Escape(UIKeyboardEventArgs e)
 {
     if (e.Key.ToLower() == "escape" && IsOpen == true)
     {
         Dropdown.Hide();
     }
 }
Exemplo n.º 17
0
        void UpdateButtomLayoutConstraint(UIKeyboardEventArgs e)
        {
            UIViewAnimationCurve curve = e.AnimationCurve;

            if (UIDevice.CurrentDevice.CheckSystemVersion(11, 0))
            {
                UIView.Animate(e.AnimationDuration, 0, ConvertToAnimationOptions(e.AnimationCurve), () =>
                {
                    nfloat offsetFromBottom = toolbar.Frame.GetMaxY() - e.FrameEnd.GetMinY();
                    offsetFromBottom        = NMath.Max(0, offsetFromBottom);
                    if (++notifCount >= 2)
                    {
                        SetToolbarContstraint(-offsetFromBottom);
                    }
                }, null);
            }
            else
            {
                UIView.Animate(e.AnimationDuration, 0, ConvertToAnimationOptions(e.AnimationCurve), () =>
                {
                    nfloat offsetFromBottom = tableView.Frame.GetMaxY() - e.FrameEnd.GetMinY();
                    offsetFromBottom        = NMath.Max(0, offsetFromBottom);
                    SetToolbarContstraint(offsetFromBottom);
                }, null);
            }
        }
Exemplo n.º 18
0
 public static async Task OnKey(string id, UIKeyboardEventArgs @event)
 {
     if (_terminals.ContainsKey(id))
     {
         await _terminals[id]?.OnKey.InvokeAsync(@event);
     }
 }
        protected override void KeyboardWillShow(object sender, UIKeyboardEventArgs e)
        {
            UIEdgeInsets contentInsets = new UIEdgeInsets(0, 0, e.FrameEnd.Height, 0);

            ScrollView.ContentInset          = contentInsets;
            ScrollView.ScrollIndicatorInsets = contentInsets;
        }
        /// <summary>
        /// Handles view animations when the keyboard is shown.
        /// </summary>
        /// <param name="e">The keyboard arguments for the event.</param>
        public override void AnimateOnShown(UIKeyboardEventArgs e)
        {
            bool shouldHideTopSection;
            int  translateY = this.CalculateVerticalTranslation(e.Notification, out shouldHideTopSection);

            if (translateY < 0)
            {
                Action topSectionAnimation;

                if (shouldHideTopSection)
                {
                    topSectionAnimation = () => this.topSection.Hide();
                }
                else
                {
                    topSectionAnimation = () => ViewAnimation.AnimateMoveVertical(e.AnimationDuration, translateY, this.topSection.Views);
                }

                ViewAnimation.AnimateMoveVertical(
                    e.AnimationDuration,
                    translateY,
                    topSectionAnimation,
                    this.bottomSection.Views);

                shouldAnimateOnHide = true;
            }
            else
            {
                shouldAnimateOnHide = false;
            }
        }
Exemplo n.º 21
0
        public void OnKeyDown(UIKeyboardEventArgs e)
        {
            string a = e.Key.ToLower();

            if (a.Contains("arrow"))
            {
                a = a.Replace("arrow", null);

                switch (a)
                {
                case "right":
                    SelectNeightbourCell(MoveDirection.right, e.CtrlKey);
                    break;

                case "left":
                    SelectNeightbourCell(MoveDirection.left, e.CtrlKey);
                    break;

                case "up":
                    SelectNeightbourCell(MoveDirection.up, e.CtrlKey);
                    break;

                case "down":
                    SelectNeightbourCell(MoveDirection.down, e.CtrlKey);
                    break;

                default:
                    break;
                }
            }
        }
Exemplo n.º 22
0
 protected void MaybeEnter(UIKeyboardEventArgs e)
 {
     if (!string.IsNullOrEmpty(currentTask) && e.Code == "Enter")
     {
         this.AddTask();
     }
 }
Exemplo n.º 23
0
        void OnKeyboardShow(object sender, UIKeyboardEventArgs args)
        {
            ReportPage page = Element as ReportPage;

            if (page == null)
            {
                return;
            }

            NSValue result = (NSValue)args.Notification.UserInfo.ObjectForKey(new NSString(UIKeyboard.FrameEndUserInfoKey));

            Console.WriteLine("Show Keyboard ReportPage " + result);
            CGSize keyboardSize = result.RectangleFValue.Size;

            Console.WriteLine(keyboardSize);

            if (savedBounds == false)
            {
                savedBounds = true;
                bounds      = Element.Bounds;
            }

            page.KeyboardChangeHandler(true);

            var newBounds = new Rectangle(bounds.Left, bounds.Top, bounds.Width, App.Current.MainPage.Height - keyboardSize.Height - 100);

            Element.Layout(newBounds);
        }
Exemplo n.º 24
0
        private void OnKeyboardWillShow(object sender, UIKeyboardEventArgs e)
        {
            var keyboardRect = ((NSValue)e.Notification.UserInfo.ObjectForKey(UIKeyboard.BoundsUserInfoKey)).RectangleFValue;
            var windowRect   = Windows.UI.Xaml.Window.Current.Bounds;

            _inputPane.OccludedRect = new Rect(0, windowRect.Height - keyboardRect.Height, keyboardRect.Width, keyboardRect.Height);
        }
Exemplo n.º 25
0
 private void OnKeyboardHide(object sender, UIKeyboardEventArgs args)
 {
     if (Element != null)
     {
         Element.Margin = _oldMargin;
     }
 }
Exemplo n.º 26
0
 protected void SearchBoxKeyPress(UIKeyboardEventArgs ev)
 {
     if (ev.Key == "Enter")
     {
         SearchClick();
     }
 }
Exemplo n.º 27
0
 public async Task HandleEnterKey(UIKeyboardEventArgs args)
 {
     if (args.Key == "Enter")
     {
         await StartSearch();
     }
 }
Exemplo n.º 28
0
 protected async Task SaveKeyUpEnterAsync(UIKeyboardEventArgs e)
 {
     if (e.Key.ToLower() == "enter")
     {
         await SaveAsync();
     }
 }
Exemplo n.º 29
0
 void OnKeyboardHide(object sender, UIKeyboardEventArgs args)
 {
     //if (Element != null)
     //{
     //    Element.Margin = new Thickness(0); //set the margins to zero when keyboard is dismissed
     //}
 }
Exemplo n.º 30
0
 async Task KeyPress(UIKeyboardEventArgs e)
 {
     Console.WriteLine("KEY:" + e.Key);
     if (e.Key == "Enter")
     {
         await Search();
     }
 }
		private void Scroll (object sender, UIKeyboardEventArgs e, bool scale, bool returnToPreviousState = false)
		{
			UIView.BeginAnimations(string.Empty, IntPtr.Zero);
			UIView.SetAnimationCurve(e.AnimationCurve);
			UIView.SetAnimationDuration(e.AnimationDuration);
			if (returnToPreviousState)
				ChangeFrameSize(false);
			ChangeFrameSize (scale);

			UIView.CommitAnimations();
		}
Exemplo n.º 32
0
		void OnKeyboardWillChangeFrame (object sender, UIKeyboardEventArgs keyboardArg)
		{
			// Convert the keyboard frame from screen to view coordinates.
			var keyboardViewBeginFrame = View.ConvertRectFromView (keyboardArg.FrameBegin, View.Window);
			var keyboardViewEndFrame = View.ConvertRectFromView (keyboardArg.FrameEnd, View.Window);
			var originDelta = keyboardViewEndFrame.Y - keyboardViewBeginFrame.Y;

			// The text view should be adjusted, update the constant for this constraint.
			TextViewBottomLayoutGuideConstraint.Constant -= originDelta;
			View.SetNeedsUpdateConstraints ();

			UIView.Animate (keyboardArg.AnimationDuration, 0, UIViewAnimationOptions.BeginFromCurrentState, View.LayoutIfNeeded, null);

			// Scroll to the selected text once the keyboard frame changes.
			NSRange selectedRange = TextView.SelectedRange;
			TextView.ScrollRangeToVisible (selectedRange);
		}
Exemplo n.º 33
0
		void KeyboardHideHandler (object sender, UIKeyboardEventArgs e)
		{
			GoToNormalLayout ();
		}
Exemplo n.º 34
0
		void OnKeyboardNotification (UIKeyboardEventArgs e)
		{
			//Check if the keyboard is becoming visible
			bool willShow = e.Notification.Name == UIKeyboard.WillShowNotification;

			//Start an animation, using values from the keyboard
			UIView.BeginAnimations("AnimateForKeyboard");
			UIView.SetAnimationDuration(e.AnimationDuration);
			UIView.SetAnimationCurve(e.AnimationCurve);

			//Calculate keyboard height, etc.
			if (willShow)
			{
				var keyboardFrame = e.FrameEnd;
				var frame = TableView.Frame;
				frame.Height -= keyboardFrame.Height;
				TableView.Frame = frame;
				frame = toolbar.Frame;
				frame.Y -= keyboardFrame.Height;
				toolbar.Frame = frame;
			}
			else
			{
				var keyboardFrame = e.FrameBegin;
				var frame = TableView.Frame;
				frame.Height += keyboardFrame.Height;
				TableView.Frame = frame;
				frame = toolbar.Frame;
				frame.Y += keyboardFrame.Height;
				toolbar.Frame = frame;
			}

			//Commit the animation
			UIView.CommitAnimations();
			ScrollToEnd();
		}
 void UpdateButtomLayoutConstraint(UIKeyboardEventArgs e)
 {
     UIViewAnimationCurve curve = e.AnimationCurve;
     UIView.Animate (e.AnimationDuration, 0, ConvertToAnimationOptions (e.AnimationCurve), () => {
         nfloat offsetFromBottom = tableView.Frame.GetMaxY () - e.FrameEnd.GetMinY ();
         offsetFromBottom = NMath.Max (0, offsetFromBottom);
         SetToolbarContstraint (offsetFromBottom);
     }, null);
 }
Exemplo n.º 36
0
		static void OnKeyboardHidden(object sender, UIKeyboardEventArgs args)
		{
			var handler = KeyboardWillHide;
			if (handler != null)
				handler(sender, args);
		}
		void UpdateButtomLayoutConstraint(UIKeyboardEventArgs e)
		{
			UIViewAnimationCurve curve = e.AnimationCurve;
			UIView.Animate (e.AnimationDuration, 0, ConvertToAnimationOptions (e.AnimationCurve), () => {
//				SetToolbarContstraint(tableView.Frame.GetMaxY () - e.FrameEnd.GetMinY ());
				SetToolbarContstraint(e.FrameEnd.Height);

				// Move content with keyboard
				/*
				var oldOverlap = CalcContentOverlap();
				UpdateTableInsets ();
				var newOverlap = CalcContentOverlap();

				var offset = tableView.ContentOffset;
				offset.Y += newOverlap - oldOverlap;
				offset.Y = NMath.Max(offset.Y, 0);
				tableView.ContentOffset = offset;
				*/
			}, null);
		}
		void KeyboardWillHideHandler (object sender, UIKeyboardEventArgs e)
		{
			UpdateButtomLayoutConstraint (e);
		}
        //
        // When the keyboard appears, animate the new position for the entry
        // and scroll the chat to the bottom
        //
        void PlaceKeyboard(object sender, UIKeyboardEventArgs args)
        {
            UIView.BeginAnimations (""); {
                UIView.SetAnimationCurve (args.AnimationCurve);
                UIView.SetAnimationDuration (args.AnimationDuration);
                var viewFrame = View.Frame;
                var endRelative = View.ConvertRectFromView (args.FrameEnd, null);
                viewFrame.Height = endRelative.Y;
                View.Frame = viewFrame;
            } UIView.CommitAnimations ();

            ScrollToBottom (true);
            AdjustEntry ();
        }
Exemplo n.º 40
0
		static void OnKeyboardShown(object sender, UIKeyboardEventArgs args)
		{
			var handler = KeyboardWillShow;
			if (handler != null)
				handler(sender, args);
		}
Exemplo n.º 41
0
		void KeyboardShowHandler (object sender, UIKeyboardEventArgs e)
		{
			blendViewNormalHeight = NavBarBlendViewHeightConstraint.Constant;
			var keyboardEdge = View.Bounds.Height - e.FrameEnd.Height;

			// verticat space between Input and ContinueBtn
			var h = ContinueBtn.Frame.GetMinY () - Input.Frame.GetMaxY ();

			if (ContinueBtn.Frame.GetMaxY () + h > keyboardEdge) {
				nfloat continueBtnBottomOfsset = e.FrameEnd.Height + h;
				GoToCompactLayout (continueBtnBottomOfsset);
			}
		}
Exemplo n.º 42
0
		void OnKeyboardShown(object sender, UIKeyboardEventArgs args)
		{
			_lastKeyboardRect = args.FrameEnd;
			UpdateInsets();
		}
        // Here we will resize and move our UI when Keyboard Shows/Hides
        void KeyboardWillToggle(object sender, UIKeyboardEventArgs e)
        {
            var duration = e.AnimationDuration;
            var startFrame = e.FrameBegin;
            var endFrame = e.FrameEnd;
            int signCorrection = 1;

            if (startFrame.Y < 0 || startFrame.X < 0 || endFrame.Y < 0 || endFrame.X < 0)
                signCorrection = -1;

            var widthChange = (endFrame.X - startFrame.X) * signCorrection;
            var heightChange = (endFrame.Y - startFrame.Y) * signCorrection;
            //var sizeChange = heightChange; //UIDevice.CurrentDevice.Orientation == UIDeviceOrientation.Portrait ? heightChange : widthChange;
            var sizeChange = InterfaceOrientation == UIInterfaceOrientation.Portrait ? heightChange : widthChange;
            var newContainerFrame = container.Frame;
            newContainerFrame = new RectangleF (container.Frame.X, container.Frame.Y, container.Frame.Width, container.Frame.Height + sizeChange);
            var offsetY = Math.Max (0.0f, textView.ContentSize.Height - textView.Frame.Size.Height - sizeChange);
            var newTextViewContentOffset = new PointF (0, offsetY);
            UIView.Animate (duration, 0, UIViewAnimationOptions.BeginFromCurrentState, () => container.Frame = newContainerFrame, null);
            textView.SetContentOffset (newTextViewContentOffset, true);
        }
Exemplo n.º 44
0
		void OnKeyboardHidden(object sender, UIKeyboardEventArgs args)
		{
			_setInsetAction(new UIEdgeInsets(0, 0, 0, 0));
			_lastKeyboardRect = RectangleF.Empty;
		}
		private void OnKeyboardNotification (UIKeyboardEventArgs e)
		{
			KeyboardVisible = e.Notification.Name == UIKeyboard.WillShowNotification;
		}