Exemplo n.º 1
0
 /// <summary>
 /// Perform Focus animation Effect on the current Focused Item on ScrollContainer.
 /// </summary>
 /// <param name="scrollContainer">Scroll Container</param>
 /// <param name="direction">Direction</param>
 private void FocusAnimation(ScrollContainer scrollContainer, FocusEffectDirection direction)
 {
     _focusEffect.FocusAnimation(scrollContainer.GetCurrentFocusedActor(), scrollContainer.ItemSize, 1000, direction);
 }
Exemplo n.º 2
0
        /// <summary>
        /// Callback when the keyboard focus is going to be changed.
        /// </summary>
        /// <param name="source">FocusManager.Instance</param>
        /// <param name="e">event</param>
        /// <returns> The view to move the keyboard focus to.</returns>
        private View OnKeyboardPreFocusChangeSignal(object source, FocusManager.PreFocusChangeEventArgs e)
        {
            if (!e.CurrentView && !e.ProposedView)
            {
                return(_menuContainer);
            }

            View actor = _menuContainer.Container;

            if (e.Direction == View.FocusDirection.Up)
            {
                // Move the Focus to Poster ScrollContainer and hide Bottom Container (Menu ScrollContainer)
                if (_menuContainer.IsFocused)
                {
                    actor = _postersContainer[_currentPostersContainerID].GetCurrentFocusedActor();
                    _menuContainer.SetFocused(false);
                    _postersContainer[_currentPostersContainerID].SetFocused(true);
                    //HideBottomContainer();
                }
            }
            else if (e.Direction == View.FocusDirection.Down)
            {
                // Show Bottom Container (Menu ScrollContainer) and move the Focus to it
                if (!_menuContainer.IsFocused)
                {
                    ShowBottomContainer();
                    actor = _menuContainer.GetCurrentFocusedActor();
                    _postersContainer[_currentPostersContainerID].SetFocused(false);
                    _menuContainer.SetFocused(true);
                }
            }
            else
            {
                // Set the next focus view.
                actor = e.ProposedView;
            }

            if (e.Direction == View.FocusDirection.Left)
            {
                if (_menuContainer.IsFocused)
                {
                    int id = _menuContainer.FocusedItemID % _totalPostersContainers;
                    if (id != _currentPostersContainerID)
                    {
                        Hide(_postersContainer[_currentPostersContainerID]);
                        _currentPostersContainerID = id;

                        Show(_postersContainer[_currentPostersContainerID]);
                    }
                }
            }
            else if (e.Direction == View.FocusDirection.Right)
            {
                if (_menuContainer.IsFocused)
                {
                    int id = _menuContainer.FocusedItemID % _totalPostersContainers;
                    if (id != _currentPostersContainerID)
                    {
                        Hide(_postersContainer[_currentPostersContainerID]);
                        _currentPostersContainerID = id;
                        Show(_postersContainer[_currentPostersContainerID]);
                    }
                }
            }

            return((View)actor);
        }