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

726 repeated groups #1289

Closed
wants to merge 31 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
a41fc00
Create blank.yml
RaaziaTarique Mar 16, 2022
7db66c7
Delete blank.yml
RaaziaTarique Mar 16, 2022
49b2be7
Merge branch 'google:master' into master
RaaziaTarique Mar 17, 2022
03baeb2
- Testing commit
RaaziaTarique Mar 17, 2022
b078aef
- Testing commit changes reverted
RaaziaTarique Mar 17, 2022
749edbd
- Changes for repeated groups
RaaziaTarique Apr 4, 2022
7dffcfb
- Changes for repeated groups
RaaziaTarique Apr 4, 2022
8776601
Merge branch 'master' into 726-repeated-groups
RaaziaTarique Apr 4, 2022
3c31aea
- Modified code
RaaziaTarique Apr 4, 2022
f8ad29d
- Modified code
RaaziaTarique Apr 5, 2022
72850be
Merge branch 'master' into 726-repeated-groups
RaaziaTarique Apr 5, 2022
3b0fbeb
- Code refactoring.
RaaziaTarique Apr 5, 2022
980c797
- Nested recyclerView Initiative
RaaziaTarique Apr 6, 2022
d3f0e7c
- Nested recyclerView Initiative
RaaziaTarique Apr 6, 2022
f1053ac
my changes
RaaziaTarique Apr 6, 2022
131529d
- Add click listener
RaaziaTarique Apr 12, 2022
38b6197
my changes2
RaaziaTarique Apr 12, 2022
2ba707f
- Add remove click listener
RaaziaTarique Apr 13, 2022
a6d9efd
Merge branch 'google:master' into master
RaaziaTarique Apr 13, 2022
99647a7
- spotlessApply
RaaziaTarique Apr 13, 2022
f1e2d6a
Merge remote-tracking branch 'origin/726-repeated-groups' into 726-re…
RaaziaTarique Apr 13, 2022
d7f39f2
- Place check for removing views
RaaziaTarique Apr 14, 2022
0952ecc
Merge branch 'google:master' into master
RaaziaTarique Apr 17, 2022
a29a9ae
Merge branch 'master' into 726-repeated-groups
RaaziaTarique Apr 18, 2022
84d2f5f
- changes in QuestionnaireItemAdapter.kt
RaaziaTarique Apr 19, 2022
bf94eb1
Merge remote-tracking branch 'origin/726-repeated-groups' into 726-re…
RaaziaTarique Apr 19, 2022
8daf114
Add repeat items support inside Q and QR objects
ekigamba Apr 19, 2022
26f8e18
Merge pull request #4 from ekigamba/726-repeated-groups
RaaziaTarique Apr 19, 2022
73b93e0
Merge branch 'google:master' into master
RaaziaTarique Apr 21, 2022
06d2a13
Merge branch 'master' into 726-repeated-groups
RaaziaTarique Apr 21, 2022
8684e7b
- Modify addItem method of QuestionnaireItemAdapter.kt
RaaziaTarique Apr 21, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ object CustomNumberPickerFactory :
numberPicker = itemView.findViewById(R.id.number_picker)
}

override fun bind(questionnaireItemViewItem: QuestionnaireItemViewItem) {
override fun bind(questionnaireItemViewItem: QuestionnaireItemViewItem, position: Int) {
numberPicker.minValue = 1
numberPicker.maxValue = 100
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,43 @@ class QuestionnaireItemPhoneNumberViewHolderFactoryInstrumentedTest {
assertThat(viewHolderFromAdapter).isInstanceOf(viewHolder::class.java)
}

@Test
fun shouldShowPrefixText() {
viewHolder.bind(
QuestionnaireItemViewItem(
Questionnaire.QuestionnaireItemComponent().apply { prefix = "Prefix?" },
QuestionnaireResponse.QuestionnaireResponseItemComponent()
) {},
0
)

assertThat(viewHolder.itemView.findViewById<TextView>(R.id.prefix_text_view).isVisible).isTrue()
assertThat(viewHolder.itemView.findViewById<TextView>(R.id.prefix_text_view).text.toString())
.isEqualTo("Prefix?")
}

@Test
fun shouldHidePrefixText() {
viewHolder.bind(
QuestionnaireItemViewItem(
Questionnaire.QuestionnaireItemComponent().apply { prefix = "" },
QuestionnaireResponse.QuestionnaireResponseItemComponent()
) {},
0
)

assertThat(viewHolder.itemView.findViewById<TextView>(R.id.prefix_text_view).isVisible)
.isFalse()
}

@Test
fun shouldSetTextViewText() {
viewHolder.bind(
QuestionnaireItemViewItem(
Questionnaire.QuestionnaireItemComponent().apply { text = "Question?" },
QuestionnaireResponse.QuestionnaireResponseItemComponent()
) {}
) {},
0
)

assertThat(viewHolder.itemView.findViewById<TextView>(R.id.question).text.toString())
Expand All @@ -88,7 +118,8 @@ class QuestionnaireItemPhoneNumberViewHolderFactoryInstrumentedTest {
value = StringType("+12345678910")
}
)
) {}
) {},
0
)

assertThat(
Expand All @@ -113,13 +144,15 @@ class QuestionnaireItemPhoneNumberViewHolderFactoryInstrumentedTest {
value = StringType("+12345678910")
}
)
) {}
) {},
0
)
viewHolder.bind(
QuestionnaireItemViewItem(
Questionnaire.QuestionnaireItemComponent(),
QuestionnaireResponse.QuestionnaireResponseItemComponent()
) {}
) {},
0
)

assertThat(
Expand All @@ -141,7 +174,7 @@ class QuestionnaireItemPhoneNumberViewHolderFactoryInstrumentedTest {
QuestionnaireResponse.QuestionnaireResponseItemComponent()
) {}

viewHolder.bind(questionnaireItemViewItem)
viewHolder.bind(questionnaireItemViewItem, 0)
viewHolder
.itemView
.findViewById<TextInputEditText>(R.id.text_input_edit_text)
Expand All @@ -161,7 +194,7 @@ class QuestionnaireItemPhoneNumberViewHolderFactoryInstrumentedTest {
QuestionnaireResponse.QuestionnaireResponseItemComponent()
) {}

viewHolder.bind(questionnaireItemViewItem)
viewHolder.bind(questionnaireItemViewItem, 0)
viewHolder.itemView.findViewById<TextInputEditText>(R.id.text_input_edit_text).setText("")

assertThat(questionnaireItemViewItem.questionnaireResponseItem.answer.size).isEqualTo(0)
Expand All @@ -184,7 +217,8 @@ class QuestionnaireItemPhoneNumberViewHolderFactoryInstrumentedTest {
}
)
}
) {}
) {},
0
)

assertThat(viewHolder.itemView.findViewById<TextInputLayout>(R.id.text_input_layout).error)
Expand All @@ -204,7 +238,8 @@ class QuestionnaireItemPhoneNumberViewHolderFactoryInstrumentedTest {
}
)
}
) {}
) {},
0
)

assertThat(viewHolder.itemView.findViewById<TextInputLayout>(R.id.text_input_layout).error)
Expand All @@ -218,7 +253,8 @@ class QuestionnaireItemPhoneNumberViewHolderFactoryInstrumentedTest {
QuestionnaireItemViewItem(
Questionnaire.QuestionnaireItemComponent().apply { readOnly = true },
QuestionnaireResponse.QuestionnaireResponseItemComponent()
) {}
) {},
0
)

assertThat(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ class QuestionnaireItemBarCodeReaderViewHolderFactoryInstrumentedTest {
QuestionnaireItemViewItem(
Questionnaire.QuestionnaireItemComponent().apply { prefix = "Prefix?" },
QuestionnaireResponse.QuestionnaireResponseItemComponent()
) {}
) {},
0
)

assertThat(viewHolder.itemView.findViewById<TextView>(R.id.prefix).isVisible).isTrue()
Expand All @@ -73,7 +74,8 @@ class QuestionnaireItemBarCodeReaderViewHolderFactoryInstrumentedTest {
QuestionnaireItemViewItem(
Questionnaire.QuestionnaireItemComponent().apply { prefix = "" },
QuestionnaireResponse.QuestionnaireResponseItemComponent()
) {}
) {},
0
)

assertThat(viewHolder.itemView.findViewById<TextView>(R.id.prefix).isVisible).isFalse()
Expand All @@ -86,7 +88,8 @@ class QuestionnaireItemBarCodeReaderViewHolderFactoryInstrumentedTest {
QuestionnaireItemViewItem(
Questionnaire.QuestionnaireItemComponent().apply { text = "Question?" },
QuestionnaireResponse.QuestionnaireResponseItemComponent()
) {}
) {},
0
)

assertThat(viewHolder.itemView.findViewById<TextView>(R.id.question).text.toString())
Expand All @@ -106,7 +109,8 @@ class QuestionnaireItemBarCodeReaderViewHolderFactoryInstrumentedTest {
value = StringType("Barcode Result")
}
)
) {}
) {},
0
)

assertThat(viewHolder.itemView.findViewById<TextView>(R.id.textInputEditText).text.toString())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ class QuestionnaireItemAutoCompleteViewHolderFactoryInstrumentedTest {
QuestionnaireItemViewItem(
Questionnaire.QuestionnaireItemComponent().apply { text = "Question" },
QuestionnaireResponse.QuestionnaireResponseItemComponent()
) {}
) {},
0
)

assertThat(viewHolder.itemView.findViewById<TextView>(R.id.question).text.toString())
Expand Down Expand Up @@ -91,7 +92,8 @@ class QuestionnaireItemAutoCompleteViewHolderFactoryInstrumentedTest {
(QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent().apply {
value = answerOption.first { it.displayString == "Test1 Code" }.valueCoding
})
}
},
0
)

assertThat(viewHolder.itemView.findViewById<ViewGroup>(R.id.flexboxLayout).childCount)
Expand Down Expand Up @@ -133,7 +135,8 @@ class QuestionnaireItemAutoCompleteViewHolderFactoryInstrumentedTest {
value = answerOption.first { it.displayString == "Test2 Code" }.valueCoding
}
)
}
},
0
)

assertThat(viewHolder.itemView.findViewById<ViewGroup>(R.id.flexboxLayout).childCount)
Expand Down Expand Up @@ -168,7 +171,8 @@ class QuestionnaireItemAutoCompleteViewHolderFactoryInstrumentedTest {
(QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent().apply {
value = answerOption.first { it.displayString == "Test1 Code" }.valueCoding
})
}
},
0
)

assertThat(viewHolder.itemView.findViewById<ViewGroup>(R.id.flexboxLayout).childCount)
Expand All @@ -182,7 +186,8 @@ class QuestionnaireItemAutoCompleteViewHolderFactoryInstrumentedTest {
QuestionnaireItemViewItem(
Questionnaire.QuestionnaireItemComponent().apply { required = true },
QuestionnaireResponse.QuestionnaireResponseItemComponent()
) {}
) {},
0
)

assertThat(viewHolder.itemView.findViewById<TextInputLayout>(R.id.text_input_layout).error)
Expand All @@ -209,7 +214,8 @@ class QuestionnaireItemAutoCompleteViewHolderFactoryInstrumentedTest {
}
)
}
) {}
) {},
0
)

assertThat(viewHolder.itemView.findViewById<TextInputLayout>(R.id.text_input_layout).error)
Expand All @@ -236,7 +242,8 @@ class QuestionnaireItemAutoCompleteViewHolderFactoryInstrumentedTest {
(QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent().apply {
value = answerOption.first { it.displayString == "readOnly" }.valueCoding
})
}
},
0
)

assertThat(viewHolder.itemView.findViewById<ViewGroup>(R.id.flexboxLayout)[0].isEnabled)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ class QuestionnaireItemBooleanTypePickerViewHolderFactoryInstrumentedTest {
text = "Question?"
},
QuestionnaireResponse.QuestionnaireResponseItemComponent()
) {}
) {},
0
)

assertThat(viewHolder.itemView.findViewById<TextView>(R.id.question).text.toString())
Expand All @@ -67,7 +68,7 @@ class QuestionnaireItemBooleanTypePickerViewHolderFactoryInstrumentedTest {
Questionnaire.QuestionnaireItemComponent().apply { text = "Question?" },
QuestionnaireResponse.QuestionnaireResponseItemComponent()
) {}
viewHolder.bind(questionnaireItemViewItem)
viewHolder.bind(questionnaireItemViewItem, 0)

assertThat(questionnaireItemViewItem.questionnaireResponseItem.answer).isEmpty()
}
Expand All @@ -79,7 +80,8 @@ class QuestionnaireItemBooleanTypePickerViewHolderFactoryInstrumentedTest {
QuestionnaireItemViewItem(
Questionnaire.QuestionnaireItemComponent().apply { text = "Question?" },
QuestionnaireResponse.QuestionnaireResponseItemComponent()
) {}
) {},
0
)

assertThat(viewHolder.itemView.findViewById<RadioButton>(R.id.yes_radio_button).isChecked)
Expand All @@ -101,7 +103,7 @@ class QuestionnaireItemBooleanTypePickerViewHolderFactoryInstrumentedTest {
}
)
) {}
viewHolder.bind(questionnaireItemViewItem)
viewHolder.bind(questionnaireItemViewItem, 0)

assertThat(
questionnaireItemViewItem.questionnaireResponseItem.answer.single().valueBooleanType.value
Expand All @@ -121,7 +123,8 @@ class QuestionnaireItemBooleanTypePickerViewHolderFactoryInstrumentedTest {
value = BooleanType(true)
}
)
) {}
) {},
0
)

assertThat(viewHolder.itemView.findViewById<RadioButton>(R.id.yes_radio_button).isChecked)
Expand All @@ -143,7 +146,7 @@ class QuestionnaireItemBooleanTypePickerViewHolderFactoryInstrumentedTest {
}
)
) {}
viewHolder.bind(questionnaireItemViewItem)
viewHolder.bind(questionnaireItemViewItem, 0)

assertThat(
questionnaireItemViewItem.questionnaireResponseItem.answer.single().valueBooleanType.value
Expand All @@ -163,7 +166,8 @@ class QuestionnaireItemBooleanTypePickerViewHolderFactoryInstrumentedTest {
value = BooleanType(false)
}
)
) {}
) {},
0
)

assertThat(viewHolder.itemView.findViewById<RadioButton>(R.id.yes_radio_button).isChecked)
Expand All @@ -180,7 +184,7 @@ class QuestionnaireItemBooleanTypePickerViewHolderFactoryInstrumentedTest {
Questionnaire.QuestionnaireItemComponent().apply { text = "Question?" },
QuestionnaireResponse.QuestionnaireResponseItemComponent()
) {}
viewHolder.bind(questionnaireItemViewItem)
viewHolder.bind(questionnaireItemViewItem, 0)
viewHolder.itemView.findViewById<RadioButton>(R.id.yes_radio_button).performClick()

assertThat(
Expand All @@ -197,7 +201,7 @@ class QuestionnaireItemBooleanTypePickerViewHolderFactoryInstrumentedTest {
Questionnaire.QuestionnaireItemComponent().apply { text = "Question?" },
QuestionnaireResponse.QuestionnaireResponseItemComponent()
) {}
viewHolder.bind(questionnaireItemViewItem)
viewHolder.bind(questionnaireItemViewItem, 0)
viewHolder.itemView.findViewById<RadioButton>(R.id.no_radio_button).performClick()

assertThat(
Expand All @@ -220,7 +224,7 @@ class QuestionnaireItemBooleanTypePickerViewHolderFactoryInstrumentedTest {
)
}
) {}
viewHolder.bind(questionnaireItemViewItem)
viewHolder.bind(questionnaireItemViewItem, 0)
viewHolder.itemView.findViewById<RadioButton>(R.id.yes_radio_button).performClick()

assertThat(questionnaireItemViewItem.questionnaireResponseItem.answer).isEmpty()
Expand All @@ -240,7 +244,7 @@ class QuestionnaireItemBooleanTypePickerViewHolderFactoryInstrumentedTest {
)
}
) {}
viewHolder.bind(questionnaireItemViewItem)
viewHolder.bind(questionnaireItemViewItem, 0)
viewHolder.itemView.findViewById<RadioButton>(R.id.yes_radio_button).performClick()

assertThat(viewHolder.itemView.findViewById<RadioButton>(R.id.yes_radio_button).isChecked)
Expand All @@ -263,7 +267,7 @@ class QuestionnaireItemBooleanTypePickerViewHolderFactoryInstrumentedTest {
)
}
) {}
viewHolder.bind(questionnaireItemViewItem)
viewHolder.bind(questionnaireItemViewItem, 0)
viewHolder.itemView.findViewById<RadioButton>(R.id.no_radio_button).performClick()

assertThat(questionnaireItemViewItem.questionnaireResponseItem.answer).isEmpty()
Expand All @@ -283,7 +287,7 @@ class QuestionnaireItemBooleanTypePickerViewHolderFactoryInstrumentedTest {
)
}
) {}
viewHolder.bind(questionnaireItemViewItem)
viewHolder.bind(questionnaireItemViewItem, 0)
viewHolder.itemView.findViewById<RadioButton>(R.id.no_radio_button).performClick()

assertThat(viewHolder.itemView.findViewById<RadioButton>(R.id.yes_radio_button).isChecked)
Expand All @@ -299,7 +303,8 @@ class QuestionnaireItemBooleanTypePickerViewHolderFactoryInstrumentedTest {
QuestionnaireItemViewItem(
Questionnaire.QuestionnaireItemComponent().apply { required = true },
QuestionnaireResponse.QuestionnaireResponseItemComponent()
) {}
) {},
0
)

assertThat(viewHolder.itemView.findViewById<TextView>(R.id.error).text)
Expand All @@ -319,7 +324,8 @@ class QuestionnaireItemBooleanTypePickerViewHolderFactoryInstrumentedTest {
}
)
}
) {}
) {},
0
)

assertThat(viewHolder.itemView.findViewById<TextView>(R.id.error).text).isEqualTo("")
Expand All @@ -341,7 +347,8 @@ class QuestionnaireItemBooleanTypePickerViewHolderFactoryInstrumentedTest {
}
)
}
) {}
) {},
0
)

assertThat(
Expand Down
Loading