public void ItemsLayouterRequestNextFocusableView() { tlog.Debug(tag, $"ItemsLayouterRequestNextFocusableView"); var view = new CollectionView(new List <string>() { "123", "456" }) { Header = new RecyclerViewItem(), Footer = new RecyclerViewItem(), IsGrouped = true, }; Assert.IsNotNull(view, "Should not be null"); #pragma warning disable Reflection // The code contains reflection view.GroupFooterTemplate = new DataTemplate(typeof(RecyclerViewItem)); #pragma warning restore Reflection // The code contains reflection #pragma warning disable Reflection // The code contains reflection view.GroupHeaderTemplate = new DataTemplate(typeof(RecyclerViewItem)); #pragma warning restore Reflection // The code contains reflection #pragma warning disable Reflection // The code contains reflection view.ItemTemplate = new DataTemplate(typeof(RecyclerViewItem)); #pragma warning restore Reflection // The code contains reflection var itemsLayouter = new ItemsLayouterImpl(); Assert.IsNotNull(itemsLayouter, "Should not be null"); itemsLayouter.Initialize(view); itemsLayouter.RequestLayout(100.0f); var source = new CustomGroupItemSource(view) { Position = 1, }; var orientationSize = itemsLayouter.CalculateLayoutOrientationSize(); tlog.Debug(tag, "orientationSize : " + orientationSize); var scrollPosition = itemsLayouter.CalculateCandidateScrollPosition(0.0f); tlog.Debug(tag, "scrollPosition : " + scrollPosition); itemsLayouter.NotifyItemRangeInserted(source, 0, 10); itemsLayouter.RequestNextFocusableView(view, View.FocusDirection.Up, true); itemsLayouter.RequestNextFocusableView(view, View.FocusDirection.Down, true); itemsLayouter.RequestNextFocusableView(view, View.FocusDirection.PageUp, true); itemsLayouter.RequestNextFocusableView(view, View.FocusDirection.PageDown, true); itemsLayouter.RequestNextFocusableView(view, View.FocusDirection.Left, true); itemsLayouter.RequestNextFocusableView(view, View.FocusDirection.Right, true); view.Dispose(); itemsLayouter.Dispose(); source.Dispose(); tlog.Debug(tag, $"ItemsLayouterRequestNextFocusableView END (OK)"); }
public void ItemsLayouterCalculateLayoutOrientationSize() { tlog.Debug(tag, $"ItemsLayouterCalculateLayoutOrientationSize START"); var view = new CollectionView(new List <string>() { "123", "456", "789" }) { Header = new RecyclerViewItem(), Footer = new RecyclerViewItem(), IsGrouped = true, }; Assert.IsNotNull(view, "Should not be null"); #pragma warning disable Reflection // The code contains reflection view.GroupFooterTemplate = new DataTemplate(typeof(RecyclerViewItem)); #pragma warning restore Reflection // The code contains reflection #pragma warning disable Reflection // The code contains reflection view.GroupHeaderTemplate = new DataTemplate(typeof(RecyclerViewItem)); #pragma warning restore Reflection // The code contains reflection #pragma warning disable Reflection // The code contains reflection view.ItemTemplate = new DataTemplate(typeof(RecyclerViewItem)); #pragma warning restore Reflection // The code contains reflection var itemsLayouter = new ItemsLayouterImpl(); Assert.IsNotNull(itemsLayouter, "Should not be null"); itemsLayouter.Initialize(view); try { itemsLayouter.CalculateLayoutOrientationSize(); } catch (Exception e) { tlog.Debug(tag, e.Message.ToString()); Assert.Fail("Caught Exception : Failed!"); } view.Dispose(); itemsLayouter.Dispose(); tlog.Debug(tag, $"ItemsLayouterCalculateLayoutOrientationSize END (OK)"); }