/// <summary> /// Initializes a new instance of the <see cref="DrawerView"/> class /// </summary> /// <param name="isPopover">A value that indicates wherher the drawer overlaps the content or not. </param> public DrawerView(bool isPopover) { _drawerViewGroup = new ViewGroup() { WidthSpecification = LayoutParamPolicies.MatchParent, HeightSpecification = LayoutParamPolicies.MatchParent, }; _contentViewGroup = new ViewGroup() { WidthSpecification = LayoutParamPolicies.MatchParent, HeightSpecification = LayoutParamPolicies.MatchParent, }; _backdropViewGroup = new ViewGroup(); _behavior = DrawerBehavior.Drawer; _isPopover = isPopover; Children.Add(_contentViewGroup); Children.Add(_backdropViewGroup); Children.Add(_drawerViewGroup); LayoutUpdated += OnLayoutUpdated; _drawerViewGroup.FocusGained += OnDrawerFocusGained; _drawerViewGroup.KeyEvent += OnDrawerKeyEventTriggered; _backdropViewGroup.TouchEvent += OnBackDropTouched; _contentViewGroup.FocusGained += OnContentFocusGained; _contentViewGroup.KeyEvent += OnContentKeyEventTriggered; }
/// <summary> /// Initializes a new instance of the <see cref="Tizen.UIExtensions.ElmSharp.TVNavigationDrawer"/> class. /// </summary> /// <param name="parent"></param> public TVNavigationDrawer(EvasObject parent) : base(parent) { SetLayoutCallback(OnLayout); _drawerBox = new EBox(parent); _drawerBox.Show(); PackEnd(_drawerBox); _mainBox = new EBox(parent); _mainBox.SetLayoutCallback(OnMainBoxLayout); _mainBox.Show(); PackEnd(_mainBox); _focusControlArea = new Button(parent) { Color = EColor.Transparent, BackgroundColor = EColor.Transparent }; _focusControlArea.SetEffectColor(EColor.Transparent); _focusControlArea.Show(); _mainBox.PackEnd(_focusControlArea); _behavior = Common.DrawerBehavior.Drawer; _drawerBox.KeyUp += (s, e) => { if (e.KeyName == "Return" || e.KeyName == "Right") { IsOpen = false; } }; _mainBox.KeyUp += (s, e) => { if (e.KeyName == "Left") { if (_focusControlArea.IsFocused) { IsOpen = true; } } else { // Workaround to prevent unexpected movement of the focus to drawer during page pushing. if (_behavior == DrawerBehavior.Locked) { _drawerBox.AllowTreeFocus = true; } } }; _mainBox.KeyDown += (s, e) => { if (e.KeyName != "Left") { // Workaround to prevent unexpected movement of the focus to drawer during page pushing. if (_behavior == DrawerBehavior.Locked) { _drawerBox.AllowTreeFocus = false; } } }; UpdateFocusPolicy(); }