public BaseMapSectionLabel SetFirstItemActive() { foreach (BaseMapSectionLabel label in optionLabels) { label.Normalize(); } if (optionLabels.Count > 0) { BaseMapSectionLabel label = optionLabels[0]; label.Highlight(); return(label); } return(null); }
public void SetInitialItem(Section section) { foreach (BaseMapSectionMenuItem view in views) { if (view.Section.Equals(section)) { if (section.Type == SectionType.Language) { currentLanguage = view.SetFirstItemActive(); } else { current = view.SetFirstItemActive(); } } } }
public override bool OnTouchEvent(MotionEvent e) { MotionEventActions action = e.Action; int x = (int)e.GetX(); int y = (int)e.GetY(); if (e.Action == MotionEventActions.Up) { bool isInBox = false; foreach (BaseMapSectionMenuItem item in views) { Rect outerRect = item.HitRect; if (outerRect.Contains(x, y)) { isInBox = true; int headerHeight = item.HeaderHeight; if (!item.Enabled) { return(true); } foreach (BaseMapSectionLabel option in item.Options) { if (option.GetGlobalRect(headerHeight, outerRect).Contains(x, y)) { if (item.Section.Type == SectionType.Language) { if (currentLanguage != null) { currentLanguage.Normalize(); } option.Highlight(); currentLanguage = option; } else { if (current != null) { current.Normalize(); } option.Highlight(); current = option; } if (SelectionChange != null) { SelectionChange(null, new OptionEventArgs { Section = item.Section, Option = option }); } } } } } if (!isInBox) { Hide(); } } return(true); }