コード例 #1
0
        /// <inheritdoc />
        public void SetConflicts(IReadOnlyList <IChangeEntryData> list)
        {
            Assert.IsNotNull(m_Presenter, "Invalid state while creating conflict list.");

            // Initialise conflicts group
            if (m_EntryConflictsGroup == null)
            {
                var conflictsList = new AdapterListView {
                    name = StringAssets.changeListConflictedList, SelectionType = SelectionType.None
                };
                conflictsList.AddToClassList(ListViewUssClassName);
                m_ConflictedChangeListAdapter = new ConflictedChangeListAdapter(m_Presenter);
                conflictsList.SetAdapter(m_ConflictedChangeListAdapter);
                m_EntryConflictsGroup = new ChangeEntryGroup(conflictsList)
                {
                    Title = StringAssets.changeListConflictedHeader
                };
                m_EntryConflictsGroup.SetOverflowCallback(m_Presenter.OnClickConflictGroupOverflow);
                m_EntryConflictsGroup.SetRefreshCallback(m_Presenter.OnClickGroupRefresh);
                m_EntryConflictsGroup.Searching = m_Presenter.Searching;
            }
            Assert.IsTrue(m_ConflictedChangeListAdapter != null && m_EntryConflictsGroup != null, "Invalid state while setting conflicted list.");

            // Ensure conflict list is displayed
            if (m_ActiveGroup != m_EntryConflictsGroup)
            {
                m_ActiveGroup?.RemoveFromHierarchy();
                m_EntryGroupsContainer.Add(m_EntryConflictsGroup);
                m_ActiveGroup = m_EntryConflictsGroup;
            }

            m_ConflictedChangeListAdapter.List = list;
            var count = m_Presenter.ConflictedCount;

            m_EntryConflictsGroup.NumberMenuItems    = m_Presenter.ConflictGroupOverflowEntryCount;
            m_EntryConflictsGroup.SelectedEntryCount = count;
            m_EntryConflictsGroup.EntryCount         = count;
        }
コード例 #2
0
        /// <inheritdoc />
        public void SetChanges(IReadOnlyList <IChangeEntryData> list)
        {
            Assert.IsNotNull(m_Presenter, "Invalid state while creating toggleable list.");

            // Initialise the toggleable list if not already initialised.
            if (m_EntryToggleableGroup == null)
            {
                var toggleableListView = new AdapterListView {
                    SelectionType = SelectionType.None
                };
                toggleableListView.AddToClassList(ListViewUssClassName);
                m_ToggleableChangeListAdapter = new ToggleableChangeListAdapter(m_Presenter);
                toggleableListView.SetAdapter(m_ToggleableChangeListAdapter);
                m_EntryToggleableGroup = new ChangeEntryGroup(toggleableListView)
                {
                    Title = StringAssets.changeListFullHeader
                };
                m_EntryToggleableGroup.SetOverflowCallback(m_Presenter.OnClickGroupOverflow);
                m_EntryToggleableGroup.SetRefreshCallback(m_Presenter.OnClickGroupRefresh);
                m_EntryToggleableGroup.Searching = m_Presenter.Searching;
            }
            Assert.IsTrue(m_ToggleableChangeListAdapter != null && m_EntryToggleableGroup != null, "Invalid state while setting toggleable list");

            // Ensure single list is displayed
            if (m_ActiveGroup != m_EntryToggleableGroup)
            {
                m_ActiveGroup?.RemoveFromHierarchy();
                m_EntryGroupsContainer.Add(m_EntryToggleableGroup);
                m_ActiveGroup = m_EntryToggleableGroup;
            }

            // Can use list.Count here since searching hides "All".
            m_EntryToggleableGroup.EntryCount         = m_Presenter.Searching ? list.Count : m_Presenter.TotalCount;
            m_ToggleableChangeListAdapter.List        = list;
            m_EntryToggleableGroup.NumberMenuItems    = m_Presenter.GroupOverflowEntryCount;
            m_EntryToggleableGroup.SelectedEntryCount = m_Presenter.ToggledCount;
        }