Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(listview): [Android] Improve performance when updating list items #6789

Merged
merged 4 commits into from
Aug 20, 2021

Conversation

davidjohnoliver
Copy link
Contributor

GitHub Issue (If applicable): closes #6754

When a property of an item in the list changes, ensure that only that item container is remeasured.

PR Type

What kind of change does this PR introduce?

  • Bugfix

What is the current behavior?

What is the new behavior?

PR Checklist

Please check if your PR fulfills the following requirements:

Other information

Internal Issue (If applicable):

Fix LayoutInformation.GetAvailableSize() to return availabe size before view-related constraints (MaxWidth, MaxHeight etc), and also to update after MeasureOverride() is called, in line with UWP as well as WASM and Skia.
When a property of an item in the list changes, ensure that only that item container is remeasured.
@davidjohnoliver davidjohnoliver requested a review from a team August 17, 2021 16:19
@gitpod-io
Copy link

gitpod-io bot commented Aug 17, 2021

Ensure to call LayoutChild() every time, since the position may change even if measure hasn't changed (when scrolling, most obviously). Note that Android's internal layout caching logic ensures that ArrangeOverride() isn't called if not needed.
@nventive-devops
Copy link
Contributor

The build 32201 found UI Test snapshots differences: android-28-net6: 0, android-28-xamarin: 17, android-28-xamarin-Snap: 27, ios: 24, ios-Snap: 49, skia-gtk-screenshots: 42, wasm: 15, wasm-automated-net5.0-Benchmarks: 0, wasm-automated-net5.0-Default: 4, wasm-automated-net5.0-RuntimeTests: 0

Details
  • android-28-net6: 0 changed over 1

  • android-28-xamarin: 17 changed over 718

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • ComboBoxTests_Fullscreen_Popup_Generic_Closed
    • ComboBoxTests_Fullscreen_Popup_Generic_Opened
    • ImageStretch_None_Uno_UI_Samples_UITests_ImageTestsControl_Image_Stretch_None
    • Keyboard_Textbox_NoScrollViewer_Validation_4_-_Remove_Focus_on_multilineTextBox
    • ListView_ListViewWithHeader_InitializesTest_SamplesApp_Windows_UI_Xaml_Controls_ListView_HorizontalListViewGrouped
    • DatePicker_PickerFlyout_Placementsnarrow_True_True_True_UITests_Windows_UI_Xaml_Controls_DatePicker_DatePicker_Placement
    • ComboBox_Dropdown_Background_ComboBox_open
    • PopupWithOverlay_After
    • ProgressRing_Visibility_Collapsed_UITests_Windows_UI_Xaml_Controls_ProgressRing_WindowsProgressRing_GH1220
    • SequentialAnimations_SamplesApp_Windows_UI_Xaml_Media_Animation_SequentialAnimationsPage
    • TestManipulation_Result
    • TextBox_BeforeTextChanging_Validation_UITests_Shared_Windows_UI_Xaml_Controls_TextBoxTests_TextBox_BeforeTextChanging
    • ProgressRing_IsEnabled_Running_UITests_Windows_UI_Xaml_Controls_ProgressRing_WindowsProgressRing_GH1220
    • WebView_NavigateToAnchor_navigate_to_anchor
    • When_Parent_PointerMoved_After_drag_on_non-scrolling_ScrollViewer
    • When_Parent_PointerMoved_After_drag_on_ScrollViewer_-_touch
    • When_TransformToVisual_ScrollViewer_UITests_Shared_Windows_UI_Xaml_UIElementTests_TransformToVisual_ScrollViewer
  • android-28-xamarin-Snap: 27 changed over 902

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • ColorPicker_ColorPickerSample_UITests_Microsoft_UI_Xaml_Controls_ColorPickerTests_ColorPickerSample
    • ColorPicker_WinUIColorPickerPage_UITests_Shared_Microsoft_UI_Xaml_Controls_ColorPickerTests_WinUIColorPickerPage
    • CommandBar_Native_Uno_UI_Samples_Content_UITests_CommandBar_CommandBar_Native
    • ComboBox_UITests_Shared_Windows_UI_Xaml_Controls_ComboBox_ComboBox_DropDownPlacement_UITests_Shared_Windows_UI_Xaml_Controls_ComboBox_ComboBox_DropDownPlacement
    • ComboBox_UITests_Shared_Windows_UI_Xaml_Controls_ComboBox_ComboBox_VisibleBounds_UITests_Shared_Windows_UI_Xaml_Controls_ComboBox_ComboBox_VisibleBounds
    • Default_UITests_Shared_Windows_UI_Xaml_Automation_AutomationProperties_Name_UITests_Shared_Windows_UI_Xaml_Automation_AutomationProperties_Name
    • NavigationView_MUXControlsTestApp_NavigationViewCustomThemeResourcesPage_MUXControlsTestApp_NavigationViewCustomThemeResourcesPage
    • Default_Uno_UI_Samples_UITests_ImageBrushTestControl_DoubleImageBrushInList_Uno_UI_Samples_UITests_ImageBrushTestControl_DoubleImageBrushInList
    • Image_UniformToFill100x100_Uno_UI_Samples_UITests_ImageTestsControl_UniformToFill100x100
    • ListView_HorizontalListViewGrouped_SamplesApp_Windows_UI_Xaml_Controls_ListView_HorizontalListViewGrouped
    • ListView_ListViewGrouped_ItemContainerStyleSelector_SamplesApp_Windows_UI_Xaml_Controls_ListView_ListViewGrouped_ItemContainerStyleSelector
    • ListView_ListViewGrouped_SamplesApp_Windows_UI_Xaml_Controls_ListView_ListViewGrouped
    • ScrollViewer_UITests_Windows_UI_Xaml_Controls_ScrollViewerTests_ScrollViewer_Padding_UITests_Windows_UI_Xaml_Controls_ScrollViewerTests_ScrollViewer_Padding
    • NavigationView_MUXControlsTestApp_NavigationViewPage_MUXControlsTestApp_NavigationViewPage
    • NavigationView_MUXControlsTestApp_NavigationViewRS4Page_MUXControlsTestApp_NavigationViewRS4Page
    • Progress_UITests_Microsoft_UI_Xaml_Controls_ProgressBar_WinUIProgressBarSimple_UITests_Microsoft_UI_Xaml_Controls_ProgressBar_WinUIProgressBarSimple
    • Progress_UITests_Microsoft_UI_Xaml_Controls_ProgressRing_WinUIProgressRingPage_UITests_Microsoft_UI_Xaml_Controls_ProgressRing_WinUIProgressRingPage
    • Progress_UITests_Microsoft_UI_Xaml_Controls_ProgressRing_WinUIProgressRing_CustomSources_UITests_Microsoft_UI_Xaml_Controls_ProgressRing_WinUIProgressRing_CustomSources
    • Progress_UITests_Windows_UI_Xaml_Controls_ProgressRing_WindowsProgressRing_GH1220_UITests_Windows_UI_Xaml_Controls_ProgressRing_WindowsProgressRing_GH1220
    • NavigationView_FluentStyle_NavigationViewSample_SamplesApp_Samples_Microsoft_UI_Xaml_Controls_NavigationViewTests_FluentStyle_FluentStyle_NavigationViewSample
  • ios: 24 changed over 273

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • Keyboard_Textbox_InsideScrollViewer_Validation_0_-_Remove_Focus_on_normalTextBox
    • Keyboard_Textbox_InsideScrollViewer_Validation_5_-_Remove_Focus_on_numberTextBox
    • Keyboard_Textbox_NoScrollViewer_Validation_0_-_Remove_Focus_on_normalTextBox
    • Large_Image_With_Margin_Ready
    • Large_Image_With_Margin_UITests_Windows_UI_Xaml_Controls_ImageTests_Image_Margin_Large
    • ListView_ObservableCollection_Creation_Count_Removed_above
    • ListView_ObservableCollection_Creation_Count_Scrolled1
    • ListView_ObservableCollection_Creation_Count_Scrolled2
    • ListView_ObservableCollection_Creation_Count_UITests_Windows_UI_Xaml_Controls_ListView_ListView_ObservableCollection_CreationCount
    • NativeCommandBar_Size_thirdOrientation
    • PasswordBox_AutoGrow_Horizontally_Test_Uno_UI_Samples_Content_UITests_TextBoxControl_PasswordBox_Simple
    • ProgressRing_IsEnabled_Running_UITests_Windows_UI_Xaml_Controls_ProgressRing_WindowsProgressRing_GH1220
    • ProgressRing_Visibility_Collapsed_UITests_Windows_UI_Xaml_Controls_ProgressRing_WindowsProgressRing_GH1220
    • ImageStretch_None_Uno_UI_Samples_UITests_ImageTestsControl_Image_Stretch_None
    • Keyboard_Textbox_NoScrollViewer_Validation_4_-_Remove_Focus_on_multilineTextBox
    • ListView_ObservableCollection_Creation_Count_Added
    • ListView_ObservableCollection_Creation_Count_Added_above
    • Keyboard_Textbox_InsideScrollViewer_Validation_1_-_Remove_Focus_on_filledTextBox
    • Keyboard_Textbox_NoScrollViewer_Validation_1_-_Remove_Focus_on_filledTextBox
    • Screenshots_Image_Stretch_Alignment_SizeOnControl_Mode-0
  • ios-Snap: 49 changed over 894

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • Animations_DoubleAnimation_RenderTransformOrigin_GenericApp_Views_Content_UITests_Animations_DoubleAnimation_RenderTransformOrigin
    • Border_Border_Simple_No_Background_With_TextBox_Uno_UI_Samples_UITests_BorderTestsControl_Border_Simple_No_Background_With_TextBox
    • ColorPicker_ColorPickerSample_UITests_Microsoft_UI_Xaml_Controls_ColorPickerTests_ColorPickerSample
    • ColorPicker_WinUIColorPickerPage_UITests_Shared_Microsoft_UI_Xaml_Controls_ColorPickerTests_WinUIColorPickerPage
    • ComboBox_ComboBox_Picker_SamplesApp_Wasm_Windows_UI_Xaml_Controls_ComboBox_ComboBox_Picker
    • CommandBar_UITests_Windows_UI_Xaml_Controls_CommandBar_CommandBar_Native_With_Content_UITests_Windows_UI_Xaml_Controls_CommandBar_CommandBar_Native_With_Content
    • ContentControlTestsControl_ContentControl_Nested_TemplatedParent_Uno_UI_Samples_Content_UITests_ContentControlTestsControl_ContentControl_Nested_TemplatedParent
    • Default_UITests_Windows_UI_Xaml_Controls_CommandBar_CommandBar_Native_Frame_UITests_Windows_UI_Xaml_Controls_CommandBar_CommandBar_Native_Frame
    • Default_UITests_Windows_UI_Xaml_Controls_GridTestsControl_Grid_def_MinMaxValues_UITests_Windows_UI_Xaml_Controls_GridTestsControl_Grid_def_MinMaxValues
    • Default_UITests_Windows_UI_Xaml_Controls_GridTestsControl_Grid_DynamicRowColumn_UITests_Windows_UI_Xaml_Controls_GridTestsControl_Grid_DynamicRowColumn
    • Default_UITests_Windows_UI_Xaml_Controls_GridTestsControl_Grid_Margin_And_Padding_UITests_Windows_UI_Xaml_Controls_GridTestsControl_Grid_Margin_And_Padding
    • Animations_DoubleAnimationUsingKeyFrames_TranslateX_GenericApp_Views_Content_UITests_Animations_DoubleAnimationUsingKeyFrames_TranslateX
    • ContentControlTestsControl_ContentControl_SetNull_Uno_UI_Samples_Content_UITests_ContentControlTestsControl_ContentControl_SetNull
    • Default_Uno_UI_Samples_Content_UITests_WebView_WebView_AnchorNavigation_Uno_UI_Samples_Content_UITests_WebView_WebView_AnchorNavigation
    • ImageBrushTestControl_PanelImageBrush_Uno_UI_Samples_UITests_ImageBrushTestControl_PanelImageBrush
    • Image_UITests_Shared_Windows_UI_Xaml_Controls_ImageTests_Image_Stretch_Algmnt_Inf_Horizontal_UITests_Shared_Windows_UI_Xaml_Controls_ImageTests_Image_Stretch_Algmnt_Inf_Horizontal
    • ListView_ListViewGroupedVariableHeightComplexTemplate_SamplesApp_Windows_UI_Xaml_Controls_ListView_ListViewGroupedVariableHeightComplexTemplate
    • ListView_ListViewHeaderImage_SamplesApp_Windows_UI_Xaml_Controls_ListView_ListViewHeaderImage
    • ListView_ListViewEmptyGroups_SamplesApp_Windows_UI_Xaml_Controls_ListView_ListViewEmptyGroups
    • ListView_ListViewGroupedEmpty_SamplesApp_Windows_UI_Xaml_Controls_ListView_ListViewGroupedEmpty
  • skia-gtk-screenshots: 42 changed over 939

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • Image-Image_Stretch_Algmnt_Inf_Horizontal
    • Image-Image_Stretch_Algmnt_Inf_Vertical
    • Image-Image_Stretch_Alignment_Bigger
    • Image-Image_Stretch_Alignment_Equal
    • Image-Image_Stretch_Alignment_SizeOnControl
    • Image-Image_Stretch_Alignment_Smaller
    • Image-Image_Stretch_Alignment_Taller
    • Gesture recognizer-Pointer Events test bench
    • Image-Image_Stretch_Alignment_Wider
    • NavigationView-NavigationViewSelectedItemEdgeCasePage
    • NavigationView-NavigationViewStretchPage
    • NavigationView-NavigationViewTopNavOverflowButtonPage
    • NavigationView-NavigationViewTopNavPage
    • ListView-ListView_IsSelected
    • ScrollViewer-ScrollViewer_Options
    • NavigationView-NavigationViewCompactPaneLengthTestPage
    • NavigationView-NavigationViewCustomThemeResourcesPage
    • NavigationView-NavigationViewMenuItemStretchPage
    • NavigationView-NavigationViewRS3Page
    • Pointers-HitTest_Image
  • wasm: 15 changed over 902

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • SamplesApp.Wasm.Windows_UI_Xaml_Controls.ListView.ListView_IsSelected
    • UITests.Microsoft_UI_Xaml_Controls.ImageIconTests.ImageIconPage
    • UITests.Microsoft_UI_Xaml_Controls.ProgressRing.WinUIProgressRingPage
    • UITests.Shared.Windows_UI_Xaml_Controls.ImageTests.Image_Stretch_Algmnt_Inf_Horizontal
    • UITests.Shared.Windows_UI_Xaml_Controls.ImageTests.Image_Stretch_Algmnt_Inf_Vertical
    • UITests.Shared.Windows_UI_Xaml_Controls.ImageTests.Image_Stretch_Alignment_SizeOnControl
    • Uno.UI.Samples.Content.UITests.TextBlockControl.TextBoxSizeChanging
    • Uno.UI.Samples.UITests.Image.Image_Margin
    • Uno.UI.Samples.UITests.Image.Image_Stretch
    • Uno.UI.Samples.UITests.Image.Image_Stretch_Alignment_Bigger
    • Uno.UI.Samples.UITests.Image.Image_Stretch_Alignment_Equal
    • Uno.UI.Samples.UITests.Image.Image_Stretch_Alignment_Smaller
    • Uno.UI.Samples.UITests.Image.Image_Stretch_Alignment_Taller
    • Uno.UI.Samples.UITests.Image.Image_Stretch_Alignment_Wider
    • Uno.UI.Samples.UITests.ImageBrushTestControl.Ellipse
  • wasm-automated-net5.0-Benchmarks: 0 changed over 1

  • wasm-automated-net5.0-Default: 4 changed over 795

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • ImageStretch_None_Uno_UI_Samples_UITests_ImageTestsControl_Image_Stretch_None
    • ListView_Weird_Measure_During_Arrange_UITests_Shared_Windows_UI_Xaml_Controls_ListView_ListView_Weird_Measure
    • Screenshots_Image_Stretch_Alignment_Smaller_Mode-0
    • When_TransformToVisual_ScrollViewer_UITests_Shared_Windows_UI_Xaml_UIElementTests_TransformToVisual_ScrollViewer
  • wasm-automated-net5.0-RuntimeTests: 0 changed over 1

@davidjohnoliver davidjohnoliver merged commit 6471ab2 into master Aug 20, 2021
@davidjohnoliver davidjohnoliver deleted the dev/djo/listview-android-fix-5 branch August 20, 2021 13:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Perf][Android] VirtualizingPanelLayout measures and layouts all children even when not requested
3 participants