diff --git a/collect_app/src/main/java/org/odk/collect/android/utilities/Appearances.kt b/collect_app/src/main/java/org/odk/collect/android/utilities/Appearances.kt index 78d4067709f..12f3331f62e 100644 --- a/collect_app/src/main/java/org/odk/collect/android/utilities/Appearances.kt +++ b/collect_app/src/main/java/org/odk/collect/android/utilities/Appearances.kt @@ -20,7 +20,6 @@ import org.javarosa.core.model.Constants import org.javarosa.form.api.FormEntryPrompt import org.odk.collect.android.dynamicpreload.ExternalDataUtil import org.odk.collect.androidshared.utils.ScreenUtils -import java.lang.Exception object Appearances { // Date appearances @@ -196,6 +195,8 @@ object Appearances { @JvmStatic fun isMasked(prompt: FormEntryPrompt): Boolean { val appearance = getSanitizedAppearanceHint(prompt) - return appearance.contains(MASKED) && prompt.dataType == Constants.DATATYPE_TEXT + return appearance.contains(MASKED) && + !appearance.contains(NUMBERS) && + prompt.dataType == Constants.DATATYPE_TEXT } } diff --git a/collect_app/src/test/java/org/odk/collect/android/utilities/AppearancesTest.kt b/collect_app/src/test/java/org/odk/collect/android/utilities/AppearancesTest.kt index aa718aa2363..017504a632c 100644 --- a/collect_app/src/test/java/org/odk/collect/android/utilities/AppearancesTest.kt +++ b/collect_app/src/test/java/org/odk/collect/android/utilities/AppearancesTest.kt @@ -401,4 +401,11 @@ class AppearancesTest { whenever(formEntryPrompt.dataType).thenReturn(Constants.DATATYPE_DECIMAL) assertFalse(Appearances.isMasked(formEntryPrompt)) } + + @Test + fun `isMasked returns false when 'masked' appearance is found for text questions with 'numbers' appearance`() { + whenever(formEntryPrompt.dataType).thenReturn(Constants.DATATYPE_TEXT) + whenever(formEntryPrompt.appearanceHint).thenReturn("masked numbers") + assertFalse(Appearances.isMasked(formEntryPrompt)) + } }