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

Add hidden-answer appearance for string with external app #6572

Open
lognaturel opened this issue Jan 27, 2025 · 0 comments · May be fixed by #6623
Open

Add hidden-answer appearance for string with external app #6572

lognaturel opened this issue Jan 27, 2025 · 0 comments · May be fixed by #6623

Comments

@lognaturel
Copy link
Member

We recently added the hidden-answer appearance for barcode. We've also had a request for the same appearance for external apps that return strings because those external apps can return very long/ugly values that are intended to be processed in some way before being shown to users.

We typically start a forum thread to consider new feature ideas but this feels like a clear enough extension of existing work that I think we can just make it so.

For ExStringWidgetTest:

    @Test
    public void whenPromptHasHiddenAnswerAppearance_answerIsNotDisplayed() {
        String appearance = "ex:my.cool.app(a_param=1,another=3) " + Appearances.HIDDEN_ANSWER;
        FormEntryPrompt prompt = new MockFormEntryPromptBuilder(promptWithAppearance(appearance))
                .withAnswer(new StringData("original contents"))
                .build();
        WidgetTestActivity widgetTestActivity = QuestionWidgetHelpers.widgetTestActivity();
        ExStringWidget widget = new ExStringWidget(widgetTestActivity, new QuestionDetails(prompt),
                new FakeWaitingForDataRegistry(), stringRequester);
        // Check initial value is not shown
        assertThat(widget.binding.widgetAnswerText.getVisibility(), equalTo(View.GONE));
        assertThat(widget.getAnswer(), equalTo(new StringData("original contents")));
        // Check updates aren't shown
        widget.setData("updated contents");
        assertThat(widget.binding.widgetAnswerText.getVisibility(), equalTo(View.GONE));
        assertThat(widget.getAnswer(), equalTo(new StringData("updated contents")));
    }
@seadowg seadowg moved this from inbox to ready in ODK Collect Feb 4, 2025
@grzesiek2010 grzesiek2010 self-assigned this Feb 24, 2025
@grzesiek2010 grzesiek2010 moved this from ready to in progress in ODK Collect Feb 24, 2025
@grzesiek2010 grzesiek2010 linked a pull request Feb 24, 2025 that will close this issue
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: in progress
Development

Successfully merging a pull request may close this issue.

2 participants