-
Notifications
You must be signed in to change notification settings - Fork 563
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
[Android] Update input error visual cue rendering to support custom background drawables #4942
Conversation
…edina-ms/Android_UpdateErrorCue
@almedina-ms this is running into asome Android build failures |
@jwoo-msft is this actually going into 20.10? |
...ecards/src/main/java/io/adaptivecards/renderer/input/customcontrols/IValidatedInputView.java
Show resolved
Hide resolved
...ivecards/src/main/java/io/adaptivecards/renderer/input/customcontrols/ValidatedCheckBox.java
Show resolved
Hide resolved
...ivecards/src/main/java/io/adaptivecards/renderer/input/customcontrols/ValidatedCheckBox.java
Outdated
Show resolved
Hide resolved
...ivecards/src/main/java/io/adaptivecards/renderer/input/customcontrols/ValidatedCheckBox.java
Outdated
Show resolved
Hide resolved
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 still think we should try to detect custom input rather than requiring a flag, but this is something we can revisit in the future, as it wouldn't be a breaking change.
source/android/adaptivecards/src/main/res/drawable/adaptive_choiceset_compact_background.xml
Outdated
Show resolved
Hide resolved
...ndroid/adaptivecards/src/main/res/drawable/adaptive_choiceset_compact_background_invalid.xml
Outdated
Show resolved
Hide resolved
source/android/adaptivecards/src/main/res/drawable/adaptive_choiceset_expanded_background.xml
Outdated
Show resolved
Hide resolved
...droid/adaptivecards/src/main/res/drawable/adaptive_choiceset_expanded_background_invalid.xml
Outdated
Show resolved
Hide resolved
source/android/mobile/src/main/res/drawable/adaptive_choiceset_compact_background_.xml
Show resolved
Hide resolved
source/android/mobile/src/main/res/drawable/adaptive_choiceset_expanded_background_.xml
Show resolved
Hide resolved
source/android/mobile/src/main/res/drawable/layered_edit_text_styles.xml
Show resolved
Hide resolved
source/android/mobile/src/main/res/drawable/layered_edit_text_styles.xml
Outdated
Show resolved
Hide resolved
…hub.com/microsoft/AdaptiveCards into user/almedina-ms/Android_UpdateErrorCue
🎉 Handy links: |
…ackground drawables (microsoft#4942) * Save Container Card Id in RenderArgs constructor * Change input hint to rectangle around input * Change edit text style in case we ever need it * Udate visual cues and add support for custom inputs * Clean PR a little bit * Add visual cues for choice elements * Update API to support compact choiceset styling * Add visual cues for choice elements (microsoft#4940) * Add samples in mobile app * Add first changes * Fix PR comments regarding API documentation and new lines * Update name for error state * Update the implementation for a better merge Co-authored-by: Paul Campbell <paulcam@microsoft.com> Co-authored-by: shalinijoshi19 <shalinij@microsoft.com>
An accident happened and #4895 got merged, redoing the PR
Fixes #4830
Description
Adds options to modify the rendering of the error visual cues for validated inputs. The original version of this feature only considered the default drawable which has a transparent background, due to this when tinting the background it could have unintended side effect such as tinting the whole background, such as in the example below
For this fix we added two new attributes called
adaptiveUsingCustomTextInputs
andadaptiveUsingCustomChoiceSetInputs
.adaptiveUsingCustomTextInputs
: boolean flag that signalize the renderer to set thestate_error
with a value of true instead of tinting the text input background.adaptiveUsingCustomChoiceSetInputs
: boolean flag to control some internal rendering for compact choice sets. If the value is set totrue
but no background is provided results may varyOn the other hand we added a new drawable state called
state_error
which allows customers to define background drawables which define how an invalid input would look likeFinally, we also added two new drawable selector files
adaptive_choiceset_compact_background.xml
andadaptive_choiceset_expanded_background.xml
:compact
drawable: controls the background for compact choicesets, if theadaptiveUsingCustomTextInputs
flag is not set or set to false, the drawable is applied to a linear layout that encloses the spinner and is tinted inattention
color.expanded
drawable: controls the background for expanded choicesets (mono and multi select) and the background for Toggle inputs. In all cases this background is tinted with theattention
color to mimic the current JS and iOS behaviours.How Verified
The fix was verified by adding the previously mentioned properties into our app theme (which will be modified for each of the examples below)
For reference, layered_edit_text_styles is a selector which only defines a drawable for invalid state and a default drawable
Example 1: No custom inputs
Example 2: Having a custom drawable, but stating that is not using custom inputs
Example 3: Having a custom drawable
Example 4: Default behavior for choiceset and toggle input validations
Also, the default behaviour for choiceset inputs validation has changed to show a border around the inputs
Toggle Input has changed too
And the default behaviour of compact choice set is as follows
Example 5: Overriding a compact choiceset
styles.xml
The default background drawable for spinners can be updated by creating a file called
adaptive_choiceset_compact_background.xml
in the drawables folder, in this file anstate_error
flag can be set in the selector to define how the compact choice set should look likeadaptive_choiceset_compact_background.xml in drawables folder
Example 6: Overriding the rendering of expanded choicesets
The rendering for the expanded choice set and toggle inputs can also be modified (in this case no flag is required), the only consideration is that the border is always tinted with the
attention
color to keep consistency. As can be seen in the image below, the corners can be changed to be more rounded or change the width of the enclosing rectangleMicrosoft Reviewers: Open in CodeFlow