Catrobat/Catroid — pull request #624 by ForestJ (2013-08-20 20:12:38+00:00)
Title: Issue#570 - TextFields not using availiable space on larger devices

Hi, I grabbed some of the code I had been working on in my UserBricks branch and used it to solve this issue.

The original issue thread is here: https://github.com/Catrobat/Catroid/issues/570

I created a new ViewGroup called BrickLayout which replaces LinearLayout(s) inside the bricks. It follows the specifications given by the UX designers:

1. text fields all have the same maximum size.
2. text fields use the maximum amount of space possible
3. on small screens, use line breaks to maximize text field width. On large screens, eliminate as many line breaks as possible.
4. the line breaks are static, I.E., determined at the time the brick is shown for the first time, never reshuffled as the text field sizes change.

This is the rough psuedocode of how BrickLayout works:

create the first line, set it as current
for each element in the layout {
if a "new line hint" is reached {
pretend that all the text fields added so far are really, really wide.
if the resulting width is wider than the max width of the layout, {
create a new line and set it as current
}
}
add current element to the current line
}

iterate through each lines and its elements {
position them
}

Along the way, I encountered a lot of problems that I had not gotten to yet in my own branch.

- how to handle Spinners?
- how to get the same centering behaviour that LinearLayout has?
- how to elipsize the text fields?
- how to get the same live-updating when you enter text into the formula editor edit text?

I ended up changing all the EditTexts on bricks to TextViews to solve the elipsizing problem, and as a result, I updated the EditTextAlignmentTest to reflect those changes.

No (non-ui) test failures are caused by these edits (on my Samsung Galaxy Nexus at least).