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

Mark required questions using an asterisk #1828

Merged
merged 7 commits into from
Feb 14, 2018

Conversation

grzesiek2010
Copy link
Member

Closes #1827

What has been done to verify that this works as intended?

I tested All Widgets form where the last question is required.

Why is this the best possible solution? Were any other approaches considered?

Are there any risks to merging this code? If so, what are they?

No.

Do we need any specific form for testing your changes? If so, please attach one.

I used All widgets form.

@mdmahendri
Copy link

why not use different color for asterisk to get more attention from user

Copy link
Contributor

@akshay-ap akshay-ap left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems fine to me.

@grzesiek2010
Copy link
Member Author

why not use different color for asterisk to get more attention from user

It could be red but I'm not sure what's better...Who thinks it should be red?

Copy link
Member

@yanokwa yanokwa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a pretty cool feature!

I think we should put the * at the beginning. Putting it at the end of long questions or small screens means it's hidden, which defeats the purpose of letting the user know before a swipe.

I think an Android red (probably the same as when you reset the app) would work better because it catches the user's attention.

I think questions that have no label text (e.g., media only questions) and are required should also have the *. Currently, they don't.

@grzesiek2010
Copy link
Member Author

I implemented required changes. Here is a form for testing:
asterisk.xml.txt

@grzesiek2010 grzesiek2010 force-pushed the asterisk branch 2 times, most recently from 980c33d to af6020f Compare February 6, 2018 12:25
@yanokwa
Copy link
Member

yanokwa commented Feb 6, 2018

I like what you've done with the red!

I think questions that have no label text (e.g., media only questions) and are required should also have the *. Currently, they don't and it'd be good to include that in your test file. Also good to include is a form with multiple questions so we can verify how that looks.

If I try to swipe to the /asterisk/empty2, I get an error.

FormEntryActivity: java.lang.NullPointerException: Attempt to invoke virtual method 'boolean java.lang.String.isEmpty()' on a null object reference
FormEntryActivity: 	at org.odk.collect.android.widgets.QuestionWidget.createQuestionMediaLayout(QuestionWidget.java:153)
FormEntryActivity: 	at org.odk.collect.android.widgets.QuestionWidget.<init>(QuestionWidget.java:121)
FormEntryActivity: 	at org.odk.collect.android.widgets.StringWidget.<init>(StringWidget.java:62)
FormEntryActivity: 	at org.odk.collect.android.widgets.StringWidget.<init>(StringWidget.java:56)
FormEntryActivity: 	at org.odk.collect.android.widgets.WidgetFactory.createWidgetFromPrompt(WidgetFactory.java:134)
FormEntryActivity: 	at org.odk.collect.android.views.ODKView.<init>(ODKView.java:197)
FormEntryActivity: 	at org.odk.collect.android.activities.FormEntryActivity.createView(FormEntryActivity.java:1314)
FormEntryActivity: 	at org.odk.collect.android.activities.FormEntryActivity.showPreviousView(FormEntryActivity.java:1536)
FormEntryActivity: 	at org.odk.collect.android.activities.FormEntryActivity.onFling(FormEntryActivity.java:2882)
FormEntryActivity: 	at android.view.GestureDetector.onTouchEvent(GestureDetector.java:650)
FormEntryActivity: 	at org.odk.collect.android.activities.FormEntryActivity.dispatchTouchEvent(FormEntryActivity.java:1413)
FormEntryActivity: 	at android.support.v7.view.WindowCallbackWrapper.dispatchTouchEvent(WindowCallbackWrapper.java:68)
FormEntryActivity: 	at android.support.v7.view.WindowCallbackWrapper.dispatchTouchEvent(WindowCallbackWrapper.java:68)
FormEntryActivity: 	at com.android.internal.policy.DecorView.dispatchTouchEvent(DecorView.java:373)
FormEntryActivity: 	at android.view.View.dispatchPointerEvent(View.java:10165)
FormEntryActivity: 	at android.view.ViewRootImpl$ViewPostImeInputStage.processPointerEvent(ViewRootImpl.java:4446)
FormEntryActivity: 	at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:4314)
FormEntryActivity: 	at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3861)
FormEntryActivity: 	at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:3914)
FormEntryActivity: 	at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:3880)
FormEntryActivity: 	at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:4007)
FormEntryActivity: 	at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:3888)
FormEntryActivity: 	at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:4064)
FormEntryActivity: 	at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3861)
FormEntryActivity: 	at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:3914)
FormEntryActivity: 	at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:3880)
FormEntryActivity: 	at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:3888)
FormEntryActivity: 	at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3861)
FormEntryActivity: 	at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:6257)
FormEntryActivity: 	at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:6196)
FormEntryActivity: 	at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:6157)
FormEntryActivity: 	at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:6360)
FormEntryActivity: 	at android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:192)
FormEntryActivity: 	at android.os.MessageQueue.nativePollOnce(Native Method)
FormEntryActivity: 	at android.os.MessageQueue.next(MessageQueue.java:323)
FormEntryActivity: 	at android.os.Looper.loop(Looper.java:136)
FormEntryActivity: 	at android.app.ActivityThread.main(ActivityThread.java:6123)
FormEntryActivity: 	at java.lang.reflect.Method.invoke(Native Method)
FormEntryActivity: 	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:867)
FormEntryActivity: 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:757)
FormEntryActivity: Created view for group [top] null

@grzesiek2010
Copy link
Member Author

If I try to swipe to the /asterisk/empty2, I get an error.

silly bug, it's fixed. Sorry.

I think questions that have no label text (e.g., media only questions) and are required should also have the *. Currently, they don't and it'd be good to include that in your test file.

It works in that way. If you have required question without a label you can see an asterisk before hint but if both are not specified (label + hint) there is only an asterisk. Please check those questions after that NPE.

@grzesiek2010 grzesiek2010 force-pushed the asterisk branch 2 times, most recently from e162065 to 079392f Compare February 6, 2018 21:00
@mmarciniak90
Copy link
Contributor

Tested with success!

Verified on Android: 4.1, 4.2, 4.4, 5.1, 6.0, 7.0, 8.0
Verified cases:

| | |

@mmarciniak90
Copy link
Contributor

@opendatakit-bot unlabel "needs testing"
@opendatakit-bot label "behavior verified"

@lognaturel lognaturel merged commit f407ed3 into getodk:master Feb 14, 2018
lognaturel added a commit to lognaturel/collect that referenced this pull request Feb 15, 2018
getodk#1828 marks required questions with an asterisk so the label text no longer matched. Since the form is supposed to focus on question types rather than modifiers, removing the required makes sense.
shobhitagarwal1612 pushed a commit to shobhitagarwal1612/collect that referenced this pull request Feb 18, 2018
getodk#1828 marks required questions with an asterisk so the label text no longer matched. Since the form is supposed to focus on question types rather than modifiers, removing the required makes sense.
shobhitagarwal1612 pushed a commit to shobhitagarwal1612/collect that referenced this pull request May 15, 2018
shobhitagarwal1612 pushed a commit to shobhitagarwal1612/collect that referenced this pull request May 15, 2018
getodk#1828 marks required questions with an asterisk so the label text no longer matched. Since the form is supposed to focus on question types rather than modifiers, removing the required makes sense.
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.

7 participants