Skip to content

Commit

Permalink
Feature/os alignment new (#89)
Browse files Browse the repository at this point in the history
* Updated wallet texts displaying

* Added certificate type to claim certificate page

* Implemented manufacturer check up

* Updated

* Update

* Update

* Update

* Update

* Update

* Update
  • Loading branch information
oleksandrsarapulovgl authored Jul 23, 2021
1 parent b8d23c5 commit fbb2ffc
Show file tree
Hide file tree
Showing 21 changed files with 505 additions and 259 deletions.
90 changes: 90 additions & 0 deletions .idea/sonarIssues.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 8 additions & 8 deletions .idea/sonarlint/issuestore/index.pb

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ class CertificateCardsAdapter(
binding.titleView.text = when {
certificateCard.certificate.vaccinations?.first() != null -> binding.root.resources.getString(
R.string.vaccination,
certificateCard.certificate.vaccinations.first().doseNumber.toString()
certificateCard.certificate.vaccinations.first().doseNumber.toString(),
certificateCard.certificate.vaccinations.first().totalSeriesOfDoses.toString()
)
certificateCard.certificate.recoveryStatements?.isNotEmpty() == true -> binding.root.resources.getString(R.string.recovery)
certificateCard.certificate.tests?.isNotEmpty() == true -> binding.root.resources.getString(R.string.test)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,10 @@ import androidx.navigation.fragment.findNavController
import androidx.navigation.fragment.navArgs
import androidx.recyclerview.widget.LinearLayoutManager
import dagger.hilt.android.AndroidEntryPoint
import dgca.wallet.app.android.FORMATTED_YEAR_MONTH_DAY
import dgca.wallet.app.android.R
import dgca.wallet.app.android.YEAR_MONTH_DAY
import dgca.wallet.app.android.data.CertificateModel
import dgca.wallet.app.android.data.getCertificateListData
import dgca.wallet.app.android.databinding.FragmentCertificateClaimBinding
import dgca.wallet.app.android.parseFromTo

@AndroidEntryPoint
class ClaimCertificateFragment : Fragment() {
Expand Down Expand Up @@ -88,31 +85,31 @@ class ClaimCertificateFragment : Fragment() {
_binding = null
}

private fun CertificateModel.getType() = when {
this.vaccinations?.isNotEmpty() == true -> getString(
R.string.vaccination,
this.vaccinations.first().doseNumber.toString(),
this.vaccinations.first().totalSeriesOfDoses.toString()
)
this.recoveryStatements?.isNotEmpty() == true -> getString(R.string.recovery)
this.tests?.isNotEmpty() == true -> getString(R.string.test)
else -> ""
}

private fun showUserData(certificate: CertificateModel) {
binding.personFullName.text = certificate.getFullName()
binding.personStandardisedFamilyName.text = certificate.person.standardisedFamilyName
binding.personStandardisedFamilyNameTitle.isVisible = true
val standardisedGivenName = certificate.person.standardisedGivenName
if (standardisedGivenName?.isNotBlank() == true) {
binding.personStandardisedGivenName.text = standardisedGivenName
View.VISIBLE
} else {
View.GONE
}.apply {
binding.personStandardisedGivenNameTitle.visibility = this
binding.personStandardisedGivenName.visibility = this
}
certificate.getType().bindText(binding.certificateTypeTitle, binding.certificateTypeValue)
certificate.getFullName().bindText(binding.nameTitle, binding.personFullName)

val dateOfBirth = certificate.dateOfBirth.parseFromTo(YEAR_MONTH_DAY, FORMATTED_YEAR_MONTH_DAY)
if (dateOfBirth.isNotBlank()) {
binding.dateOfBirth.text = dateOfBirth
View.VISIBLE
} else {
View.GONE
}.apply {
binding.dateOfBirthTitle.visibility = this
binding.dateOfBirth.visibility = this
}
// val dateOfBirth = certificate.dateOfBirth.parseFromTo(YEAR_MONTH_DAY, FORMATTED_YEAR_MONTH_DAY)
// if (dateOfBirth.isNotBlank()) {
// binding.dateOfBirth.text = dateOfBirth
// View.VISIBLE
// } else {
// View.GONE
// }.apply {
// binding.dateOfBirthTitle.visibility = this
// binding.dateOfBirth.visibility = this
// }
}

private fun onViewModelEvent(event: ClaimCertificateViewModel.ClaimCertEvent) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,13 @@ class RecoveryViewHolder(private val binding: ItemRecoveryBinding) : RecyclerVie

fun bind(data: RecoveryModel) {
binding.diseaseValue.text = data.disease.value
binding.validFromValue.text = data.certificateValidFrom.parseFromTo(YEAR_MONTH_DAY, FORMATTED_YEAR_MONTH_DAY)
binding.validUntilValue.text = data.certificateValidUntil.parseFromTo(YEAR_MONTH_DAY, FORMATTED_YEAR_MONTH_DAY)
val validFrom = data.certificateValidFrom.parseFromTo(YEAR_MONTH_DAY, FORMATTED_YEAR_MONTH_DAY)
val validTo = data.certificateValidUntil.parseFromTo(YEAR_MONTH_DAY, FORMATTED_YEAR_MONTH_DAY)
val validFromTo = if (validFrom.isNotBlank() && validTo.isNotBlank()) "$validFrom - $validTo" else ""
validFromTo.bindText(binding.validFromTitle, binding.validFromValue)
binding.dateOfPositiveValue.text = data.dateOfFirstPositiveTest.parseFromTo(YEAR_MONTH_DAY, FORMATTED_YEAR_MONTH_DAY)
binding.countryValue.text = data.countryOfVaccination
data.countryOfVaccination.bindCountryWith(binding.countryTitle, binding.countryValue)
data.certificateIssuer.bindText(binding.certificateIssuerTitle, binding.certificateIssuerValue)
}

companion object {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,20 +35,13 @@ class TestViewHolder(private val binding: ItemTestBinding) : RecyclerView.ViewHo
fun bind(data: TestModel) {
binding.testResultValue.text = data.resultType.value
binding.dateOfCollectionValue.text = data.dateTimeOfCollection.toFormattedDateTime()
val dateTimeOfTestResult = data.dateTimeOfTestResult?.toFormattedDateTime()
if (dateTimeOfTestResult?.isNotBlank() == true) {
binding.dateOfTestResultValue.text = dateTimeOfTestResult
View.VISIBLE
} else {
View.GONE
}.apply {
binding.dateOfTestResultTitle.visibility = this
binding.dateOfTestResultValue.visibility = this
}
(data.dateTimeOfTestResult?.toFormattedDateTime() ?: "").bindText(binding.dateOfTestResultTitle, binding.dateOfTestResultValue)

binding.diseaseValue.text = data.disease.value
binding.typeOfTestValue.text = data.typeOfTest.value
binding.countryValue.text = data.countryOfVaccination
data.testingCentre.bindText(binding.testingCenterTitle, binding.testingCenterValue)
data.countryOfVaccination.bindCountryWith(binding.countryTitle, binding.countryValue)
data.certificateIssuer.bindText(binding.certificateIssuerTitle, binding.certificateIssuerValue)
}

companion object {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,10 @@ class VaccinationViewHolder(private val binding: ItemVaccinationBinding) : Recyc
fun bind(data: VaccinationModel) {
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
data.manufacturer.value.bindText(binding.manufacturerTitle, binding.manufacturerValue)
data.vaccine.value.bindText(binding.vaccineOrProphylaxisTitle, binding.vaccineOrProphylaxisValue)
data.countryOfVaccination.bindCountryWith(binding.countryTitle, binding.countryValue)
data.certificateIssuer.bindText(binding.certificateIssuerTitle, binding.certificateIssuerValue)
}

companion object {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
/*
* ---license-start
* eu-digital-green-certificates / dgca-wallet-app-android
* ---
* Copyright (C) 2021 T-Systems International GmbH and all other contributors
* ---
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ---license-end
*
* Created by osarapulov on 7/22/21 8:42 PM
*/

package dgca.wallet.app.android.certificate.claim

import android.view.View
import android.widget.TextView
import java.util.*


fun String.bindCountryWith(countryTitleView: View, countryValueView: TextView) {
val issuerCountry =
if (this.isNotBlank()) Locale("", this).displayCountry else ""
issuerCountry.apply {
if (this.isNotBlank()) {
countryValueView.text = this
View.VISIBLE
} else {
View.GONE
}.apply {
countryTitleView.visibility = this
countryValueView.visibility = this
}
}
}

fun String.bindText(titleView: View, valueView: TextView) = apply {
if (this.isNotBlank()) {
valueView.text = this
View.VISIBLE
} else {
View.GONE
}.apply {
titleView.visibility = this
valueView.visibility = this
}
}
Loading

0 comments on commit fbb2ffc

Please sign in to comment.