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

[Android] Include Margin when measuring from LayoutManager #2800

Merged
merged 1 commit into from
Mar 12, 2020

Conversation

davidjohnoliver
Copy link
Contributor

The LayoutManager is used when AreDimensionsConstrained = true for a particular view, which can be set manually as an optimization if it's known that a view's size will never change. It wasn't taking the Margin into account when measuring the view, which was causing errors after layouting changes.

GitHub Issue (If applicable): fixes #2761

PR Type

  • Bugfix

What kind of change does this PR introduce?

What is the current behavior?

What is the new behavior?

PR Checklist

Please check if your PR fulfills the following requirements:

  • Tested code with current supported SDKs
  • Docs have been added/updated which fit documentation template (for bug fixes / features)
  • Unit Tests and/or UI Tests for the changes have been added (for bug fixes / features) (if applicable)
  • Wasm UI Tests are not showing unexpected any differences. Validate PR Screenshots Compare Test Run results.
  • Contains NO breaking changes
  • Updated the Release Notes
  • Associated with an issue (GitHub or internal)

Other information

Internal Issue (If applicable):

The LayoutManager is used when AreDimensionsConstrained = true for a particular view, which can be set manually as an optimization if it's known that a view's size will never change. It wasn't taking the Margin into account when measuring the view, which was causing errors after layouting changes.
@davidjohnoliver davidjohnoliver self-assigned this Mar 12, 2020
@gitpod-io
Copy link

gitpod-io bot commented Mar 12, 2020

@github-actions github-actions bot added platform/android 🤖 Categorizes an issue or PR as relevant to the Android platform kind/documentation labels Mar 12, 2020

protected override Size MeasureOverride(Size availableSize)
{
var height = double.IsPositiveInfinity(availableSize.Height) ? 0 : availableSize.Height;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wut

@nventive-devops
Copy link
Contributor

The build 13034 found UI Test snapshots differences.

  • android-28: 5 changed over 316

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • SequentialAnimations_SamplesApp_Windows_UI_Xaml_Media_Animation_SequentialAnimationsPage
    • TestManipulation_Result
    • ComboBoxTests_Stretch_UITests_Windows_UI_Xaml_Controls_ComboBox_ComboBox_Stretch
    • PopupWithOverlay_After
    • ToggleSwitch_TemplateReuseTest_UITests_Shared_Windows_UI_Xaml_Controls_ToggleSwitchControl_ToggleSwitch_TemplateReuse
  • android-28-Snap: 6 changed over 683

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • ComboBox_UITests_Shared_Windows_UI_Xaml_Controls_ComboBox_ComboBox_DropDownPlacement_UITests_Shared_Windows_UI_Xaml_Controls_ComboBox_ComboBox_DropDownPlacement
    • TextBlockControl_TextBlockMultilineInStarStackPanel_Uno_UI_Samples_Content_UITests_TextBlockControl_TextBlockMultilineInStarStackPanel
    • TextBlockControl_TextBlock_FixedWidth_With_DataBound_Run_Uno_UI_Samples_Content_UITests_TextBlockControl_TextBlock_FixedWidth_With_DataBound_Run
    • TextBox_Uno_UI_Samples_Content_UITests_TextBoxControl_PasswordBox_Reveal_Scroll_Uno_UI_Samples_Content_UITests_TextBoxControl_PasswordBox_Reveal_Scroll
    • TextBlockControl_TextBoxSizeChanging_Uno_UI_Samples_Content_UITests_TextBlockControl_TextBoxSizeChanging
    • Time_Picker_TimePicker_Flyout_Automated_UITests_Shared_Windows_UI_Xaml_Controls_TimePicker_TimePicker_Flyout_Automated
  • ios: 6 changed over 172

    🚨🚨 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_2_-_Remove_Focus_on_placeholderTextTextBox
    • SequentialAnimations_SamplesApp_Windows_UI_Xaml_Media_Animation_SequentialAnimationsPage
    • Keyboard_Textbox_NoScrollViewer_Validation_0_-_Remove_Focus_on_normalTextBox
    • Keyboard_Textbox_NoScrollViewer_Validation_5_-_Remove_Focus_on_numberTextBox
  • ios-Snap: 7 changed over 675

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • Default_Uno_UI_Samples_UITests_Image_Image_Stretch_Uno_UI_Samples_UITests_Image_Image_Stretch
    • 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_ListViewSelectedItems_SamplesApp_Windows_UI_Xaml_Controls_ListView_ListViewSelectedItems
    • MediaPlayerElement_Using__avi_UITests_Shared_Windows_UI_Xaml_Controls_MediaPlayerElement_MediaPlayerElement_Avi_Extension
    • Transform_Image_With_RotateTransform_Uno_UI_Samples_Content_UITests_Transform_Image_With_RotateTransform
    • TwoPaneView_MUX_Test_UITests_Shared_Microsoft_UI_Xaml_Controls_TwoPaneViewTests_TwoPaneViewPage
    • WebView_WebView_NavigateToUri_Uno_UI_Samples_Content_UITests_WebView_WebView_NavigateToUri
  • wasm: 0 changed over 685

  • wasm-automated: 4 changed over 354

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • ImageStretch_None_Uno_UI_Samples_UITests_ImageTestsControl_Image_Stretch_None
    • LoadEmptyContentControl_ContentControlNoTemplateNoContent_-_bntContentClear
    • SequentialAnimations_SamplesApp_Windows_UI_Xaml_Media_Animation_SequentialAnimationsPage
    • When_TransformToVisual_ScrollViewer_UITests_Shared_Windows_UI_Xaml_UIElementTests_TransformToVisual_ScrollViewer

@davidjohnoliver davidjohnoliver merged commit 7eec0ae into master Mar 12, 2020
@davidjohnoliver davidjohnoliver deleted the dev/djo/constraints-android-fix branch March 12, 2020 18:25
@jeromelaban
Copy link
Member

@Mergifyio backport release/beta/2.1

@mergify
Copy link
Contributor

mergify bot commented Mar 13, 2020

Command backport release/beta/2.1: failure

No backport have been created

  • Backport to branch release/beta/2.1 failed

Cherry-pick of 1eac9eb has failed:

On branch mergify/bp/release/beta/2.1/pr-2800
Your branch is up to date with 'origin/release/beta/2.1'.

You are currently cherry-picking commit 1eac9eb8d.
  (fix conflicts and run "git cherry-pick --continue")
  (use "git cherry-pick --abort" to cancel the cherry-pick operation)

Changes to be committed:

	modified:   src/Uno.UI.RuntimeTests/Tests/Windows_UI_Xaml_Controls/Given_FrameworkElement.cs
	modified:   src/Uno.UI/Services/LayoutManager.Android.cs

Unmerged paths:
  (use "git add <file>..." to mark resolution)

	both modified:   doc/ReleaseNotes/_ReleaseNotes.md

@jeromelaban
Copy link
Member

@Mergifyio backport release/beta/2.1

@mergify
Copy link
Contributor

mergify bot commented Mar 13, 2020

Command backport release/beta/2.1: success

Backports have been created

jeromelaban added a commit that referenced this pull request Mar 13, 2020
…/pr-2800

[Android] Include Margin when measuring from LayoutManager (bp #2800)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
platform/android 🤖 Categorizes an issue or PR as relevant to the Android platform
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Android] Invalid Ad Control layout
3 participants