-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Standardize widget margins #5868
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@grzesiek2010 Sorry for the delay in coming back to this one! The question padding and margins, as well as the spacing between the questions look good!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking at this reminds me how many calls to addAnswerView
we still have. I don't think it makes sense here, but we should make sure to try and remove them as we touch widgets going forward.
ViewGroup.LayoutParams.WRAP_CONTENT, | ||
ViewGroup.LayoutParams.MATCH_PARENT | ||
); | ||
int marginVertical = (int) getContext().getResources().getDimension(org.odk.collect.androidshared.R.dimen.margin_small); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did not realise that getDimension
would give us back px rather than dp here. I guess that's because the dimension is defined as 8dp
rather than just 8
.
Tested with Success! Verified on Androids: 10 Verified cases:
|
Tested with Success! |
Closes #5731
Why is this the best possible solution? Were any other approaches considered?
The issue itself was only about adding more margins to dividers displayed between questions if we have multiple questions on one screen. I took the opportunity and reworked the way margins are added to questions. In the past, we would add margins to every single question separately which was error-prone and difficult to maintain. Now questions do not have margins but the main container that holds them does what is much easier.
@alyblenkin it would be good if you could take a look at the changes. Please pay attention not only to what the issue was about but also generally margins and padding in questions because maybe there is something else that we would need to change (in this pr or separately). When it comes to the space I've added to the dividers displayed between questions please keep in mind that it might be slightly different depending on what questions are above/below. For example, if the last element in a question is a button vs text field there might be a small difference visible because different components might have their own special margins/paddings and then along with the margin of the difider there might be more empty space. But as I said the difference should be not big.
How does this change affect users? Describe intentional changes to behavior and behavior that could have accidentally been affected by code changes. In other words, what are the regression risks?
This changes the way margins are added to questions so theoretically in every single question something might be broken. The good thing is that we don't need to test the functionality of questions only how they are displayed.
Do we need any specific form for testing your changes? If so, please attach one.
No.
Does this change require updates to documentation? If so, please file an issue here and include the link below.
No.
Before submitting this PR, please make sure you have:
./gradlew connectedAndroidTest
(or./gradlew testLab
) and confirmed all checks still pass