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

Support for answerOptions as images/icons #1614

Closed
fredhersch opened this issue Sep 20, 2022 · 17 comments · Fixed by #1749
Closed

Support for answerOptions as images/icons #1614

fredhersch opened this issue Sep 20, 2022 · 17 comments · Fixed by #1749
Assignees
Labels
effort:medium Medium effort - 3 to 5 days good first issue Good for newcomers help wanted Extra attention is needed P1 High priority issue ux

Comments

@fredhersch
Copy link
Collaborator

fredhersch commented Sep 20, 2022

Is your feature request related to a problem? Please describe.
Be able to use images (e.g icons) for radio buttons

Describe the solution you'd like
As a developer I can use images to represent radio button options. These should work as radio button itemControls

See an example of using the "answerOption and rendering-xhtml" from the SDC spec here

Example shows two ways to use tags to display images: (1) with embedded data and (2) using contained Binary resources

Need to define the best approach for Android

@fredhersch
Copy link
Collaborator Author

@shelaghm can you add an example UI for this control. Ty.

@shelaghm
Copy link

Screen Shot 2022-09-20 at 16 45 02

I have two options for this, do you have a preference for showing the "radio checkbox" or not?
I like both options :)

@fredhersch
Copy link
Collaborator Author

I think this might be better achieved using the itemAnswerMedia Extension

This is similar to the ItemMedia Extension implemented

Both are currently DRAFT

cc: @jingtang10

@fredhersch
Copy link
Collaborator Author

@FikriMilano Are you interested in picking this up as it is very similar to the itemMedia Extension, but for answerOptions.

cc: @f-odhiambo

@jingtang10 jingtang10 moved this from Backlog to New in Android FHIR SDK Sep 26, 2022
@jingtang10 jingtang10 moved this from New to Backlog in Android FHIR SDK Oct 5, 2022
@PallaviGanorkar PallaviGanorkar self-assigned this Nov 9, 2022
@PallaviGanorkar
Copy link
Contributor

@shelaghm @jingtang10
Out of above 2 options for UI, which is final for implementation, whether to show the "radio checkbox" or not?

@shelaghm
Copy link

@PallaviGanorkar I think we should show the radio checkbox, because it makes it clear what type of a selection it is.

@PallaviGanorkar
Copy link
Contributor

@PallaviGanorkar I think we should show the radio checkbox, because it makes it clear what type of a selection it is.

Yes, Thanks @shelaghm

@jingtang10
Copy link
Collaborator

can we focus on using the item answer media extension?

not sure how well the xhtml extension will work on andorid - maybe we should do a little bit more exploration there. but for now, let's get the item answer media extension working with the data field (in its examples they're using the url field).

@PallaviGanorkar
Copy link
Contributor

PallaviGanorkar commented Nov 24, 2022

@shelaghm I have 2 queries for display image for item answerOptions

  1. change in shape of given image required?
  2. Change in color to match app theme is required?
    Please find the find the screen shot below for more details, here I am rendering binary data as BitmapDrawable.(FYI, its all dummy data i am using here)
    itemAnswerMedia

cc: @jingtang10

@shelaghm
Copy link

@PallaviGanorkar

  1. Can you say more about what you mean about change shape? The shape of it being a square or do you mean something else?
  2. Changing color to app default is a nice to have. This would only be relevant when developers are uploading BitmapDrawable, so for icons and vector graphics that is a nice feature. But I also imagine developers would upload jpgs/pngs where that functionality isn't possible. What do you think?

@jingtang10
Copy link
Collaborator

discussed with @PallaviGanorkar. just really quickly: 1) i think we might need to scale the image whilst preserving the aspect ratio. 2) we should do some testing to see if it's possible for the questionnaire to provide an icon with transparent background so it works with different application theme and style.

@PallaviGanorkar
Copy link
Contributor

@shelaghm I am using 48x48 image size here, Please let me know if you have other opinion about it

@shelaghm
Copy link

48x48 is a good size @PallaviGanorkar

@PallaviGanorkar
Copy link
Contributor

@jingtang10 As discussed tested image/png icons with transparent background and it works fine. Please find attached screen shot for details,
itemAnswerMedia_with_transparent_background

@PallaviGanorkar
Copy link
Contributor

@jingtang10 Here .png, jpeg, jpg format is supported and tested. Also looking into to support .svg format if possible.
Please let me known if any other image format need to support. I have have look into FHIR spec but could not found relevant info .

@PallaviGanorkar
Copy link
Contributor

PallaviGanorkar commented Dec 14, 2022

To support svg file, includes steps,

  1. decode base64 byte array to SVG image
  2. convert SVG to vectorDrawable xml in android

@1, Could not find direct way to decode base64 SVG image yet
@2, there are suggestion to use libraries.

@jingtang10
Copy link
Collaborator

thanks you for this this is great @PallaviGanorkar

@github-project-automation github-project-automation bot moved this from Backlog to Complete in Android FHIR SDK Jan 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
effort:medium Medium effort - 3 to 5 days good first issue Good for newcomers help wanted Extra attention is needed P1 High priority issue ux
Projects
Status: Complete
4 participants