Skip to content

Commit

Permalink
Merge branch 'master' into 1832-override-dimens
Browse files Browse the repository at this point in the history
  • Loading branch information
FikriMilano authored Feb 14, 2023
2 parents 859c81d + ccae099 commit 42d33c0
Show file tree
Hide file tree
Showing 53 changed files with 2,171 additions and 1,097 deletions.
3 changes: 0 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,6 @@ If you want to provide any feedback or discuss use cases you can:
* start a new topic in [android](https://chat.fhir.org/#narrow/stream/276344-android), [questionnaire](https://chat.fhir.org/#narrow/stream/179255-questionnaire), [implementers](https://chat.fhir.org/#narrow/stream/179166-implementers), or [WHO SMART guidelines](https://chat.fhir.org/#narrow/stream/310477-who-smart-guidelines) stream in the [FHIR Zulip chat](https://chat.fhir.org/)

## Disclaimer

This is not an officially supported Google product.

This product is not intended to be a medical device.

HL7®, and FHIR® are the registered trademarks of Health Level Seven International and their use of
Expand Down
2 changes: 1 addition & 1 deletion buildSrc/src/main/kotlin/Dependencies.kt
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ object Dependencies {
}

object Kotlin {
const val kotlinCoroutinesCore = "1.6.2"
const val kotlinCoroutinesCore = "1.6.4"
const val stdlib = "1.6.10"
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class QuestionnaireItemBarCodeReaderViewHolderFactoryInstrumentedTest {
Questionnaire.QuestionnaireItemComponent().apply { prefix = "Prefix?" },
QuestionnaireResponse.QuestionnaireResponseItemComponent(),
validationResult = NotValidated,
answersChangedCallback = { _, _, _ -> },
answersChangedCallback = { _, _, _, _ -> },
)
)

Expand All @@ -76,7 +76,7 @@ class QuestionnaireItemBarCodeReaderViewHolderFactoryInstrumentedTest {
Questionnaire.QuestionnaireItemComponent().apply { prefix = "" },
QuestionnaireResponse.QuestionnaireResponseItemComponent(),
validationResult = NotValidated,
answersChangedCallback = { _, _, _ -> },
answersChangedCallback = { _, _, _, _ -> },
)
)

Expand All @@ -91,7 +91,7 @@ class QuestionnaireItemBarCodeReaderViewHolderFactoryInstrumentedTest {
Questionnaire.QuestionnaireItemComponent().apply { text = "Question?" },
QuestionnaireResponse.QuestionnaireResponseItemComponent(),
validationResult = NotValidated,
answersChangedCallback = { _, _, _ -> },
answersChangedCallback = { _, _, _, _ -> },
)
)

Expand All @@ -113,7 +113,7 @@ class QuestionnaireItemBarCodeReaderViewHolderFactoryInstrumentedTest {
}
),
validationResult = NotValidated,
answersChangedCallback = { _, _, _ -> }
answersChangedCallback = { _, _, _, _ -> }
)
)

Expand Down
1 change: 1 addition & 0 deletions datacapture/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ dependencies {

testImplementation(Dependencies.AndroidxTest.core)
testImplementation(Dependencies.AndroidxTest.fragmentTesting)
testImplementation(Dependencies.Kotlin.kotlinCoroutinesTest)
testImplementation(Dependencies.Kotlin.kotlinTestJunit)
testImplementation(Dependencies.junit)
testImplementation(Dependencies.mockitoInline)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ class QuestionnaireItemPhoneNumberViewHolderFactoryInstrumentedTest {
Questionnaire.QuestionnaireItemComponent().apply { text = "Question?" },
QuestionnaireResponse.QuestionnaireResponseItemComponent(),
validationResult = NotValidated,
answersChangedCallback = { _, _, _ -> },
answersChangedCallback = { _, _, _, _ -> },
)
)

Expand All @@ -101,7 +101,7 @@ class QuestionnaireItemPhoneNumberViewHolderFactoryInstrumentedTest {
}
),
validationResult = NotValidated,
answersChangedCallback = { _, _, _ -> },
answersChangedCallback = { _, _, _, _ -> },
)
)

Expand All @@ -126,15 +126,15 @@ class QuestionnaireItemPhoneNumberViewHolderFactoryInstrumentedTest {
}
),
validationResult = NotValidated,
answersChangedCallback = { _, _, _ -> },
answersChangedCallback = { _, _, _, _ -> },
)
)
viewHolder.bind(
QuestionnaireItemViewItem(
Questionnaire.QuestionnaireItemComponent(),
QuestionnaireResponse.QuestionnaireResponseItemComponent(),
validationResult = NotValidated,
answersChangedCallback = { _, _, _ -> },
answersChangedCallback = { _, _, _, _ -> },
)
)

Expand All @@ -155,7 +155,7 @@ class QuestionnaireItemPhoneNumberViewHolderFactoryInstrumentedTest {
Questionnaire.QuestionnaireItemComponent(),
QuestionnaireResponse.QuestionnaireResponseItemComponent(),
validationResult = NotValidated,
answersChangedCallback = { _, _, _ -> },
answersChangedCallback = { _, _, _, _ -> },
)
viewHolder.bind(questionnaireItemViewItem)
viewHolder.itemView
Expand All @@ -173,7 +173,7 @@ class QuestionnaireItemPhoneNumberViewHolderFactoryInstrumentedTest {
Questionnaire.QuestionnaireItemComponent(),
QuestionnaireResponse.QuestionnaireResponseItemComponent(),
validationResult = NotValidated,
answersChangedCallback = { _, _, _ -> },
answersChangedCallback = { _, _, _, _ -> },
)

viewHolder.bind(questionnaireItemViewItem)
Expand All @@ -200,7 +200,7 @@ class QuestionnaireItemPhoneNumberViewHolderFactoryInstrumentedTest {
)
},
validationResult = NotValidated,
answersChangedCallback = { _, _, _ -> },
answersChangedCallback = { _, _, _, _ -> },
)
)

Expand All @@ -225,7 +225,7 @@ class QuestionnaireItemPhoneNumberViewHolderFactoryInstrumentedTest {
Invalid(
listOf("The maximum number of characters that are permitted in the answer is: 10")
),
answersChangedCallback = { _, _, _ -> },
answersChangedCallback = { _, _, _, _ -> },
)
)
assertThat(viewHolder.itemView.findViewById<TextInputLayout>(R.id.text_input_layout).error)
Expand All @@ -240,7 +240,7 @@ class QuestionnaireItemPhoneNumberViewHolderFactoryInstrumentedTest {
Questionnaire.QuestionnaireItemComponent().apply { readOnly = true },
QuestionnaireResponse.QuestionnaireResponseItemComponent(),
validationResult = NotValidated,
answersChangedCallback = { _, _, _ -> },
answersChangedCallback = { _, _, _, _ -> },
)
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,8 @@ import android.util.Base64
import android.view.View
import android.widget.Button
import android.widget.FrameLayout
import android.widget.ImageView
import android.widget.LinearLayout
import android.widget.TextView
import androidx.constraintlayout.widget.ConstraintLayout
import androidx.test.ext.junit.rules.ActivityScenarioRule
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.platform.app.InstrumentationRegistry
Expand All @@ -40,7 +39,7 @@ import org.junit.Test
import org.junit.runner.RunWith

@RunWith(AndroidJUnit4::class)
class QuestionnaireItemAttachmentPickerViewHolderFactoryEspressoTest {
class QuestionnaireItemAttachmentViewHolderFactoryEspressoTest {

@Rule
@JvmField
Expand Down Expand Up @@ -69,7 +68,7 @@ class QuestionnaireItemAttachmentPickerViewHolderFactoryEspressoTest {
},
QuestionnaireResponse.QuestionnaireResponseItemComponent(),
validationResult = NotValidated,
answersChangedCallback = { _, _, _ -> },
answersChangedCallback = { _, _, _, _ -> },
)

runOnUI { viewHolder.bind(questionnaireItemView) }
Expand All @@ -96,7 +95,7 @@ class QuestionnaireItemAttachmentPickerViewHolderFactoryEspressoTest {
},
QuestionnaireResponse.QuestionnaireResponseItemComponent(),
validationResult = NotValidated,
answersChangedCallback = { _, _, _ -> },
answersChangedCallback = { _, _, _, _ -> },
)

runOnUI { viewHolder.bind(questionnaireItemView) }
Expand All @@ -120,7 +119,7 @@ class QuestionnaireItemAttachmentPickerViewHolderFactoryEspressoTest {
},
QuestionnaireResponse.QuestionnaireResponseItemComponent(),
validationResult = NotValidated,
answersChangedCallback = { _, _, _ -> },
answersChangedCallback = { _, _, _, _ -> },
)

runOnUI { viewHolder.bind(questionnaireItemView) }
Expand All @@ -144,7 +143,7 @@ class QuestionnaireItemAttachmentPickerViewHolderFactoryEspressoTest {
},
QuestionnaireResponse.QuestionnaireResponseItemComponent(),
validationResult = NotValidated,
answersChangedCallback = { _, _, _ -> },
answersChangedCallback = { _, _, _, _ -> },
)

runOnUI { viewHolder.bind(questionnaireItemView) }
Expand Down Expand Up @@ -172,7 +171,7 @@ class QuestionnaireItemAttachmentPickerViewHolderFactoryEspressoTest {
},
QuestionnaireResponse.QuestionnaireResponseItemComponent(),
validationResult = NotValidated,
answersChangedCallback = { _, _, _ -> },
answersChangedCallback = { _, _, _, _ -> },
)

runOnUI { viewHolder.bind(questionnaireItemView) }
Expand Down Expand Up @@ -214,22 +213,15 @@ class QuestionnaireItemAttachmentPickerViewHolderFactoryEspressoTest {
)
},
validationResult = NotValidated,
answersChangedCallback = { _, _, _ -> },
answersChangedCallback = { _, _, _, _ -> },
)

runOnUI { viewHolder.bind(questionnaireItemView) }

assertThat(viewHolder.itemView.findViewById<Button>(R.id.take_photo).visibility)
assertThat(viewHolder.itemView.findViewById<ConstraintLayout>(R.id.photo_preview).visibility)
.isEqualTo(View.VISIBLE)

assertThat(viewHolder.itemView.findViewById<Button>(R.id.upload_photo).visibility)
.isEqualTo(View.VISIBLE)

assertThat(viewHolder.itemView.findViewById<Button>(R.id.upload_photo).text)
.isEqualTo(parent.context.getString(R.string.upload_photo))

assertThat(viewHolder.itemView.findViewById<ImageView>(R.id.photo_preview).visibility)
.isEqualTo(View.VISIBLE)
assertThat(viewHolder.itemView.findViewById<TextView>(R.id.photo_title).text).isEqualTo("IMG_1")
}

@Test
Expand Down Expand Up @@ -259,24 +251,15 @@ class QuestionnaireItemAttachmentPickerViewHolderFactoryEspressoTest {
)
},
validationResult = NotValidated,
answersChangedCallback = { _, _, _ -> },
answersChangedCallback = { _, _, _, _ -> },
)

runOnUI { viewHolder.bind(questionnaireItemView) }

assertThat(viewHolder.itemView.findViewById<Button>(R.id.upload_audio).visibility)
assertThat(viewHolder.itemView.findViewById<ConstraintLayout>(R.id.file_preview).visibility)
.isEqualTo(View.VISIBLE)

assertThat(viewHolder.itemView.findViewById<Button>(R.id.upload_audio).text)
.isEqualTo(parent.context.getString(R.string.upload_audio))

assertThat(viewHolder.itemView.findViewById<LinearLayout>(R.id.file_preview).visibility)
.isEqualTo(View.VISIBLE)

assertThat(viewHolder.itemView.findViewById<ImageView>(R.id.icon_file_preview).visibility)
.isEqualTo(View.VISIBLE)

assertThat(viewHolder.itemView.findViewById<TextView>(R.id.title_file_preview).text)
assertThat(viewHolder.itemView.findViewById<TextView>(R.id.file_title).text)
.isEqualTo("Audio File")
}

Expand Down Expand Up @@ -307,24 +290,15 @@ class QuestionnaireItemAttachmentPickerViewHolderFactoryEspressoTest {
)
},
validationResult = NotValidated,
answersChangedCallback = { _, _, _ -> },
answersChangedCallback = { _, _, _, _ -> },
)

runOnUI { viewHolder.bind(questionnaireItemView) }

assertThat(viewHolder.itemView.findViewById<Button>(R.id.upload_video).visibility)
.isEqualTo(View.VISIBLE)

assertThat(viewHolder.itemView.findViewById<Button>(R.id.upload_video).text)
.isEqualTo(parent.context.getString(R.string.upload_video))

assertThat(viewHolder.itemView.findViewById<LinearLayout>(R.id.file_preview).visibility)
.isEqualTo(View.VISIBLE)

assertThat(viewHolder.itemView.findViewById<ImageView>(R.id.icon_file_preview).visibility)
assertThat(viewHolder.itemView.findViewById<ConstraintLayout>(R.id.file_preview).visibility)
.isEqualTo(View.VISIBLE)

assertThat(viewHolder.itemView.findViewById<TextView>(R.id.title_file_preview).text)
assertThat(viewHolder.itemView.findViewById<TextView>(R.id.file_title).text)
.isEqualTo("Video File")
}

Expand Down Expand Up @@ -355,24 +329,15 @@ class QuestionnaireItemAttachmentPickerViewHolderFactoryEspressoTest {
)
},
validationResult = NotValidated,
answersChangedCallback = { _, _, _ -> },
answersChangedCallback = { _, _, _, _ -> },
)

runOnUI { viewHolder.bind(questionnaireItemView) }

assertThat(viewHolder.itemView.findViewById<Button>(R.id.upload_document).visibility)
assertThat(viewHolder.itemView.findViewById<ConstraintLayout>(R.id.file_preview).visibility)
.isEqualTo(View.VISIBLE)

assertThat(viewHolder.itemView.findViewById<Button>(R.id.upload_document).text)
.isEqualTo(parent.context.getString(R.string.upload_document))

assertThat(viewHolder.itemView.findViewById<LinearLayout>(R.id.file_preview).visibility)
.isEqualTo(View.VISIBLE)

assertThat(viewHolder.itemView.findViewById<ImageView>(R.id.icon_file_preview).visibility)
.isEqualTo(View.VISIBLE)

assertThat(viewHolder.itemView.findViewById<TextView>(R.id.title_file_preview).text)
assertThat(viewHolder.itemView.findViewById<TextView>(R.id.file_title).text)
.isEqualTo("Document File")
}

Expand All @@ -392,18 +357,15 @@ class QuestionnaireItemAttachmentPickerViewHolderFactoryEspressoTest {
},
QuestionnaireResponse.QuestionnaireResponseItemComponent().apply { addAnswer(null) },
validationResult = NotValidated,
answersChangedCallback = { _, _, _ -> },
answersChangedCallback = { _, _, _, _ -> },
)

runOnUI { viewHolder.bind(questionnaireItemView) }

assertThat(viewHolder.itemView.findViewById<ImageView>(R.id.photo_preview).visibility)
.isEqualTo(View.GONE)

assertThat(viewHolder.itemView.findViewById<LinearLayout>(R.id.file_preview).visibility)
assertThat(viewHolder.itemView.findViewById<ConstraintLayout>(R.id.photo_preview).visibility)
.isEqualTo(View.GONE)

assertThat(viewHolder.itemView.findViewById<Button>(R.id.delete).visibility)
assertThat(viewHolder.itemView.findViewById<ConstraintLayout>(R.id.file_preview).visibility)
.isEqualTo(View.GONE)
}

Expand Down Expand Up @@ -438,15 +400,12 @@ class QuestionnaireItemAttachmentPickerViewHolderFactoryEspressoTest {
)
},
validationResult = NotValidated,
answersChangedCallback = { _, _, _ -> },
answersChangedCallback = { _, _, _, _ -> },
)

runOnUI { viewHolder.bind(questionnaireItem) }

assertThat(viewHolder.itemView.findViewById<ImageView>(R.id.photo_preview).visibility)
.isEqualTo(View.VISIBLE)

assertThat(viewHolder.itemView.findViewById<Button>(R.id.delete).visibility)
assertThat(viewHolder.itemView.findViewById<ConstraintLayout>(R.id.photo_preview).visibility)
.isEqualTo(View.VISIBLE)

val questionnaireItemWithNullAnswer =
Expand All @@ -463,15 +422,12 @@ class QuestionnaireItemAttachmentPickerViewHolderFactoryEspressoTest {
},
QuestionnaireResponse.QuestionnaireResponseItemComponent().apply { addAnswer(null) },
validationResult = NotValidated,
answersChangedCallback = { _, _, _ -> },
answersChangedCallback = { _, _, _, _ -> },
)

runOnUI { viewHolder.bind(questionnaireItemWithNullAnswer) }

assertThat(viewHolder.itemView.findViewById<ImageView>(R.id.photo_preview).visibility)
.isEqualTo(View.GONE)

assertThat(viewHolder.itemView.findViewById<Button>(R.id.delete).visibility)
assertThat(viewHolder.itemView.findViewById<ConstraintLayout>(R.id.photo_preview).visibility)
.isEqualTo(View.GONE)
}

Expand Down
Loading

0 comments on commit 42d33c0

Please sign in to comment.