-
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
Guidance hint solution that resolves #2007 #2105
Conversation
…d constructs. This will allow for the hint and the hint's guidance to live within the same layout. Also added a key to preferences that will be used to store the guidance setting.
…he hint's text id and form type of guidance.
…help text is already gone then it's parent layout won't have a height due to it having the WRAP_CONTENT property so the AnswerView will automatically be positioned beneath the previous layout.
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 great to me! I've marked a few quick things inline as I saw them but haven't done a full review yet.
Let's wait a day or two for feedback about the UI: https://forum.opendatakit.org/t/collect-collapsible-training-hints-guidance/12247/3
I find the (i) icon very difficult to hit even on a Galaxy Tab A tablet. Is it possible only the actual path is tappable and not the transparent parts? Could we perhaps expand the tappable area?
I wasn't sure initially that I liked the icon but I haven't come up with anything better so it has grown on me.
<TextView | ||
android:id="@+id/help_text_view" | ||
tools:text="Testing this out." | ||
android:gravity="center" |
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.
This makes all hint text that wraps centered which doesn't look right. See All Widgets form to see what I mean!
@@ -592,4 +677,6 @@ public MediaPlayer getPlayer() { | |||
public int getPlayColor() { | |||
return playColor; | |||
} | |||
|
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.
There shouldn't be any line breaks here.
TextView helpText = new TextView(getContext()); | ||
private View createHelpTextLayout() { | ||
return LayoutInflater.from(getContext()).inflate(R.layout.help_text_layout, null); | ||
|
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.
Please remove extra line breaks! I saw a few other places where there were extra ones so would be good to double check the diff.
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.
No prob :) will definitely keep an eye out for them!
} | ||
|
||
private TextView setupGuidanceTextAndLayout(TextView guidanceTextView, FormEntryPrompt prompt) { | ||
|
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.
Our style doesn't call for a line break here.
@@ -584,4 +587,5 @@ | |||
<string name="start_video_capture_instruction">Tap the screen to start recording</string> | |||
<string name="stop_video_capture_instruction">Recording started. Tap again to stop</string> | |||
<string name="no_columns_to_upload">No columns found in the form to upload.</string> | |||
<string name="guidance_hint_title">Show Guidance For Questions</string> |
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.
Should be in sentence case ("Show guidance for questions").
@@ -495,6 +495,9 @@ | |||
<string name="user_access_control">User Access Control</string> | |||
<string name="autosend_selector_title">Auto send</string> | |||
<string name="off">Off</string> | |||
<string name="guidance_no">No</string> | |||
<string name="guidance_yes">Yes - Always Shown</string> |
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.
always shown (all lowercase)
@@ -495,6 +495,9 @@ | |||
<string name="user_access_control">User Access Control</string> | |||
<string name="autosend_selector_title">Auto send</string> | |||
<string name="off">Off</string> | |||
<string name="guidance_no">No</string> | |||
<string name="guidance_yes">Yes - Always Shown</string> | |||
<string name="guidance_yes_collapsed">Yes - Collapsed</string> |
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.
collapsed (all lowercase)
Thanks for the review! Tappable area
Yes, we could make clicks only take place on the actual path. Currently I just have an |
Of course, I hadn't noticed that! That explains why I was having a tough time when I tried to tap the (i). Eventually it would be good to have both text and icon be tappable but let's wait for some preliminary UI feedback. 😊 |
Okay :) I made just the drawable clickable for now. Gonna do some thorough testing of it to see how it behaves. |
b5e591c
to
5ccab73
Compare
distributionUrl=https\://services.gradle.org/distributions/gradle-4.5.1-all.zip |
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 think this change should be reverted because we don't need the sources and documentation that all
comes with. Why download things we don't need 😂
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.
haha no prob. Never knew that's what the all
meant. Thanks for pointing that out.
I think this works really nicely, and we have tests! Hard to do complain about that... Some changes I'd like to see before this goes to testing.
I'm not a huge fan of the |
Good looking out @yanokwa . Honestly, I was used to putting asterisks/icons about hints at the end of the text from my old job so that's the reason I placed it there. I did some UX research on this topic and I found some detailed explanations from the folks over at UX Stack Exchange that justifies it being placed before the text so I am gonna opt for that approach because it makes more sense and it actually lessens most of the issues I had to deal with such as the icon trailing the text and causing inconsistencies with other hint guidance's that might be shorter. I am gonna work on this change and a subtle effect to make this more appealing and share it here 😄 |
@jd-alexander If you can get those changes sent in soon and fix the conflicts, I think we'd be ready to test and merge! |
@yanokwa Yes I am gonna finish this up! Was just a bit pre occupied with the SMS stuff but yes I want to finalize this so I will spend some time doing this tomorrow! |
@yanokwa I was thinking of adding a background to the guidance hint when it's in collapse mode so when it gets expanded it has a bit more body and outline. I have this working example in my repo of how it would look when it's open. What do you think? |
…line is displayed when it's expanded in collapsed mode.
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.
Few small things and this will be ready for QA!
- The guidance hint shouldn't disappear on rotate
- The hint font size is already small so I would like guidance hints to have the same font size
I don't find the box around the guidance hint necessary but I don't feel very strongly about it. @yanokwa?
@@ -21,6 +21,7 @@ | |||
public static final String KEY_CONSTRAINT_BEHAVIOR = "constraint_behavior"; | |||
public static final String KEY_HIGH_RESOLUTION = "high_resolution"; | |||
public static final String KEY_IMAGE_SIZE = "image_size"; | |||
public static final String KEY_GUIDANCE_HINT = "guidance_hint"; |
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.
Indentation here should match that of other values.
public static GuidanceHint get(String name) { | ||
for (GuidanceHint hint : GuidanceHint.values()) { | ||
if (hint.name.equals(name)) { | ||
|
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.
Remove extra blank line.
|
||
/** | ||
* Created by Ing. Oscar G. Medina Cruz on 18/06/2016. | ||
*/ | ||
public class AnimateUtils { | ||
|
||
|
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.
Remove extra blank line
@@ -39,4 +47,114 @@ public void onAnimationRepeat(Animation animation) { | |||
}); | |||
view.startAnimation(scaleInAnimation); | |||
} | |||
|
|||
|
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.
Remove extra blank line
animation.setAnimationListener(new Animation.AnimationListener() { | ||
@Override | ||
public void onAnimationStart(Animation animation) { | ||
|
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.
Remove extra blank line
|
||
|
||
/** | ||
* This method converts dp unit to equivalent pixels, depending on device density. |
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.
Remove "This method"
} | ||
|
||
/** | ||
* This method converts device specific pixels to density independent pixels. |
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.
Remove "This method"
|
||
if (android.text.TextUtils.isEmpty(guidanceHint)) { | ||
return null; | ||
|
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.
Remove extra blank line
/** Releases resources held by this widget */ | ||
|
||
private TextView configureGuidanceTextView(TextView guidanceTextView, String guidance) { | ||
|
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.
Remove extra blank line
guidanceTextView.setTextColor(ContextCompat.getColor(getContext(), R.color.primaryTextColor)); | ||
guidanceTextView.setMovementMethod(LinkMovementMethod.getInstance()); | ||
return guidanceTextView; | ||
|
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.
Remove extra blank line
I don't love the box. |
Okay no prob! Will remove the box! |
Awesome! Once you've done the changes and the merge conflicts are resolved (sorry!), you can add the |
… Performed several style fixes.
08bfec2
to
c1f5ab7
Compare
@opendatakit-bot label needs-testing |
Ready for testing 🎆 |
@jd-alexander I noticed a problem in case:
Additionally, |
Good catch, @mmarciniak90! @jd-alexander, hopefully these are relatively quick fixes. Would be great to get this in a beta by Thursday! |
Thanks for catching these @mmarciniak90 @lognaturel They should be! Working on them now. |
The hint guidance was being attached by using CompoundDrwables of TextView. The issue with using this was that there wasn't alot of flexibility with the layout attributes that could be applied to the drawable eg. padding can be applied (which was causing the bug) but not margins so I removed the drawable and created a layout to host the guidance textview and an an imageview for the icon
bebfd39
to
48164cf
Compare
@mmarciniak90 resolved the issues! Ready for another test to verify. |
@jd-alexander mentioned problems are resolved! |
The TimeWidget and DateWidget's help layout was hidden so that only the parent widget's layout is displayed. Previous only the help text was being hidden thus these changes had to take place due to the introduction of the new layout structure for hint guidance.
@mmarciniak90 Resolved and ready to go! |
Tested with success! @jd-alexander great work! Everything looks great! Verified on Android 4.1, 4.2, 4.4., 5.1 6.0, 7.0, 8.1 Verified cases:
@opendatakit-bot label "behavior verified" |
Closes #2007
What has been done to verify that this works as intended?
To verify that this functionality works I manually tested it by creating a form that has guidance attached to the hint of its question. Once that was done, I loaded the form into the Collect app, enabled guidance hints to be shown on questions within the Form Management Settings and opened the form's question which displayed the hint.
To further verify this functionality I wrote an Espresso test that enabled the guidance setting and I created a test instance of
FormEntryActivity
with the guidance hint form. I then fetched the guidance hint from the respectiveFormEntryPrompt
and compared it with the text of the TextView on the screen that's supposed to perform the rendering.Why is this the best possible solution? Were any other approaches considered?
This is the best possible solution due to the nature of how the JavaRosa SDK allows text strings with form attributes to be fetched.
Are there any risks to merging this code? If so, what are they?
The only risks associated with merging this code would be the changes that were made to the
HelpTextView
's layout constraints that were associated with the rendering of theAnswerView.
This was being done entirely in code so a xml layout file was used to encapsulate the additional layout that was necessary for the guidance text view. Nonetheless, I made several checks to ensure that these changes didn't break the functionality of the questions and the preexisting UI tests along with the UI test that was written for this feature verifies that this won't cause an impact.Do we need any specific form for testing your changes? If so, please attach one.
To test this functionality you need a form that has a guidance hint eg.
guidance_hint_form.xml.txt
Does this change require updates to documentation? If so, please file an issue at https://github.com/opendatakit/docs/issues/new and include the link below.
getodk/docs#635