-
Notifications
You must be signed in to change notification settings - Fork 50
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
Understanding Visibility Changes, Layout, and maxOf/minOf #117
Comments
@carranca I did some more digging around found the I've played around with this test and was surprised by what Contour is doing Failed Test 1
Failed Test 2I had to make some extra changes to support getting the value from
I can imagine reasons for Am I missing something or getting something wrong here? |
Hmmm yeah the behaviour doesn't look right. I'm not sure if I agree with all your expectations though (happy to discuss and/or be corrected though), but I do agree that the behaviour isn't right: I do agree that if a view is GONE, its In your Failed Test 1 however, you're asserting that Does that make sense? |
@carranca Thanks for getting back to me. Failed Test 1 is basically identical to The original test made the same assertions on the view so I'm confused about why setting it to Is this incorrect or should the original test case be updated to reflect this? |
Overview:
I'm trying to achieve an effect similar to #116, but with the
maxOf
function. Unfortunately for me, I'm a little bit confused by Contour's behavior when I change the visibility of one of the optional views.Steps:
We can easily reproduce the behavior that's confusing me using the sample app.
private val card3 = ExpandableBioCard1(context)
toSampleView
:SampleView
'sinit
blockisVisible = false
toExpandableBioCard2
'sinit
block (in my real app this can happen in the render method, but it has the same effect here)card3
andcard1
(Possibly Misguided) Expectations:
I expected
card2
's visibility change toGONE
to result incard2.bottom()
evaluating to0
, causingmaxOf
to pick the second argument.I expected this for two reasons:
View.GONE
state that the "view is invisible, and it doesn't take any space for layout purposes"LinearLayout
that contains two views, if you set the visibility of the first view toGONE
the second view automatically takes its placeOf course, this is not what's happening.
maxOf
is always pickingtopTo { card2.bottom() + 24.ydip }
because whilecard2.height()=0
,card2.bottom()
is still >card1.bottom()
.Current (Possibly Permanent) Workaround:
I can get the desired behavior by doing this:
Questions:
card2.bottom()
not evaluate to 0?topTo
the recommended approach for achieving this effect?Thank you all for this amazing library! I won't ever write another layout in XML if I can help it 😄 .
The text was updated successfully, but these errors were encountered: