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

Answer entered in masked number questions can be seen on android keyboard in landscape view #6122

Closed
WKobus opened this issue May 2, 2024 · 7 comments · Fixed by #6187
Closed
Assignees
Milestone

Comments

@WKobus
Copy link

WKobus commented May 2, 2024

ODK Collect version

the master version b3cd4a0

Android version

10, 11, 14

Device used

Redmi 9T, Galaxy M12, Pixel 7a

Problem description

Answer entered in masked number questions can be seen on android keyboard in landscape view.

Steps to reproduce the problem

  1. Open masked text form
    masked_text.xlsx.txt
  2. Go to any number question
  3. Input numbers
  4. Rotate device to landscape view

Expected behavior

Answer entered in masked number question should be hidden on android keyboard in landscape view

@github-project-automation github-project-automation bot moved this to not ready in ODK Collect May 2, 2024
@grzesiek2010 grzesiek2010 added this to the v2024.2 milestone May 2, 2024
@grzesiek2010 grzesiek2010 moved this from not ready to ready in ODK Collect May 2, 2024
@grzesiek2010 grzesiek2010 self-assigned this May 2, 2024
@grzesiek2010 grzesiek2010 moved this from ready to in progress in ODK Collect May 2, 2024
@grzesiek2010
Copy link
Member

The issue we're facing is that we can create an EditText that only allows entering numbers and is password-protected if it's a standard numeric text field without any variations. However, in our case, when we use integer questions, it is TYPE_NUMBER_FLAG_SIGNED, and for decimal questions, it is TYPE_NUMBER_FLAG_DECIMAL. The isPasswordInputType method from the TextView class demonstrates this limitation:

    static boolean isPasswordInputType(int inputType) {
        final int variation =
                inputType & (EditorInfo.TYPE_MASK_CLASS | EditorInfo.TYPE_MASK_VARIATION);
        return variation
                == (EditorInfo.TYPE_CLASS_TEXT | EditorInfo.TYPE_TEXT_VARIATION_PASSWORD)
                || variation
                == (EditorInfo.TYPE_CLASS_TEXT | EditorInfo.TYPE_TEXT_VARIATION_WEB_PASSWORD)
                || variation
                == (EditorInfo.TYPE_CLASS_NUMBER | EditorInfo.TYPE_NUMBER_VARIATION_PASSWORD);
    }

I kind of hacked it by using the transformation method (PasswordTransformationMethod) directly: https://github.com/getodk/collect/blob/master/collect_app/src/main/java/org/odk/collect/android/views/WidgetAnswerText.kt#L63
However, this doesn't work in landscape mode when the EditText is in full-screen mode - the transformation method doesn't function, (any) including the password transformation.

What can we do about this? Here are some options:

  • Disable full-screen mode for EditTexts (either entirely or only when the masked appearance is used). This is not an issue with larger devices, as they use a floating keyboard instead of full-screen mode, so there would be no difference.
  • Stop supporting the masked appearance in integer and decimal question types (or only use positive numbers in integer questions when the masked appearance is used).
  • Leave it as it is since it's not a critical issue and, as mentioned above, only affects smaller devices without a floating keyboard in landscape mode.

@seadowg @lognaturel
what do you think? I would vote for the first option.

@seadowg
Copy link
Member

seadowg commented Jun 3, 2024

I'd vote for option 2 (don't support masked for integer and decimal questions). It seems like a reasonable trade off. Not opposed to option 1 though if that's everyone else's preference: it just seems like even more maintenance to a feature that already feels like it's got a undeservedly high code cost.

@lognaturel
Copy link
Member

I find full-screen mode pretty disorienting so I'd be happy to do away with it if it's a change that's easy to make and understand.

But I do see @seadowg's point and am fine with either of the other two options, really. Sorry I don't have a more helpful opinion here!

@grzesiek2010
Copy link
Member

I find full-screen mode pretty disorienting so I'd be happy to do away with it if it's a change that's easy to make and understand.

It is easy but is it ok from the UI perspective? @alyblenkin what do you think? It wouldn't be possible to answer questions on smaller devices in landscape mode I guess.
@alyblenkin if you want I can create an apk with that change for you so that you can play with it.

@alyblenkin
Copy link
Collaborator

@alyblenkin if you want I can create an apk with that change for you so that you can play with it.

That would be great, if it's not too much work!

@alyblenkin
Copy link
Collaborator

alyblenkin commented Jun 7, 2024

I think I'm leaning towards option 2 without playing around with it because we could make it clear in the documentation that we don't support masked for integer and decimal questions and that wouldn't be as confusing from a user experience perspective.

@lognaturel
Copy link
Member

I didn’t realize it would be impossible to fill in. That doesn’t sound like a good option, then. Happy to go with what @alyblenkin prefers!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: done
Development

Successfully merging a pull request may close this issue.

5 participants