Skip to content
This repository has been archived by the owner on Jun 20, 2023. It is now read-only.

Commit

Permalink
Fix: Offline onboarding (EXPOSUREAPP-14893) (#5888)
Browse files Browse the repository at this point in the history
  • Loading branch information
mtwalli committed Mar 8, 2023
1 parent 9f1773d commit f5a3bed
Show file tree
Hide file tree
Showing 7 changed files with 139 additions and 158 deletions.
Expand Up @@ -5,6 +5,7 @@ import android.os.Build
import android.os.Bundle
import android.provider.Settings
import android.view.View
import androidx.core.view.isGone
import androidx.core.view.isVisible
import androidx.fragment.app.Fragment
import de.rki.coronawarnapp.R
Expand All @@ -27,13 +28,11 @@ class InteroperabilityConfigurationFragment :
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)

vm.countryList.observe(viewLifecycleOwner) {
binding.interoperabilityConfigurationCountryList.setCountryList(it)
if (it.isEmpty()) {
binding.noCountriesRiskdetailsInfoview.isVisible = false
binding.interoperabilityConfigurationCountryList.isVisible = false
binding.noCountriesRiskdetailsInfoview.isVisible = true
}
vm.countryList.observe(viewLifecycleOwner) { countries ->
binding.countriesList.setCountryList(countries)
binding.countriesList.isGone = countries.isEmpty()
binding.countriesHeader.isGone = countries.isEmpty()
binding.noCountriesRiskdetailsInfoview.isVisible = countries.isEmpty()
}

vm.saveInteroperabilityUsed()
Expand Down
Expand Up @@ -3,6 +3,7 @@ package de.rki.coronawarnapp.ui.onboarding
import android.os.Bundle
import android.text.method.LinkMovementMethod
import android.view.View
import androidx.core.view.isGone
import androidx.core.view.isVisible
import androidx.fragment.app.Fragment
import androidx.navigation.fragment.findNavController
Expand All @@ -26,20 +27,18 @@ class OnboardingDeltaInteroperabilityFragment :

override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
vm.countryList.observe(viewLifecycleOwner) {
binding.deltaInteroperabilityCountryList.setCountryList(it)
if (it.isEmpty()) {
binding.countryListGroup.isVisible = false
binding.noCountriesGroup.isVisible = true
}
vm.countryList.observe(viewLifecycleOwner) { countries ->
binding.countryListHeader.isGone = countries.isEmpty()
binding.countryList.isGone = countries.isEmpty()
binding.countryList.setCountryList(countries)

binding.noCountriesHeader.isVisible = countries.isEmpty()
binding.noCountriesBody.isVisible = countries.isEmpty()
}
vm.saveInteroperabilityUsed()

binding.onboardingDeltaExpandedTermsTextLink
.convertToHyperlink(getString(R.string.information_terms_html_path))
binding.onboardingDeltaExpandedTermsTextLink
.movementMethod = LinkMovementMethod.getInstance()

binding.onboardingDeltaExpandedTermsTextLink.convertToHyperlink(getString(R.string.information_terms_html_path))
binding.onboardingDeltaExpandedTermsTextLink.movementMethod = LinkMovementMethod.getInstance()
binding.onboardingDeltaExpandedTermsTextLink.setOnClickListener {
findNavController().navigate(
OnboardingDeltaInteroperabilityFragmentDirections
Expand Down
Expand Up @@ -4,6 +4,8 @@ import android.content.Intent
import android.os.Bundle
import android.view.View
import android.view.accessibility.AccessibilityEvent
import androidx.core.view.isGone
import androidx.core.view.isVisible
import androidx.fragment.app.Fragment
import androidx.navigation.fragment.findNavController
import de.rki.coronawarnapp.R
Expand All @@ -28,9 +30,15 @@ class OnboardingTracingFragment : Fragment(R.layout.fragment_onboarding_tracing)

override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
vm.countryList.observe(viewLifecycleOwner) {
binding.countryList.setCountryList(it)
vm.countryList.observe(viewLifecycleOwner) { countries ->
binding.countryListHeader.isGone = countries.isEmpty()
binding.countryList.isGone = countries.isEmpty()
binding.countryList.setCountryList(countries)

binding.noCountriesHeader.isVisible = countries.isEmpty()
binding.noCountriesBody.isVisible = countries.isEmpty()
}

vm.saveInteroperabilityUsed()
binding.apply {
onboardingButtonNext.setOnClickListener { vm.onActivateTracingClicked() }
Expand Down
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/colorSurface">
Expand Down Expand Up @@ -47,9 +48,9 @@
style="@style/headline4"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="@dimen/margin_24"
android:layout_marginTop="@dimen/margin_16"
android:accessibilityHeading="true"
android:layout_marginHorizontal="@dimen/margin_24"
android:hyphenationFrequency="full"
android:text="@string/interoperability_configuration_title"
app:layout_constraintEnd_toEndOf="parent"
Expand All @@ -61,8 +62,8 @@
style="@style/subtitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/margin_16"
android:layout_marginHorizontal="@dimen/margin_24"
android:layout_marginTop="@dimen/margin_16"
android:text="@string/interoperability_configuration_first_section"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
Expand All @@ -73,8 +74,8 @@
style="@style/subtitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/margin_24"
android:layout_marginHorizontal="@dimen/margin_24"
android:layout_marginTop="@dimen/margin_24"
android:layout_marginBottom="@dimen/margin_16"
android:text="@string/interoperability_configuration_second_section"
app:layout_constraintEnd_toEndOf="parent"
Expand All @@ -85,54 +86,54 @@
android:id="@+id/no_countries_riskdetails_infoview"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="gone"
android:title="@string/interoperability_onboarding_list_title_riskdetection_no_network"
app:tracingStatusBody="@string/interoperability_onboarding_list_subtitle_failrequest_no_network"
android:src="@drawable/ic_interop_no_network"
app:tracingStatusButton="@string/interoperability_onboarding_list_button_title_no_network"
android:layout_marginTop="@dimen/margin_24"
android:src="@drawable/ic_interop_no_network"
android:title="@string/interoperability_onboarding_list_title_riskdetection_no_network"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/label_interoperability_subtitle2" />
app:layout_constraintTop_toBottomOf="@id/label_interoperability_subtitle2"
app:tracingStatusBody="@string/interoperability_onboarding_list_subtitle_failrequest_no_network"
app:tracingStatusButton="@string/interoperability_onboarding_list_button_title_no_network"
tools:visibility="visible" />

<TextView
android:id="@+id/interoperability_configuration_country_header_description"
android:id="@+id/countries_header"
style="@style/headline6"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/margin_24"
android:layout_marginHorizontal="@dimen/margin_24"
android:layout_marginTop="@dimen/margin_24"
android:accessibilityHeading="true"
android:text="@string/interoperability_configuration_list_title"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/label_interoperability_subtitle2" />
app:layout_constraintTop_toBottomOf="@id/no_countries_riskdetails_infoview" />

<de.rki.coronawarnapp.ui.view.CountryListView
android:id="@+id/interoperability_configuration_country_list"
android:id="@+id/countries_list"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/margin_16"
android:layout_marginHorizontal="@dimen/margin_24"
android:layout_marginTop="@dimen/margin_16"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/interoperability_configuration_country_header_description" />
app:layout_constraintTop_toBottomOf="@id/countries_header" />

<androidx.constraintlayout.widget.Barrier
android:id="@+id/country_list_barrier"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:barrierAllowsGoneWidgets="false"
app:barrierDirection="bottom"
app:constraint_referenced_ids="interoperability_configuration_country_list, no_countries_riskdetails_infoview" />
app:constraint_referenced_ids="countries_list, no_countries_riskdetails_infoview" />

<TextView
android:id="@+id/label_interoperability_subtitle4"
style="@style/subtitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/margin_24"
android:layout_marginHorizontal="@dimen/margin_24"
android:layout_marginTop="@dimen/margin_24"
android:text="@string/interoperability_configuration_information"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
Expand Down
Expand Up @@ -66,71 +66,54 @@
app:layout_constraintTop_toBottomOf="@id/delta_interoperability_headline"
app:secondSection="@string/interoperability_onboarding_randomid_download_free" />


<TextView
android:id="@+id/delta_interoperability_country_list_title"
style="@style/headline6"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/margin_24"
android:layout_marginTop="@dimen/margin_24"
android:layout_marginEnd="@dimen/margin_24"
android:accessibilityHeading="true"
android:text="@string/interoperability_onboarding_list_title"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/delta_interoperability_view_section" />

<de.rki.coronawarnapp.ui.view.CountryListView
android:id="@+id/delta_interoperability_country_list"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="@dimen/margin_24"
android:layout_marginTop="@dimen/margin_16"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/delta_interoperability_country_list_title" />

<androidx.constraintlayout.widget.Group
android:id="@+id/country_list_group"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:constraint_referenced_ids="delta_interoperability_country_list_title, delta_interoperability_country_list" />


<TextView
android:id="@+id/participating_countries_headline"
style="@style/headline5"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/margin_24"
android:layout_marginHorizontal="@dimen/margin_24"
android:focusable="false"
android:text="@string/interoperability_onboarding_list_title_failrequest"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/delta_interoperability_view_section" />


<TextView
android:id="@+id/participating_countries_body"
style="@style/body1"
<LinearLayout
android:id="@+id/country_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="@dimen/margin_24"
android:layout_marginTop="@dimen/margin_24"
android:focusable="true"
android:text="@string/interoperability_onboarding_list_subtitle_failrequest"
android:layout_height="match_parent"
android:orientation="vertical"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/participating_countries_headline" />

<androidx.constraintlayout.widget.Group
android:id="@+id/no_countries_group"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="gone"
app:constraint_referenced_ids="participating_countries_body, participating_countries_headline" />
app:layout_constraintTop_toBottomOf="@id/delta_interoperability_view_section">

<TextView
android:id="@+id/country_list_header"
style="@style/headline6"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/margin_24"
android:layout_marginTop="@dimen/margin_24"
android:layout_marginEnd="@dimen/margin_24"
android:accessibilityHeading="true"
android:text="@string/interoperability_onboarding_list_title" />

<de.rki.coronawarnapp.ui.view.CountryListView
android:id="@+id/country_list"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="@dimen/margin_24"
android:layout_marginTop="@dimen/margin_16" />

<TextView
android:id="@+id/no_countries_header"
style="@style/headline5"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="@dimen/margin_24"
android:layout_marginTop="@dimen/margin_24"
android:focusable="false"
android:text="@string/interoperability_onboarding_list_title_failrequest" />

<TextView
android:id="@+id/no_countries_body"
style="@style/body1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="@dimen/margin_24"
android:layout_marginTop="@dimen/margin_24"
android:focusable="true"
android:text="@string/interoperability_onboarding_list_subtitle_failrequest" />

</LinearLayout>

<TextView
android:id="@+id/interoperability_footer_title"
Expand All @@ -142,7 +125,7 @@
android:text="@string/interoperability_onboarding_delta_footerTitle"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/delta_interoperability_country_list" />
app:layout_constraintTop_toBottomOf="@id/country_container" />

<TextView
android:id="@+id/interoperability_footer_description"
Expand Down

0 comments on commit f5a3bed

Please sign in to comment.