-
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
Add support for combination of minimal and autocomplete appearances #3964
Conversation
@lognaturel @seadowg I need to add some final changes and tests probably but could you play with it for a minute and let me know if there is anything I should change? You can use just the All widgets form. |
@seadowg @lognaturel as I said above probably I need to think of adding some more tests (the more the better) but it would be good to hear from you at least about the UI. |
Sorry about the delay and hope you had a good week away! This looks great. I hadn't considered that it would allow both I didn't immediately know what to do with the input line that looks disabled. In the case of For I think that making a selection should exit the full screen dialog the same way that on On Android 5.1, the background color of the full screen dialog is not the same as the background color of the form entry activity. Seems they should match. The font size for the select choice should match the font size of text in a text field (and be dynamic in the same way, I didn't check that). It looks smaller on my device. I get a Other than that, the full screen dialog looks good to me both with and without autocomplete. |
Theoretically it is possible but then if you select for example answer
I somehow missed it being too focused on the new minimal + autocomplete. I agree that if we have just minimal that search box doesn't make sense. To be clear you just want to have something like a spinner button but not the old spinner widget? I mean it will look like a spinner but it will open the same dialog I use for autocomplete right because it doesn't make sense to keep those old widgets for minimal appearances without autocomplete? What about select multi? it had a normal button.
I agree. The dialog should be closed in if we use select_one.
The font size of every single option is dynamic if that's what you are asking for. |
@grzesiek2010 and I had a brief chat about this and agreed to fake a spinner look for the inline field (basically add ▼ at the right) for all selects with
Agreed this is totally weird and I hadn't thought through the case where something was already selected. Having considered it more, I think that adding the ▼ at the right will likely make it clear enough that the field is tappable. So basically there would be no difference between |
Having a box that would look like spinner for both minimal and minimal autocomplete appearances seems right to me but yeah let's hear from @seadowg |
@grzesiek2010 @lognaturel looking at it feels to me like a fake Maybe just using a |
So basically you don't agree with what we proposed above (having spinner for both cases) @seadowg? My problem with that edittext is like:
So I would be in favour of having spinners in all cases. |
No I think it works. Sorry I think I was being confusing! I was trying to explain that my ideal would be having the Given all that I'm happy to go with a |
@seadowg it’s not about implementation. We just can’t figure out reasonable behavior when something is already selected. The behavior is clear and good when nothing is selected: the text field has focus if it’s the first question on the screen and then if you start typing it opens the dialog and filters the list according to what you’ve typed. But what if you have a fruit list and you’ve already selected “apple”? The edit text will have “apple” in it, right? So then where should the cursor be if the field has focus? What should happen when you start typing? One new idea I just had is that if there’s already a selection the contents of the edit text could be selected when it gets focus. That way, when you start typing it would start a new search. |
@grzesiek2010 I like that! Is that just the standard @lognaturel in my head this all works but maybe I'm crazy. If something is selected it would the cursor would work just like it would with a standard text field and if you start typing (while focused) or click on it the selection screen would pop up and you would continue there. Again though as I've been thinking about it seems really awkward to implement this smoothly! I guess I'd thought about it like a text field that you can only populate with specific answers. Anyway I think the direction we're going in is the pragmatic one so enough about my mad scientist approach. |
Let’s say the default or previously selected value is “apple” and you want to change it to “banana.” The question is the only one on the screen. If it were a regular edit text, we’d give it focus and put the cursor at the end. But like @grzesiek2010 mentioned if that were the case and you typed “b” then you’d end up with a filter of “appleb” and an empty filtered list in the dialog. Selecting the whole edit text content so it gets replaced when the user starts typing makes some amount of sense for select ones. It doesn’t really work for select multiples where you might want to change a subset of choices (Edit: I don't know, maybe it still makes sense? Then what you're typing is clearly the filter query, not the full value of the field). I think we’d need to have a really precise behavior description for both those cases to consider something other than forcing the user to tap to get to choices in all cases. |
it is just a text field + image view: https://github.com/getodk/collect/pull/3964/files#diff-731643aa399535acb9f8639380ec98cc I have also some concerns about possible ways of closing the dialog/accepting selected answers, for now it is possible to close the dialog clicking on the back arrow (from the toolbar) or clicking the device back button. In both cases selected answers are saved (accepted). Do you find it confusing and think that maybe we shouldn't accept new answers when the dialog is closed by the device back button (treat it as cancel button)? On the other hand that back arrow also looks like a way to click cancel maybe it should be ✔️ ? |
Hmmm I think it would be nice to avoid custom UI if possible (as much as I actually like what you've created more than the Android Spinner style). Was there a specific reason to not use an actual |
A few reasons:
|
This sounds right to me. In the case of a select one, I think it's the only sensible option. Tapping an option selects it and closes the dialog. The back buttons just leaves whatever selection there already might be. In the case of select multiples, it's a little less clear. But I think that if all ways of exiting the dialog commit the current selections, it's at least consistent and easy to reason about. |
Great point. I think I'm convinced using the custom spinner is less of a maintenance risk than using a real one and faking its setup 👍. |
3c4b0b9
to
0472d3b
Compare
@lognaturel I implemented improvements and fixes I wanted, would be great if you could take another look during my night/your day at the UI. If what I have implemented is ok tomorrow I'll work on tests, more tests... |
I get an NPE when trying to tap a minimal select field with your latest commit. I think context may be accessed prematurely but don't have time for a deep dive right now. The previous commit seems to work as expected. Although the minimal select looks good, it's not consistent with the rest of the question types we offer. I think this might be some of what @seadowg was getting at too. Does it match some material design guideline I haven't noticed? When I look at this page I see that selects look like text fields except for the downward triangle. I see a leak of The background color of the full screen dialog doesn't match the I notice many of the select one appearances don't immediately select an option on tap. I think that should be consistent. Is there a reason it isn't? It looks like we talked past each other for the select behavior! I was thinking we would treat it like settings full screen dialogs. Look at settings for any of the Google apps and you'll see that they're committed immediately and either the arrow or the hardware back button just returns to wherever the user was before. This is what makes sense to me and I find it really confusing that the hardware back button doesn't commit. If you're not comfortable with that, then I think we should follow the guidelines here. That is, we'd have an X at the upper left and SAVE at the upper right. The hardware back button would close without saving, the same behavior as the X. That would make it clear to me that there's only one path to save and everything else cancels. For this to work you'd need to clearly combine the search box clearing icon (currently x) with the search bar. I have a slight preference for the simper model with immediate commit but it's not very strong. |
0472d3b
to
6dee194
Compare
hmmm can't reproduce now... I tried three devices.
I thought this is what we agreed on... I don't know, this can't be even super consistent because in all the other cases we display choices in a widget and in all the other widgets that display dialogs we use buttons. So how do you even imagine the consistency?
what do you mean? Is there any change in behavior that I implemented?
In canary leak or is it maybe a crash?
is that bad? all our dialog (at least full screen ones) use that color for example the one that asks for identity which also is a part of filling a form.
ok sorry I misunderstood our previous conversation. i added the code back and now answers are saved even even if you click device back button. |
Still get the crash in Android 5.1. I thought it was because
I should have reacted to that thread previously. I agree that it's not going to be exactly the same as any other question type. Maybe the thing that bothers me most is the contrasting background because it really makes the field stand out in a field list whereas I think it should look more like question types based on edit texts. I find that the padding is also quite tight around the text when compared to Material Design examples. But all that said, I don't think this is too important for now. Like I said, I agree it looks good, and I think that if we make cosmetic changes later on it won't be confusing as long as the behavior is the same. For now, how about you just try it in a field list with a string question and see if there's anything you can do to make things look more balanced. Then we can come back to it later.
I am not able to get it running right now but if I remember correctly, select one with
Reported by Leak Canary.
Ok, that's reasonable, then!
Cool. And does it feel ok to you? Again, I'm trying to be consistent with other apps I've used but if you have examples that point to alternatives, I'm certainly open to those. |
ah ok I got it, fixed.
ok I see, fixed.
that seems fine to me and it was the way I implemented it initially so I unnecessarily thought to much about it. |
6f8318d
to
4197b4e
Compare
0366143
to
0d39634
Compare
Tested with success! Tested scenarios:
great work @grzesiek2010! |
I also confirm successful tests on Android versions: 7.0, 8.1, 9.0 @getodk-bot unlabel "needs testing" |
wow I can finish my career satisfied then 😄 |
Closes #3736 #3297
What has been done to verify that this works as intended?
I tested select widgets manually.
Why is this the best possible solution? Were any other approaches considered?
This is what our users requested and what we decided to implement.
When it comes to the implementation I used RecyclerView like in all other selects (excluding those horizontal: LikertWidget/ListWidget/ListMultiWidget), thanks to that we can mix minimal with the same appearances we use in normal selects: columns-pack/columns-n/no-buttons etc.
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?
We need to test all select widgets that use RecyclerView (basicly all select widgets excluding those horizontal: LikertWidget/ListWidget/ListMultiWidget).
This change also enables mixing more appearances and now we can mix minimal widgets not only with autocomplete (what was the purpose of the issue) but also with other appearances we use in normal selects like: no-buttons/columns-pack/columns-n
that's why I said that we need to test all possible selects with all possible appearances. I know it's not easy since we can mix a lot of appearances.
Do we need any specific form for testing your changes? If so, please attach one.
Any form with any select widgets.
I'm attaching some that I used:
selectAppearances.zip
selectAppearancesWithMinimal.zip
Does this change require updates to documentation? If so, please file an issue here and include the link below.
Yes we need to update screenshots.
Before submitting this PR, please make sure you have:
./gradlew checkAll
and confirmed all checks still pass OR confirm CircleCI build passes and run./gradlew connectedDebugAndroidTest
locally.