public override void DidUpdateFocus (UIFocusUpdateContext context, UIFocusAnimationCoordinator coordinator)
		{
			var nextFocusedView = context.NextFocusedView;

			if (!nextFocusedView.IsDescendantOfView (TableView))
				return;

			NSIndexPath indexPath = ((UITableViewFocusUpdateContext)context).NextFocusedIndexPath;
			if (indexPath == null)
				return;

			// Cancel any previously queued segues.
			delayedSeguesOperationQueue.CancelAllOperations ();

			// Create an `NSBlockOperation` to perform the detail segue after a delay.
			var performSegueOperation = new NSBlockOperation ();
			var segueIdentifier = SegueIdentifierMap[indexPath.Section][indexPath.Row];

			performSegueOperation.AddExecutionBlock (() => {
				NSThread.SleepFor (performSegueDelay);
				if (performSegueOperation.IsCancelled && segueIdentifier == lastPerformedSegueIdentifier)
					return;

				NSOperationQueue.MainQueue.AddOperation (() => {
					PerformSegue (segueIdentifier, nextFocusedView);
					lastPerformedSegueIdentifier = segueIdentifier;
					TableView.SelectRow (indexPath, true, UITableViewScrollPosition.None);
				});
			});

			delayedSeguesOperationQueue.AddOperation (performSegueOperation);
		}
示例#2
0
 public override void DidUpdateFocus(UIFocusUpdateContext context, UIFocusAnimationCoordinator coordinator)
 {
     //Console.WriteLine($"prev focus:{context.PreviouslyFocusedItem}, next focus:{context.NextFocusedItem}");
     base.DidUpdateFocus(context, coordinator);
     //Console.WriteLine(context);
     if (!Focused)
     {
         Animate(.2f, () =>
         {
             Transform = CGAffineTransform.MakeScale(1F, 1F);
             SongArtistLabel.TextColor  = UIColor.White;
             SongTitleLabel.TextColor   = UIColor.White;
             BackGround.BackgroundColor = UIColor.Black;
             BackGround.Alpha           = .2f;
         });
     }
     else
     {
         Animate(.2f, () =>
         {
             Transform = CGAffineTransform.MakeScale(1.1f, 1.1f);
             SongArtistLabel.TextColor  = UIColor.Black;
             SongTitleLabel.TextColor   = UIColor.Black;
             BackGround.BackgroundColor = UIColor.White;
             BackGround.Alpha           = .80f;
         });
     }
 }
示例#3
0
        /// <summary>
        /// Called after the Focus Engine has been called to change the Focus from an existing item
        /// to a new item.
        /// </summary>
        /// <param name="context">The context of the movement.</param>
        /// <param name="coordinator">An Animation Coordinator that you can use to animat the focus change.</param>
        /// <remarks>We are telling the Focus Guide where to move focus to from this method.</remarks>
        public override void DidUpdateFocus(UIFocusUpdateContext context, UIFocusAnimationCoordinator coordinator)
        {
            base.DidUpdateFocus(context, coordinator);

            // Get next focusable item from context
            var nextFocusableItem = context.NextFocusedView;

            // Anything to process?
            if (nextFocusableItem == null)
            {
                return;
            }

            // Decide the next focusable item based on the current
            // item with focus
            if (nextFocusableItem == MoreInfoButton)
            {
                // Move from the More Info to Buy button
                FocusGuide.PreferredFocusedView = BuyButton;
            }
            else if (nextFocusableItem == BuyButton)
            {
                // Move from the Buy to the More Info button
                FocusGuide.PreferredFocusedView = MoreInfoButton;
            }
            else
            {
                // No valid move
                FocusGuide.PreferredFocusedView = null;
            }
        }
示例#4
0
        public override void DidUpdateFocus(UIFocusUpdateContext context, UIFocusAnimationCoordinator coordinator)
        {
            var nextItem = context.NextFocusedView as SongCollectionViewCellNew;

            if (nextItem != null)
            {
                SongFocused?.Invoke(this, nextItem.Song);
            }
        }
示例#5
0
        /// <summary>
        /// The focus has moved to a new control. Track the focused button
        /// if it's one of ours.
        /// </summary>
        /// <param name="context">Focus update context.</param>
        /// <param name="coordinator">Focus animation coordinator.</param>
        public override void DidUpdateFocus(UIFocusUpdateContext context, UIFocusAnimationCoordinator coordinator)
        {
            base.DidUpdateFocus(context, coordinator);

            var buttons = Subviews.Cast <MenuButton>().ToList();

            for (int i = 0; i < buttons.Count; i++)
            {
                if (context.NextFocusedView == buttons[i])
                {
                    FocusedButtonIndex = i;
                }
            }
        }
		public override void DidUpdateFocus (UIFocusUpdateContext context, UIFocusAnimationCoordinator coordinator)
		{
			base.DidUpdateFocus (context, coordinator);

			var nextFocusedView = context.NextFocusedView;
			if (nextFocusedView == null)
				return;

			if (nextFocusedView == TopRightButton)
				focusGuide.PreferredFocusedView = BottomLeftButton;
			else if (nextFocusedView == BottomLeftButton)
				focusGuide.PreferredFocusedView = TopRightButton;
			else
				focusGuide.PreferredFocusedView = null;
		}
		public override void DidUpdateFocus (UIFocusUpdateContext context, UIFocusAnimationCoordinator coordinator)
		{
			var previousItem = context.PreviouslyFocusedView as CityCollectionViewCell;
			if (previousItem != null) {
				Animate (0.2, () => {
					previousItem.CityTitle.Alpha = 0.0f;
				});
			}

			var nextItem = context.NextFocusedView as CityCollectionViewCell;
			if (nextItem != null) {
				Animate (0.2, () => {
					nextItem.CityTitle.Alpha = 1.0f;
				});
			}
		}
示例#8
0
        /// <summary>
        /// Focus has changed for this control. Update the background color to
        /// match the style in the config.
        /// </summary>
        /// <param name="context">Focus update context.</param>
        /// <param name="coordinator">Focus animation coordinator.</param>
        public override void DidUpdateFocus(UIFocusUpdateContext context, UIFocusAnimationCoordinator coordinator)
        {
            base.DidUpdateFocus(context, coordinator);

            if (context.NextFocusedView == this)
            {
                coordinator.AddCoordinatedAnimations(() =>
                {
                    BackgroundColor = Crex.Application.Current.Config.Buttons.FocusedBackgroundColor.AsUIColor();
                }, null);
            }
            else
            {
                coordinator.AddCoordinatedAnimations(() =>
                {
                    BackgroundColor = Crex.Application.Current.Config.Buttons.UnfocusedBackgroundColor.AsUIColor();
                }, null);
            }
        }
示例#9
0
        /// <summary>
        /// The focus has updated. Update this cell to reflect whether it has
        /// focus or not.
        /// </summary>
        /// <param name="context">The focus context.</param>
        /// <param name="coordinator">The animation coordinator.</param>
        public override void DidUpdateFocus(UIFocusUpdateContext context, UIFocusAnimationCoordinator coordinator)
        {
            base.DidUpdateFocus(context, coordinator);

            if (context.NextFocusedView == this)
            {
                coordinator.AddCoordinatedAnimations(() =>
                {
                    ContentView.BackgroundColor = "#32ffffff".AsUIColor();
                }, null);
            }
            else
            {
                coordinator.AddCoordinatedAnimations(() =>
                {
                    ContentView.BackgroundColor = UIColor.Clear;
                }, null);
            }
        }
示例#10
0
        public override void DidUpdateFocus(UIFocusUpdateContext context, UIFocusAnimationCoordinator coordinator)
        {
            var previousItem = context.PreviouslyFocusedView as CityCollectionViewCell;

            if (previousItem != null)
            {
                Animate(0.2, () => {
                    previousItem.CityTitle.Alpha = 0.0f;
                });
            }

            var nextItem = context.NextFocusedView as CityCollectionViewCell;

            if (nextItem != null)
            {
                Animate(0.2, () => {
                    nextItem.CityTitle.Alpha = 1.0f;
                });
            }
        }
        /// <summary>
        /// Called when the focus shifts from one Collection View Cell to another.
        /// </summary>
        /// <param name="context">Context.</param>
        /// <param name="coordinator">Coordinator.</param>
        /// <remarks>We are using this method to highligh the currently In-Focus picture.</remarks>
        public override void DidUpdateFocus(UIFocusUpdateContext context, UIFocusAnimationCoordinator coordinator)
        {
            var previousItem = context.PreviouslyFocusedView as SearchResultViewCell;

            if (previousItem != null)
            {
                UIView.Animate(0.2, () => {
                    previousItem.TextColor = UIColor.LightGray;
                });
            }

            var nextItem = context.NextFocusedView as SearchResultViewCell;

            if (nextItem != null)
            {
                UIView.Animate(0.2, () => {
                    nextItem.TextColor = UIColor.Black;
                });
            }
        }
        public override void DidUpdateFocus(UIFocusUpdateContext context, UIFocusAnimationCoordinator coordinator)
        {
            pairingsLabel.TextColor = UIColor.Black;
            dairlyLabel.TextColor   = UIColor.Black;
            makingOfLabel.TextColor = UIColor.Black;

            if (context.NextFocusedView == pairingButton)
            {
                pairingsLabel.TextColor = UIColor.White;
            }
            else if (context.NextFocusedView == dairyButton)
            {
                dairlyLabel.TextColor = UIColor.White;
            }
            else if (context.NextFocusedView == makingButton)
            {
                makingOfLabel.TextColor = UIColor.White;
            }

            base.DidUpdateFocus(context, coordinator);
        }
        public override void DidUpdateFocus(UIFocusUpdateContext context, UIFocusAnimationCoordinator coordinator)
        {
            var nextFocusedView = context.NextFocusedView;

            if (!nextFocusedView.IsDescendantOfView(TableView))
            {
                return;
            }

            NSIndexPath indexPath = ((UITableViewFocusUpdateContext)context).NextFocusedIndexPath;

            if (indexPath == null)
            {
                return;
            }

            // Cancel any previously queued segues.
            delayedSeguesOperationQueue.CancelAllOperations();

            // Create an `NSBlockOperation` to perform the detail segue after a delay.
            var performSegueOperation = new NSBlockOperation();
            var segueIdentifier       = SegueIdentifierMap[indexPath.Section][indexPath.Row];

            performSegueOperation.AddExecutionBlock(() => {
                NSThread.SleepFor(performSegueDelay);
                if (performSegueOperation.IsCancelled && segueIdentifier == lastPerformedSegueIdentifier)
                {
                    return;
                }

                NSOperationQueue.MainQueue.AddOperation(() => {
                    PerformSegue(segueIdentifier, nextFocusedView);
                    lastPerformedSegueIdentifier = segueIdentifier;
                    TableView.SelectRow(indexPath, true, UITableViewScrollPosition.None);
                });
            });

            delayedSeguesOperationQueue.AddOperation(performSegueOperation);
        }
示例#14
0
		/// <summary>
		/// Called after the Focus Engine has been called to change the Focus from an existing item
		/// to a new item.
		/// </summary>
		/// <param name="context">The context of the movement.</param>
		/// <param name="coordinator">An Animation Coordinator that you can use to animat the focus change.</param>
		/// <remarks>We are telling the Focus Guide where to move focus to from this method.</remarks>
		public override void DidUpdateFocus (UIFocusUpdateContext context, UIFocusAnimationCoordinator coordinator)
		{
			base.DidUpdateFocus (context, coordinator);

			// Get next focusable item from context
			var nextFocusableItem = context.NextFocusedView;

			// Anything to process?
			if (nextFocusableItem == null) return;

			// Decide the next focusable item based on the current
			// item with focus
			if (nextFocusableItem == MoreInfoButton) {
				// Move from the More Info to Buy button
				FocusGuide.PreferredFocusedView = BuyButton;
			} else if (nextFocusableItem == BuyButton) {
				// Move from the Buy to the More Info button
				FocusGuide.PreferredFocusedView = MoreInfoButton;
			} else {
				// No valid move
				FocusGuide.PreferredFocusedView = null;
			}
		}
示例#15
0
        public override void DidUpdateFocus(UIFocusUpdateContext context, UIFocusAnimationCoordinator coordinator)
        {
            base.DidUpdateFocus(context, coordinator);

            UIView nextFocusableItem = context.NextFocusedView;

            if (nextFocusableItem == null)
            {
                return;
            }

            if (nextFocusableItem.Equals(OnOffBtn))
            {
                _focusGuide.PreferredFocusedView = MenuIcon;
            }
            else if (nextFocusableItem.Equals(MenuIcon))
            {
                _focusGuide.PreferredFocusedView = OnOffBtn;
            }
            else
            {
                _focusGuide.PreferredFocusedView = null;
            }
        }
        public override void DidUpdateFocus(UIFocusUpdateContext context, UIFocusAnimationCoordinator coordinator)
        {
            var previousItem = context.PreviouslyFocusedView as SkinViewCell;

            if (previousItem != null)
            {
                Animate(0.5, () =>
                {
                    previousItem.NameLabel.Font  = UIFont.SystemFontOfSize(25);
                    previousItem.NameLabel.Frame = new CGRect(0, 150, Frame.Width, 35);
                });
            }

            var nextItem = context.NextFocusedView as SkinViewCell;

            if (nextItem != null)
            {
                Animate(0.5, () =>
                {
                    nextItem.NameLabel.Font  = UIFont.SystemFontOfSize(30);
                    nextItem.NameLabel.Frame = new CGRect(0, 170, Frame.Width, 40);
                });
            }
        }
        public override void DidUpdateFocus(UIFocusUpdateContext context, UIFocusAnimationCoordinator coordinator)
        {
            base.DidUpdateFocus(context, coordinator);

            var nextFocusedView = context.NextFocusedView;

            if (nextFocusedView == null)
            {
                return;
            }

            if (nextFocusedView == TopRightButton)
            {
                focusGuide.PreferredFocusedView = BottomLeftButton;
            }
            else if (nextFocusedView == BottomLeftButton)
            {
                focusGuide.PreferredFocusedView = TopRightButton;
            }
            else
            {
                focusGuide.PreferredFocusedView = null;
            }
        }
示例#18
0
        public override void DidUpdateFocus(UIFocusUpdateContext context, UIFocusAnimationCoordinator coordinator)
        {
            var prev = context.PreviouslyFocusedView as CheeseViewCell;

            if (prev != null)
            {
                Animate(0.2, () =>
                {
                    prev.CheeseName.Alpha = 0.0f;
                    prev.CheeseImage.Layer.BorderWidth = (nfloat)4.0;
                });
            }

            var next = context.NextFocusedView as CheeseViewCell;

            if (next != null)
            {
                Animate(0.2, () =>
                {
                    next.CheeseName.Alpha = 1.0f;
                    next.CheeseImage.Layer.BorderWidth = (nfloat)0.0;
                });
            }
        }
示例#19
0
 public override void DidUpdateFocus(UIFocusUpdateContext context, UIFocusAnimationCoordinator coordinator)
 {
     coordinator.AddCoordinatedAnimations(() => {
         Label.Alpha = Focused ? 0f : 1f;
     }, null);
 }
        public override void DidUpdateFocus(UIFocusUpdateContext context, UIFocusAnimationCoordinator coordinator)
        {
            base.DidUpdateFocus(context, coordinator);

            this.TableView.ReloadData();
        }
		public override void DidUpdateFocus (UIFocusUpdateContext context, UIFocusAnimationCoordinator coordinator)
		{
			coordinator.AddCoordinatedAnimations (() => {
				Label.Alpha = Focused ? 0f : 1f;
			}, null);
		}
        /// <summary>
        /// Called when the focus shifts from one Collection View Cell to another.
        /// </summary>
        /// <param name="context">Context.</param>
        /// <param name="coordinator">Coordinator.</param>
        /// <remarks>We are using this method to highligh the currently In-Focus picture.</remarks>
        public override void DidUpdateFocus(UIFocusUpdateContext context, UIFocusAnimationCoordinator coordinator)
        {
            var previousItem = context.PreviouslyFocusedView as SearchResultViewCell;
            if (previousItem != null) {
                UIView.Animate (0.2, () => {
                    previousItem.TextColor = UIColor.LightGray;
                });
            }

            var nextItem = context.NextFocusedView as SearchResultViewCell;
            if (nextItem != null) {
                UIView.Animate (0.2, () => {
                    nextItem.TextColor = UIColor.Black;
                });
            }
        }