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

Standardize widget margins #5868

Merged
merged 8 commits into from
Dec 15, 2023
Merged

Conversation

grzesiek2010
Copy link
Member

@grzesiek2010 grzesiek2010 commented Dec 11, 2023

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:

  • added or modified tests for any new or changed behavior
  • run ./gradlew connectedAndroidTest (or ./gradlew testLab) and confirmed all checks still pass
  • added a comment above any new strings describing it for translators
  • verified that any code or assets from external sources are properly credited in comments and/or in the about file.
  • verified that any new UI elements use theme colors. UI Components Style guidelines

@grzesiek2010 grzesiek2010 marked this pull request as ready for review December 11, 2023 22:29
Copy link
Collaborator

@alyblenkin alyblenkin left a 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!

@seadowg seadowg self-requested a review December 15, 2023 10:57
Copy link
Member

@seadowg seadowg left a 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);
Copy link
Member

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.

@seadowg seadowg merged commit d9ec6cc into getodk:master Dec 15, 2023
6 checks passed
@dbemke
Copy link

dbemke commented Jan 10, 2024

Tested with Success!

Verified on Androids: 10

Verified cases:

  • margins in All widgets form
  • margins in All widgets field-list
  • margins in selects
  • margins when there’s an error outline displayed
  • RTL language
  • light and dark mode

@srujner
Copy link

srujner commented Jan 10, 2024

Tested with Success!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve divider spacing
5 participants