Skip to content

Commit

Permalink
Feature/behavior alignment (eu-digital-green-certificates#155)
Browse files Browse the repository at this point in the history
* Recovery update

* Vaccincation update

* Test update

* Update

* Removed unnecessary comments
  • Loading branch information
oleksandrsarapulovgl authored Jul 20, 2021
1 parent 82e3ce7 commit 49541f0
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 126 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,8 @@ class VerificationDialogFragment : BottomSheetDialogFragment() {
binding.certificateTypeText.text = when {
certificate.vaccinations?.isNotEmpty() == true -> getString(
R.string.type_vaccination,
certificate.vaccinations.first().doseNumber
certificate.vaccinations.first().doseNumber,
certificate.vaccinations.first().totalSeriesOfDoses
)
certificate.recoveryStatements?.isNotEmpty() == true -> getString(R.string.type_recovered)
certificate.tests?.isNotEmpty() == true -> getString(R.string.type_test)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@ class RecoveryViewHolder(private val binding: ItemRecoveryBinding) :
data.certificateValidFrom.parseFromTo(YEAR_MONTH_DAY, FORMATTED_YEAR_MONTH_DAY)
binding.validUntilValue.text =
data.certificateValidUntil.parseFromTo(YEAR_MONTH_DAY, FORMATTED_YEAR_MONTH_DAY)
binding.dateOfPositiveValue.text =
data.dateOfFirstPositiveTest.parseFromTo(YEAR_MONTH_DAY, FORMATTED_YEAR_MONTH_DAY)
binding.countryValue.text = data.countryOfVaccination
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,25 +32,13 @@ import dgca.verifier.app.android.toFormattedDateTime
class TestViewHolder(private val binding: ItemTestBinding) : RecyclerView.ViewHolder(binding.root) {

fun bind(data: TestModel) {
binding.testResultValue.text = data.resultType.value
val dateOfCollectionString: String? =
data.dateTimeOfCollection.toFormattedDateTime()?.apply {
binding.dateOfCollectionValue.text = this
}
binding.dateOfCollectionValue.visibility =
if (dateOfCollectionString?.isNotEmpty() == true) View.VISIBLE else View.GONE
val dateOfTestResult = data.dateTimeOfTestResult?.toFormattedDateTime()
if (dateOfTestResult?.isNotBlank() == true) {
binding.dateOfTestResultValue.text = dateOfTestResult
View.VISIBLE
} else {
View.GONE
}.apply {
binding.dateOfTestResultTitle.visibility = this
binding.dateOfTestResultValue.visibility = this
}
binding.diseaseValue.text = data.disease.value
binding.typeOfTestValue.text = data.typeOfTest
binding.countryValue.text = data.countryOfVaccination
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@ class VaccinationViewHolder(private val binding: ItemVaccinationBinding) :
binding.dateValue.text =
data.dateOfVaccination.parseFromTo(YEAR_MONTH_DAY, FORMATTED_YEAR_MONTH_DAY)
binding.diseaseValue.text = data.disease.value
binding.doseTotalNumberValue.text = data.totalSeriesOfDoses.toString()
binding.doseSequenceValue.text = data.doseNumber.toString()
binding.countryValue.text = data.countryOfVaccination
}

Expand Down
21 changes: 3 additions & 18 deletions app/src/main/res/layout/item_recovery.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:text="@string/disease_or_agent_targeted_title" />
android:text="@string/target_disease" />

<com.google.android.material.textview.MaterialTextView
android:id="@+id/disease_value"
Expand All @@ -49,7 +49,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:text="@string/certificate_valid_from_title" />
android:text="@string/date_of_recovery" />

<com.google.android.material.textview.MaterialTextView
android:id="@+id/valid_from_value"
Expand All @@ -64,7 +64,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:text="@string/certificate_valid_until_title" />
android:text="@string/certificate_expiration" />

<com.google.android.material.textview.MaterialTextView
android:id="@+id/valid_until_value"
Expand All @@ -73,21 +73,6 @@
android:layout_height="wrap_content"
tools:text="Feb 26, 1998" />

<com.google.android.material.textview.MaterialTextView
android:id="@+id/date_of_positive_title"
style="@style/TextAppearance.Dgca.CertificateTitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:text="@string/date_of_positive_title" />

<com.google.android.material.textview.MaterialTextView
android:id="@+id/date_of_positive_value"
style="@style/TextAppearance.Dgca.CertificateValue"
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:text="Feb 26, 1998" />

<com.google.android.material.textview.MaterialTextView
android:id="@+id/country_title"
style="@style/TextAppearance.Dgca.CertificateTitle"
Expand Down
55 changes: 5 additions & 50 deletions app/src/main/res/layout/item_test.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,58 +28,13 @@
android:orientation="vertical"
tools:background="@color/white">

<com.google.android.material.textview.MaterialTextView
android:id="@+id/test_result_title"
style="@style/TextAppearance.Dgca.CertificateTitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:text="@string/test_result_title" />

<com.google.android.material.textview.MaterialTextView
android:id="@+id/test_result_value"
style="@style/TextAppearance.Dgca.CertificateValue"
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:text="Negative" />

<com.google.android.material.textview.MaterialTextView
android:id="@+id/date_of_collection_title"
style="@style/TextAppearance.Dgca.CertificateTitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:text="@string/date_of_test_collection_title" />

<com.google.android.material.textview.MaterialTextView
android:id="@+id/date_of_collection_value"
style="@style/TextAppearance.Dgca.CertificateValue"
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:text="Feb 26, 1998" />

<com.google.android.material.textview.MaterialTextView
android:id="@+id/date_of_test_result_title"
style="@style/TextAppearance.Dgca.CertificateTitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:text="@string/date_of_test_result_title" />

<com.google.android.material.textview.MaterialTextView
android:id="@+id/date_of_test_result_value"
style="@style/TextAppearance.Dgca.CertificateValue"
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:text="Feb 26, 1998" />

<com.google.android.material.textview.MaterialTextView
android:id="@+id/disease_title"
style="@style/TextAppearance.Dgca.CertificateTitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:text="@string/disease_or_agent_targeted_title" />
android:text="@string/target_disease" />

<com.google.android.material.textview.MaterialTextView
android:id="@+id/disease_value"
Expand All @@ -89,19 +44,19 @@
tools:text="840539006" />

<com.google.android.material.textview.MaterialTextView
android:id="@+id/type_of_test_title"
android:id="@+id/date_of_collection_title"
style="@style/TextAppearance.Dgca.CertificateTitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:text="@string/type_of_test_title" />
android:text="@string/date_of_test" />

<com.google.android.material.textview.MaterialTextView
android:id="@+id/type_of_test_value"
android:id="@+id/date_of_collection_value"
style="@style/TextAppearance.Dgca.CertificateValue"
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:text="NAA test name" />
tools:text="Feb 26, 1998" />

<com.google.android.material.textview.MaterialTextView
android:id="@+id/country_title"
Expand Down
32 changes: 1 addition & 31 deletions app/src/main/res/layout/item_vaccination.xml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:text="@string/disease_or_agent_targeted_title" />
android:text="@string/target_disease" />

<com.google.android.material.textview.MaterialTextView
android:id="@+id/disease_value"
Expand All @@ -58,36 +58,6 @@
android:layout_height="wrap_content"
tools:text="840539006" />

<com.google.android.material.textview.MaterialTextView
android:id="@+id/dose_total_number_title"
style="@style/TextAppearance.Dgca.CertificateTitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:text="@string/total_series_of_doses_title" />

<com.google.android.material.textview.MaterialTextView
android:id="@+id/dose_total_number_value"
style="@style/TextAppearance.Dgca.CertificateValue"
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:text="2" />

<com.google.android.material.textview.MaterialTextView
android:id="@+id/dose_sequence_title"
style="@style/TextAppearance.Dgca.CertificateTitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:text="@string/dose_number_title" />

<com.google.android.material.textview.MaterialTextView
android:id="@+id/dose_sequence_value"
style="@style/TextAppearance.Dgca.CertificateValue"
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:text="1" />

<com.google.android.material.textview.MaterialTextView
android:id="@+id/country_title"
style="@style/TextAppearance.Dgca.CertificateTitle"
Expand Down
19 changes: 9 additions & 10 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<string name="cert_invalid">Invalid</string>
<string name="type_test">Test</string>
<string name="type_recovered">Recovery</string>
<string name="type_vaccination">Vaccination Shot #%1$d</string>
<string name="type_vaccination">Vaccination %1$d of %2$d</string>
<string name="done">Done</string>
<string name="retry">Retry</string>
<string name="reason_for_invalidity">Reason for Invalidity</string>
Expand All @@ -37,17 +37,16 @@
<string name="standardised_given_name_title">Standardised Given Name</string>
<string name="date_of_birth_title">Date of Birth</string>
<string name="date_of_vaccination_title">Date of Vaccination</string>
<string name="total_series_of_doses_title">Total Series of Doses</string>
<string name="dose_number_title">Dose Number</string>
<!-- <string name="dose_number_title">Dose Number</string>-->
<string name="issuer_country">Issuer Country</string>
<string name="disease_or_agent_targeted_title">Disease or agent targeted</string>
<string name="date_of_test_collection_title">Date of Collection</string>
<string name="date_of_test_result_title">Date of Test Result</string>
<string name="type_of_test_title">Type of Test</string>
<string name="target_disease">Target Disease</string>
<string name="date_of_test">Date of Test</string>
<!-- <string name="date_of_test_result_title">Date of Test Result</string>-->
<!-- <string name="type_of_test_title">Type of Test</string>-->
<string name="test_result_title">Test Result</string>
<string name="certificate_valid_from_title">Certificate Valid From</string>
<string name="certificate_valid_until_title">Certificate Valid Until</string>
<string name="date_of_positive_title">Date of First Positive Test</string>
<string name="date_of_recovery">Date of Recovery</string>
<string name="certificate_expiration">Certificate Expiration</string>
<!-- <string name="date_of_positive_title">Date of First Positive Test</string>-->

<string name="settings">Settings</string>
<string name="privacy_information">Privacy information</string>
Expand Down

0 comments on commit 49541f0

Please sign in to comment.