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; }); } }
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); }
/// <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; } }
public override void DidUpdateFocus(UIFocusUpdateContext context, UIFocusAnimationCoordinator coordinator) { var nextItem = context.NextFocusedView as SongCollectionViewCellNew; if (nextItem != null) { SongFocused?.Invoke(this, nextItem.Song); } }
/// <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; }); } }
/// <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); } }
/// <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); } }
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); }
/// <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; } }
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; } }
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; }); } }
public override void DidUpdateFocus(UITableView tableView, UITableViewFocusUpdateContext context, UIFocusAnimationCoordinator coordinator) { var ec = (context.NextFocusedItem as EpisodeCell); if (ec != null) { showEntriesViewController.Configure(ec); } }
void DidUpdateFocus(UITableView tableView, UITableViewFocusUpdateContext focusUpdateContext, UIFocusAnimationCoordinator animationCoordinator) { NSIndexPath indexPath = focusUpdateContext.NextFocusedIndexPath; if (indexPath == null || PosterData?.Items?.Count == 0) { return; } if (ListViewImages == null || ListViewImages[indexPath.Row] == null) { // // Create and set a temporary 1 pixel by 1 pixel transparent bitmap image. // PosterImageView.Hidden = true; // // Start a background task to load the image. // Task.Run(async() => { // // Load the image. // var client = new System.Net.Http.HttpClient(); var image = await Utility.LoadImageFromUrlAsync(Crex.Application.Current.GetAbsoluteUrl(PosterData.Items[indexPath.Row].Image.BestMatch)); // // Store the image in our cache. // ListViewImages[indexPath.Row] = image; // // Update the UI. // InvokeOnMainThread(() => { NSIndexPath highlightedIndexPath = NSIndexPath.FromRowSection(-1, 0); for (int i = 0; i < PosterData.Items.Count; i++) { var cell = ListView.CellAt(NSIndexPath.FromRowSection(i, 0)); if (cell != null && cell.Focused) { highlightedIndexPath = NSIndexPath.FromRowSection(i, 0); break; } } if (highlightedIndexPath.Row == indexPath.Row) { if (PosterImageView.Hidden == true) { PosterImageView.Alpha = 0; PosterImageView.Hidden = false; UIView.Animate(Crex.Application.Current.Config.AnimationTime.Value / 1000.0f, () => { PosterImageView.Alpha = 1; }); } PosterImageView.Image = image; } }); }); } else { if (PosterImageView.Hidden == true) { PosterImageView.Alpha = 0; PosterImageView.Hidden = false; UIView.Animate(Crex.Application.Current.Config.AnimationTime.Value / 1000.0f, () => { PosterImageView.Alpha = 1; }); } PosterImageView.Image = ListViewImages[indexPath.Row]; } // // Update the text content about the item. // DetailLeftView.Text = PosterData.Items[indexPath.Row].DetailLeft; DetailRightView.Text = PosterData.Items[indexPath.Row].DetailRight; DescriptionView.Text = PosterData.Items[indexPath.Row].Description; }
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); }
public void DidUpdateFocus(UITableView tableView, UITableViewFocusUpdateContext context, UIFocusAnimationCoordinator coordinator) { var sc = (context.NextFocusedItem as SessionCell); if (sc != null) { var indexPath = tableView.IndexPathForCell(sc); var startDate = EventDates.ElementAt(indexPath.Section); var dateSessions = Sessions.Where(s => s.Starts.GetValueOrDefault().Date == startDate); var session = dateSessions.ElementAt(indexPath.Row); // trackLabel.Text = $"Track: {session.Track ?? "-"}"; startsLabel.Text = $"Starts: {session.Starts.GetValueOrDefault().ToLongTimeString()}"; descriptionTextView.Text = session.CleanBody; } }
/// <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; }); } }