-
Notifications
You must be signed in to change notification settings - Fork 2
MS-479 age group selection screen #749
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
Merged
Merged
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
ee89069
Add Age group selection screen
meladRaouf dab1da7
Add Age group selection event
meladRaouf b2e4dd8
Merge remote-tracking branch 'origin/main' into age-based-sdk-selection
meladRaouf 9132013
Merge remote-tracking branch 'origin/main' into age-based-sdk-selection
meladRaouf ad312ec
[MS-479] handle selection result
meladRaouf f6937bd
[MS-479] Use the new fingerprint sdk config
meladRaouf 2f7ec38
[MS-479] Handle age groups overlapping
meladRaouf ca12fa8
[MS-479] add SelectSubjectAgeGroupViewModelTest
meladRaouf b060479
[MS-479] add ApiAgeGroup.kt to ApiFingerprintConfiguration
meladRaouf 9bd05c4
Merge remote-tracking branch 'origin/main' into age-based-sdk-selection
meladRaouf 7f13b41
[MS-479] Code reformat
meladRaouf f34cbc8
[MS-479] Add tests to SelectSubjectAgeGroupViewModelTest
meladRaouf 33a6887
[MS-479] support years fraction groups
meladRaouf 0c67b09
[MS-479] retrieve null startInclusive from the api
meladRaouf 7bd6974
[MS-479] Apply code review comments
meladRaouf 266b985
Merge remote-tracking branch 'refs/remotes/origin/main' into age-base…
meladRaouf File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,2 @@ | ||
| # Dont warn about the missing files during the obfuscation | ||
| -dontwarn java.lang.invoke.StringConcatFactory | ||
| -dontwarn com.simprints.infra.resources.R$string | ||
| -dontwarn com.simprints.infra.resources.R$color | ||
| -dontwarn com.simprints.infra.resources.R$drawable | ||
| -dontwarn com.simprints.** |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| /build |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| plugins { | ||
| id("simprints.feature") | ||
| id("kotlin-parcelize") | ||
| } | ||
|
|
||
| android { | ||
| namespace = "com.simprints.feature.selectagegroup" | ||
| } | ||
|
|
||
| dependencies { | ||
| implementation(project(":infra:events")) | ||
| implementation(project(":infra:auth-store")) | ||
| implementation(project(":infra:logging")) | ||
| implementation(project(":infra:config-store")) | ||
| implementation(project(":feature:exit-form")) | ||
|
|
||
| } |
2 changes: 2 additions & 0 deletions
2
feature/select-subject-age-group/src/main/AndroidManifest.xml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| <?xml version="1.0" encoding="utf-8"?> | ||
| <manifest /> |
6 changes: 6 additions & 0 deletions
6
...group/src/main/java/com/simprints/feature/selectagegroup/SelectSubjectAgeGroupContract.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| package com.simprints.feature.selectagegroup | ||
|
|
||
|
|
||
| object SelectSubjectAgeGroupContract { | ||
| val DESTINATION = R.id.selectSubjectAgeGroupFragment | ||
| } |
11 changes: 11 additions & 0 deletions
11
...e-group/src/main/java/com/simprints/feature/selectagegroup/SelectSubjectAgeGroupResult.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| package com.simprints.feature.selectagegroup | ||
|
|
||
| import androidx.annotation.Keep | ||
| import com.simprints.infra.config.store.models.AgeGroup | ||
| import java.io.Serializable | ||
|
|
||
| @Keep | ||
| data class SelectSubjectAgeGroupResult( | ||
| val ageGroup: AgeGroup, | ||
| ) : Serializable | ||
|
|
56 changes: 56 additions & 0 deletions
56
...ct-age-group/src/main/java/com/simprints/feature/selectagegroup/screen/AgeGroupAdapter.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| package com.simprints.feature.selectagegroup.screen | ||
|
|
||
| import android.view.LayoutInflater | ||
| import android.view.View | ||
| import android.view.ViewGroup | ||
| import android.widget.ImageView | ||
| import android.widget.TextView | ||
| import androidx.recyclerview.widget.RecyclerView | ||
| import com.simprints.core.ExcludedFromGeneratedTestCoverageReports | ||
| import com.simprints.feature.selectagegroup.R | ||
| import com.simprints.infra.resources.R as IDR | ||
|
|
||
|
|
||
| // The age groups should be sorted as follows: Newborn, Baby, Child, Adult | ||
| // because the icons are in that order | ||
| @ExcludedFromGeneratedTestCoverageReports("UI classes are not unit tested") | ||
| internal class AgeGroupAdapter( | ||
| private val ageGroups: List<AgeGroupDisplayModel>, | ||
| private val onClick: (AgeGroupDisplayModel) -> Unit | ||
| ) : RecyclerView.Adapter<AgeGroupAdapter.ViewHolder>() { | ||
| override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder { | ||
| val layoutInflater = LayoutInflater.from(parent.context) | ||
| val view = layoutInflater.inflate(R.layout.age_group_item, parent, false) | ||
| return ViewHolder(view) | ||
|
|
||
| } | ||
|
|
||
| override fun onBindViewHolder(holder: ViewHolder, position: Int) { | ||
| val ageGroup = ageGroups[position] | ||
| holder.bind(ageGroup, position) | ||
| } | ||
|
|
||
| override fun getItemCount() = ageGroups.size | ||
|
|
||
| private val icons = intArrayOf( | ||
| IDR.drawable.ic_age_group_selection_new_born, | ||
| IDR.drawable.ic_age_group_selection_baby, | ||
| IDR.drawable.ic_age_group_selection_child, | ||
| IDR.drawable.ic_age_group_selection_adult | ||
| ) | ||
|
|
||
| @ExcludedFromGeneratedTestCoverageReports("UI classes are not unit tested") | ||
| inner class ViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) { | ||
| private val ageGroupTextView: TextView = itemView.findViewById(R.id.item_label) | ||
| private val ageGroupIcon: ImageView = itemView.findViewById(R.id.item_icon) | ||
| fun bind(ageGroupDisplayModel: AgeGroupDisplayModel, position: Int) { | ||
| ageGroupTextView.text = ageGroupDisplayModel.displayString | ||
| // if the position is greater than the number of icons, use the last icon | ||
| ageGroupIcon.setImageResource(icons.getOrNull(position) ?: icons.last()) | ||
|
|
||
| itemView.setOnClickListener { | ||
| onClick(ageGroupDisplayModel) | ||
| } | ||
| } | ||
| } | ||
| } |
5 changes: 5 additions & 0 deletions
5
...e-group/src/main/java/com/simprints/feature/selectagegroup/screen/AgeGroupDisplayModel.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| package com.simprints.feature.selectagegroup.screen | ||
|
|
||
| import com.simprints.infra.config.store.models.AgeGroup | ||
|
|
||
| internal data class AgeGroupDisplayModel(val displayString: String, val range: AgeGroup) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.