From d55977d9d7e0a39af9bdffd2deb2dc7296a1a710 Mon Sep 17 00:00:00 2001 From: Hee Tatt Ooi Date: Sun, 7 Jun 2020 13:33:41 +0200 Subject: [PATCH 01/16] catch CwaSecurityException for update check (#244) * catch CwaSecurityException for update * catch CwaSecurityException for update --- .../java/de/rki/coronawarnapp/update/UpdateChecker.kt | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/update/UpdateChecker.kt b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/update/UpdateChecker.kt index 2644430f991..3d56617f253 100644 --- a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/update/UpdateChecker.kt +++ b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/update/UpdateChecker.kt @@ -14,6 +14,7 @@ import com.google.android.play.core.install.model.AppUpdateType import com.google.android.play.core.install.model.UpdateAvailability import de.rki.coronawarnapp.BuildConfig import de.rki.coronawarnapp.R +import de.rki.coronawarnapp.exception.CwaSecurityException import de.rki.coronawarnapp.server.protocols.ApplicationConfigurationOuterClass import de.rki.coronawarnapp.service.applicationconfiguration.ApplicationConfigurationService import de.rki.coronawarnapp.ui.LauncherActivity @@ -31,12 +32,13 @@ class UpdateChecker(private val activity: LauncherActivity) { suspend fun checkForUpdate() { // check if an update is needed based on server config - // TODO replace with signature exception val updateNeededFromServer: Boolean = try { checkIfUpdatesNeededFromServer() + } catch (exception: CwaSecurityException) { + Log.e(TAG, "CwaSecurityException caught:" + exception.localizedMessage) + true } catch (exception: Exception) { - Log.e(TAG, exception.localizedMessage ?: "unknown error") - exception.printStackTrace() + Log.e(TAG, "Exception caught:" + exception.localizedMessage) false } From b6a9b74bc32bdc76ef268356460c23bab7215ece Mon Sep 17 00:00:00 2001 From: Hee Tatt Ooi Date: Sun, 7 Jun 2020 15:20:05 +0200 Subject: [PATCH 02/16] Moved reporting related exception classes to own sub-package (#247) * moved reporting related exception classes into own package * removed wildcard imports * removed more wildcard imports --- .../java/de/rki/coronawarnapp/CoronaWarnApplication.kt | 7 ++++--- .../main/java/de/rki/coronawarnapp/TestForAPIFragment.kt | 2 +- .../java/de/rki/coronawarnapp/TestRiskLevelCalculation.kt | 2 +- .../exception/{ => reporting}/ErrorReportReceiver.kt | 3 ++- .../exception/{ => reporting}/ExceptionReporter.kt | 3 ++- .../exception/{ => reporting}/ReportingConstants.kt | 2 +- .../rki/coronawarnapp/nearby/ExposureStateUpdateWorker.kt | 2 +- .../nearby/InternalExposureNotificationPermissionHelper.kt | 2 +- .../coronawarnapp/receiver/ExposureStateUpdateReceiver.kt | 2 +- .../main/java/de/rki/coronawarnapp/risk/TimeVariables.kt | 2 +- .../de/rki/coronawarnapp/sharing/ExposureSharingService.kt | 2 +- .../java/de/rki/coronawarnapp/storage/TracingRepository.kt | 2 +- .../rki/coronawarnapp/ui/settings/SettingsResetFragment.kt | 2 +- .../coronawarnapp/ui/settings/SettingsTracingFragment.kt | 2 +- .../rki/coronawarnapp/ui/viewmodel/SubmissionViewModel.kt | 2 +- .../de/rki/coronawarnapp/ui/viewmodel/TracingViewModel.kt | 2 +- .../java/de/rki/coronawarnapp/util/ConnectivityHelper.kt | 2 +- 17 files changed, 22 insertions(+), 19 deletions(-) rename Corona-Warn-App/src/main/java/de/rki/coronawarnapp/exception/{ => reporting}/ErrorReportReceiver.kt (95%) rename Corona-Warn-App/src/main/java/de/rki/coronawarnapp/exception/{ => reporting}/ExceptionReporter.kt (93%) rename Corona-Warn-App/src/main/java/de/rki/coronawarnapp/exception/{ => reporting}/ReportingConstants.kt (87%) diff --git a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/CoronaWarnApplication.kt b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/CoronaWarnApplication.kt index f1f40cb4af0..cae06737762 100644 --- a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/CoronaWarnApplication.kt +++ b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/CoronaWarnApplication.kt @@ -14,8 +14,8 @@ import androidx.lifecycle.LifecycleObserver import androidx.lifecycle.OnLifecycleEvent import androidx.lifecycle.ProcessLifecycleOwner import androidx.localbroadcastmanager.content.LocalBroadcastManager -import de.rki.coronawarnapp.exception.ErrorReportReceiver -import de.rki.coronawarnapp.exception.ReportingConstants.ERROR_REPORT_LOCAL_BROADCAST_CHANNEL +import de.rki.coronawarnapp.exception.reporting.ErrorReportReceiver +import de.rki.coronawarnapp.exception.reporting.ReportingConstants.ERROR_REPORT_LOCAL_BROADCAST_CHANNEL import de.rki.coronawarnapp.notification.NotificationHelper import org.conscrypt.Conscrypt import java.security.Security @@ -101,7 +101,8 @@ class CoronaWarnApplication : Application(), LifecycleObserver, } override fun onActivityResumed(activity: Activity) { - errorReceiver = ErrorReportReceiver(activity) + errorReceiver = + ErrorReportReceiver(activity) LocalBroadcastManager.getInstance(this) .registerReceiver(errorReceiver, IntentFilter(ERROR_REPORT_LOCAL_BROADCAST_CHANNEL)) } diff --git a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/TestForAPIFragment.kt b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/TestForAPIFragment.kt index d1740c85eb6..3cd4ea57daf 100644 --- a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/TestForAPIFragment.kt +++ b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/TestForAPIFragment.kt @@ -35,7 +35,7 @@ import de.rki.coronawarnapp.databinding.FragmentTestForAPIBinding import de.rki.coronawarnapp.exception.ExceptionCategory import de.rki.coronawarnapp.exception.ExceptionCategory.INTERNAL import de.rki.coronawarnapp.exception.TransactionException -import de.rki.coronawarnapp.exception.report +import de.rki.coronawarnapp.exception.reporting.report import de.rki.coronawarnapp.nearby.InternalExposureNotificationClient import de.rki.coronawarnapp.nearby.InternalExposureNotificationPermissionHelper import de.rki.coronawarnapp.receiver.ExposureStateUpdateReceiver diff --git a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/TestRiskLevelCalculation.kt b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/TestRiskLevelCalculation.kt index 3e288bd87dc..9f492814b0e 100644 --- a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/TestRiskLevelCalculation.kt +++ b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/TestRiskLevelCalculation.kt @@ -19,7 +19,7 @@ import com.google.zxing.integration.android.IntentResult import de.rki.coronawarnapp.databinding.FragmentTestRiskLevelCalculationBinding import de.rki.coronawarnapp.exception.ExceptionCategory import de.rki.coronawarnapp.exception.TransactionException -import de.rki.coronawarnapp.exception.report +import de.rki.coronawarnapp.exception.reporting.report import de.rki.coronawarnapp.nearby.InternalExposureNotificationClient import de.rki.coronawarnapp.risk.RiskLevel import de.rki.coronawarnapp.risk.TimeVariables diff --git a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/exception/ErrorReportReceiver.kt b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/exception/reporting/ErrorReportReceiver.kt similarity index 95% rename from Corona-Warn-App/src/main/java/de/rki/coronawarnapp/exception/ErrorReportReceiver.kt rename to Corona-Warn-App/src/main/java/de/rki/coronawarnapp/exception/reporting/ErrorReportReceiver.kt index 958e8a1dd95..0213635c4cc 100644 --- a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/exception/ErrorReportReceiver.kt +++ b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/exception/reporting/ErrorReportReceiver.kt @@ -1,4 +1,4 @@ -package de.rki.coronawarnapp.exception +package de.rki.coronawarnapp.exception.reporting import android.app.Activity import android.content.BroadcastReceiver @@ -7,6 +7,7 @@ import android.content.Intent import android.util.Log import de.rki.coronawarnapp.CoronaWarnApplication import de.rki.coronawarnapp.R +import de.rki.coronawarnapp.exception.ExceptionCategory import de.rki.coronawarnapp.util.DialogHelper class ErrorReportReceiver(private val activity: Activity) : BroadcastReceiver() { diff --git a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/exception/ExceptionReporter.kt b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/exception/reporting/ExceptionReporter.kt similarity index 93% rename from Corona-Warn-App/src/main/java/de/rki/coronawarnapp/exception/ExceptionReporter.kt rename to Corona-Warn-App/src/main/java/de/rki/coronawarnapp/exception/reporting/ExceptionReporter.kt index 3c58048be14..feaa6711f16 100644 --- a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/exception/ExceptionReporter.kt +++ b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/exception/reporting/ExceptionReporter.kt @@ -1,8 +1,9 @@ -package de.rki.coronawarnapp.exception +package de.rki.coronawarnapp.exception.reporting import android.content.Intent import androidx.localbroadcastmanager.content.LocalBroadcastManager import de.rki.coronawarnapp.CoronaWarnApplication +import de.rki.coronawarnapp.exception.ExceptionCategory import java.io.PrintWriter import java.io.StringWriter diff --git a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/exception/ReportingConstants.kt b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/exception/reporting/ReportingConstants.kt similarity index 87% rename from Corona-Warn-App/src/main/java/de/rki/coronawarnapp/exception/ReportingConstants.kt rename to Corona-Warn-App/src/main/java/de/rki/coronawarnapp/exception/reporting/ReportingConstants.kt index 22f1c2393c8..d3eb21a2eb9 100644 --- a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/exception/ReportingConstants.kt +++ b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/exception/reporting/ReportingConstants.kt @@ -1,4 +1,4 @@ -package de.rki.coronawarnapp.exception +package de.rki.coronawarnapp.exception.reporting object ReportingConstants { const val ERROR_REPORT_LOCAL_BROADCAST_CHANNEL = "error-report" diff --git a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/nearby/ExposureStateUpdateWorker.kt b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/nearby/ExposureStateUpdateWorker.kt index bc97b2c7a0f..bf0fb12d918 100644 --- a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/nearby/ExposureStateUpdateWorker.kt +++ b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/nearby/ExposureStateUpdateWorker.kt @@ -9,7 +9,7 @@ import com.google.android.gms.nearby.exposurenotification.ExposureNotificationCl import de.rki.coronawarnapp.exception.ExceptionCategory import de.rki.coronawarnapp.exception.NoTokenException import de.rki.coronawarnapp.exception.TransactionException -import de.rki.coronawarnapp.exception.report +import de.rki.coronawarnapp.exception.reporting.report import de.rki.coronawarnapp.storage.ExposureSummaryRepository import de.rki.coronawarnapp.transaction.RiskLevelTransaction diff --git a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/nearby/InternalExposureNotificationPermissionHelper.kt b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/nearby/InternalExposureNotificationPermissionHelper.kt index 61c56fa645b..7ee79021a3a 100644 --- a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/nearby/InternalExposureNotificationPermissionHelper.kt +++ b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/nearby/InternalExposureNotificationPermissionHelper.kt @@ -9,7 +9,7 @@ import com.google.android.gms.nearby.exposurenotification.ExposureNotificationSt import com.google.android.gms.nearby.exposurenotification.TemporaryExposureKey import de.rki.coronawarnapp.exception.ENPermissionException import de.rki.coronawarnapp.exception.ExceptionCategory -import de.rki.coronawarnapp.exception.report +import de.rki.coronawarnapp.exception.reporting.report import kotlinx.coroutines.launch /** diff --git a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/receiver/ExposureStateUpdateReceiver.kt b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/receiver/ExposureStateUpdateReceiver.kt index 9a28ffa7b51..65f13604d17 100644 --- a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/receiver/ExposureStateUpdateReceiver.kt +++ b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/receiver/ExposureStateUpdateReceiver.kt @@ -10,7 +10,7 @@ import com.google.android.gms.nearby.exposurenotification.ExposureNotificationCl import de.rki.coronawarnapp.exception.ExceptionCategory.INTERNAL import de.rki.coronawarnapp.exception.NoTokenException import de.rki.coronawarnapp.exception.WrongReceiverException -import de.rki.coronawarnapp.exception.report +import de.rki.coronawarnapp.exception.reporting.report import de.rki.coronawarnapp.nearby.ExposureStateUpdateWorker /** diff --git a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/risk/TimeVariables.kt b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/risk/TimeVariables.kt index 5a6537cc950..6f687165077 100644 --- a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/risk/TimeVariables.kt +++ b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/risk/TimeVariables.kt @@ -3,7 +3,7 @@ package de.rki.coronawarnapp.risk import com.google.android.gms.common.api.ApiException import de.rki.coronawarnapp.CoronaWarnApplication import de.rki.coronawarnapp.exception.ExceptionCategory -import de.rki.coronawarnapp.exception.report +import de.rki.coronawarnapp.exception.reporting.report import de.rki.coronawarnapp.nearby.InternalExposureNotificationClient import de.rki.coronawarnapp.storage.LocalData import de.rki.coronawarnapp.storage.tracing.TracingIntervalRepository diff --git a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/sharing/ExposureSharingService.kt b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/sharing/ExposureSharingService.kt index 12711ab2c7d..b70a41978ce 100644 --- a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/sharing/ExposureSharingService.kt +++ b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/sharing/ExposureSharingService.kt @@ -10,7 +10,7 @@ import com.google.zxing.BarcodeFormat import com.google.zxing.qrcode.QRCodeWriter import de.rki.coronawarnapp.exception.ExceptionCategory.EXPOSURENOTIFICATION import de.rki.coronawarnapp.exception.ExceptionCategory.INTERNAL -import de.rki.coronawarnapp.exception.report +import de.rki.coronawarnapp.exception.reporting.report import de.rki.coronawarnapp.nearby.InternalExposureNotificationClient import de.rki.coronawarnapp.server.protocols.AppleLegacyKeyExchange diff --git a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/storage/TracingRepository.kt b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/storage/TracingRepository.kt index cb84c5cc157..3beb1fb40b6 100644 --- a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/storage/TracingRepository.kt +++ b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/storage/TracingRepository.kt @@ -4,7 +4,7 @@ import android.widget.Toast import androidx.lifecycle.MutableLiveData import de.rki.coronawarnapp.CoronaWarnApplication import de.rki.coronawarnapp.exception.ExceptionCategory -import de.rki.coronawarnapp.exception.report +import de.rki.coronawarnapp.exception.reporting.report import de.rki.coronawarnapp.nearby.InternalExposureNotificationClient import de.rki.coronawarnapp.risk.TimeVariables.getActiveTracingDaysInRetentionPeriod import de.rki.coronawarnapp.transaction.RetrieveDiagnosisKeysTransaction diff --git a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/settings/SettingsResetFragment.kt b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/settings/SettingsResetFragment.kt index 6fb673f152f..4e8397913ec 100644 --- a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/settings/SettingsResetFragment.kt +++ b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/settings/SettingsResetFragment.kt @@ -10,7 +10,7 @@ import androidx.lifecycle.lifecycleScope import com.google.android.gms.common.api.ApiException import de.rki.coronawarnapp.databinding.FragmentSettingsResetBinding import de.rki.coronawarnapp.exception.ExceptionCategory -import de.rki.coronawarnapp.exception.report +import de.rki.coronawarnapp.exception.reporting.report import de.rki.coronawarnapp.nearby.InternalExposureNotificationClient import de.rki.coronawarnapp.ui.BaseFragment import de.rki.coronawarnapp.ui.main.MainActivity diff --git a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/settings/SettingsTracingFragment.kt b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/settings/SettingsTracingFragment.kt index 382d34f0557..bde273bd129 100644 --- a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/settings/SettingsTracingFragment.kt +++ b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/settings/SettingsTracingFragment.kt @@ -10,7 +10,7 @@ import androidx.fragment.app.activityViewModels import androidx.lifecycle.lifecycleScope import de.rki.coronawarnapp.databinding.FragmentSettingsTracingBinding import de.rki.coronawarnapp.exception.ExceptionCategory -import de.rki.coronawarnapp.exception.report +import de.rki.coronawarnapp.exception.reporting.report import de.rki.coronawarnapp.nearby.InternalExposureNotificationClient import de.rki.coronawarnapp.nearby.InternalExposureNotificationPermissionHelper import de.rki.coronawarnapp.ui.BaseFragment diff --git a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/viewmodel/SubmissionViewModel.kt b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/viewmodel/SubmissionViewModel.kt index 60ab8b5cdc4..60376083e32 100644 --- a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/viewmodel/SubmissionViewModel.kt +++ b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/viewmodel/SubmissionViewModel.kt @@ -6,7 +6,7 @@ import androidx.lifecycle.ViewModel import androidx.lifecycle.viewModelScope import de.rki.coronawarnapp.exception.ExceptionCategory import de.rki.coronawarnapp.exception.http.CwaWebException -import de.rki.coronawarnapp.exception.report +import de.rki.coronawarnapp.exception.reporting.report import de.rki.coronawarnapp.service.submission.SubmissionService import de.rki.coronawarnapp.storage.LocalData import de.rki.coronawarnapp.storage.SubmissionRepository diff --git a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/viewmodel/TracingViewModel.kt b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/viewmodel/TracingViewModel.kt index ad8a5d362fc..4bccd807c69 100644 --- a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/viewmodel/TracingViewModel.kt +++ b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/viewmodel/TracingViewModel.kt @@ -6,7 +6,7 @@ import androidx.lifecycle.ViewModel import androidx.lifecycle.viewModelScope import de.rki.coronawarnapp.exception.ExceptionCategory.INTERNAL import de.rki.coronawarnapp.exception.TransactionException -import de.rki.coronawarnapp.exception.report +import de.rki.coronawarnapp.exception.reporting.report import de.rki.coronawarnapp.storage.ExposureSummaryRepository import de.rki.coronawarnapp.storage.RiskLevelRepository import de.rki.coronawarnapp.storage.TracingRepository diff --git a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/util/ConnectivityHelper.kt b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/util/ConnectivityHelper.kt index 7cd591d3bbe..aba5ccaa6a5 100644 --- a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/util/ConnectivityHelper.kt +++ b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/util/ConnectivityHelper.kt @@ -13,7 +13,7 @@ import android.net.NetworkRequest import android.os.Build import android.util.Log import de.rki.coronawarnapp.exception.ExceptionCategory -import de.rki.coronawarnapp.exception.report +import de.rki.coronawarnapp.exception.reporting.report /** * Helper for connectivity statuses. From cd22103d0da52a1ef7ce31db2ea8b7d122761a5d Mon Sep 17 00:00:00 2001 From: Thomas Kowark Date: Sun, 7 Jun 2020 15:48:59 +0200 Subject: [PATCH 03/16] Sonar setup (#191) * Setup Sonar Signed-off-by: d067928 * Revert "Setup Sonar" This reverts commit 92ac0411 Signed-off-by: d067928 * Revert "Setup Sonar" This reverts commit 92ac0411 Signed-off-by: d067928 * Sonar Signed-off-by: d067928 * Sonar Signed-off-by: d067928 * Sonar Signed-off-by: d067928 * Updated properties * Fixed jacoco report path and running jacoco * Generating Coverage * jacoco report fix * Enabling coverage * Adding jacoco dependencies * Removing Coverage Enabled Types * Removing Sonar for now * Plugin Test * Re-activating Sonar * fixing jacoco property * fix jacoco xml path * Dummy Code to test * minimal config * back to full configuration * right binaries folder? * sources and binaries * First scan, then save * bumping jacoco version * fixed detekt path * reverting intentional error * exclusions Signed-off-by: d067928 * exclusions Signed-off-by: d067928 * exclusions Signed-off-by: d067928 * exclusions Signed-off-by: d067928 * add protobuf compiled ignore Signed-off-by: d067928 * only scan kotlin files in src/main/java Co-authored-by: d067928 Co-authored-by: harambasicluka <64483219+harambasicluka@users.noreply.github.com> --- .circleci/config.yml | 12 +++++++++++- Corona-Warn-App/build.gradle | 9 +-------- build.gradle | 10 +++++++--- sonar-project.properties | 10 ++++++++++ 4 files changed, 29 insertions(+), 12 deletions(-) create mode 100644 sonar-project.properties diff --git a/.circleci/config.yml b/.circleci/config.yml index da41853c01b..ed0062ff57d 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,10 +1,12 @@ version: 2.1 orbs: android: circleci/android@0.2.1 + sonarcloud: sonarsource/sonarcloud@1.0.1 commands: install-ndk: android/install-ndk restore-build-cache: android/restore-build-cache save-build-cache: android/save-build-cache + scan-sonar: sonarcloud/scan jobs: quickBuildReleaseWithTestsAndChecks: executor: android/android @@ -22,6 +24,13 @@ jobs: environment: JVM_OPTS: -Xmx2048m GRADLE_OPTS: -Xmx1536m -XX:+HeapDumpOnOutOfMemoryError -Dorg.gradle.caching=true -Dorg.gradle.configureondemand=true -Dkotlin.compiler.execution.strategy=in-process -Dkotlin.incremental=false + - run: + name: JaCoCo report + command: ./gradlew :Corona-Warn-App:jacocoTestReportDeviceRelease + environment: + JVM_OPTS: -Xmx2048m + GRADLE_OPTS: -Xmx1536m -XX:+HeapDumpOnOutOfMemoryError -Dorg.gradle.caching=true -Dorg.gradle.configureondemand=true -Dkotlin.compiler.execution.strategy=in-process -Dkotlin.incremental=false + - scan-sonar - save-build-cache - save_cache: paths: @@ -36,4 +45,5 @@ workflows: version: 2 workflow: jobs: - - quickBuildReleaseWithTestsAndChecks + - quickBuildReleaseWithTestsAndChecks: + context: SonarCloud diff --git a/Corona-Warn-App/build.gradle b/Corona-Warn-App/build.gradle index 8d2b3aa6ad8..e05944cad29 100644 --- a/Corona-Warn-App/build.gradle +++ b/Corona-Warn-App/build.gradle @@ -22,7 +22,6 @@ apply plugin: 'kotlin-android' apply plugin: 'kotlin-android-extensions' apply plugin: 'kotlin-kapt' apply plugin: "androidx.navigation.safeargs.kotlin" -apply plugin: 'jacoco' android { ndkVersion "21.2.6472646" @@ -78,6 +77,7 @@ android { minifyEnabled true shrinkResources true proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' + testCoverageEnabled true buildConfigField "String", "EXPORT_SIGNATURE_ID", "\"de.rki.coronawarnapp-dev\"" } } @@ -141,13 +141,6 @@ android { } -task jacocoTestReport(type: JacocoReport, dependsOn: ['testDeviceReleaseUnitTest']) { - reports { - xml.enabled = true - html.enabled = true - } -} - dependencies { // KOTLIN implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.7" diff --git a/build.gradle b/build.gradle index 6dc65247a4a..6c962032830 100644 --- a/build.gradle +++ b/build.gradle @@ -19,6 +19,7 @@ buildscript { classpath "androidx.navigation:navigation-safe-args-gradle-plugin:$navVersion" classpath "org.jlleitschuh.gradle:ktlint-gradle:9.2.1" classpath "io.gitlab.arturbosch.detekt:detekt-gradle-plugin:1.9.1" + classpath "com.vanniktech:gradle-android-junit-jacoco-plugin:0.16.0" // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files @@ -28,6 +29,7 @@ buildscript { subprojects { apply plugin: "io.gitlab.arturbosch.detekt" apply plugin: "org.jlleitschuh.gradle.ktlint" + apply plugin: "com.vanniktech.android.junit.jacoco" detekt { debug = true @@ -49,6 +51,10 @@ subprojects { ignoreFailures = false coloredOutput = false } + + junitJacoco { + jacocoVersion = '0.8.5' + } } allprojects { @@ -56,7 +62,7 @@ allprojects { google() jcenter() // mavenLocal() - + } } @@ -85,5 +91,3 @@ task quickBuildWithFixes { dependsOn ':Corona-Warn-App:ktlintDeviceReleaseCheck' dependsOn ':Corona-Warn-App:detekt' } - - diff --git a/sonar-project.properties b/sonar-project.properties new file mode 100644 index 00000000000..fe5174b0ff3 --- /dev/null +++ b/sonar-project.properties @@ -0,0 +1,10 @@ +sonar.projectKey=corona-warn-app_cwa-app-android +sonar.organization=corona-warn-app +sonar.host.url=https://sonarcloud.io +sonar.coverage.jacoco.xmlReportPaths=Corona-Warn-App/build/reports/jacoco/deviceRelease/jacoco.xml +sonar.sources=Corona-Warn-App/src/main/java/ +sonar.inclusions=**/*.kt +sonar.java.binaries=Corona-Warn-App/build/tmp/kotlin-classes +sonar.java.libraries=Corona-Warn-App/libs +sonar.kotlin.file.suffixes=.kt +sonar.kotlin.detekt.reportPaths=Corona-Warn-App/build/reports/detekt/detekt.xml From 6c118de41fd4de6bb85fa97bf670af9b07ceaaf2 Mon Sep 17 00:00:00 2001 From: harambasicluka <64483219+harambasicluka@users.noreply.github.com> Date: Sun, 7 Jun 2020 16:21:11 +0200 Subject: [PATCH 04/16] Feature: Toolbar (#254) * replaced custom header with toolbar * removed fadingScrollView * toolbar * excluded translation from lint for dev * main header * fixed id * icon fix * added navigation to risk details --- .../information/InformationAboutFragment.kt | 2 +- .../information/InformationContactFragment.kt | 2 +- .../ui/information/InformationFragment.kt | 2 +- .../information/InformationLegalFragment.kt | 2 +- .../information/InformationPrivacyFragment.kt | 2 +- .../InformationTechnicalFragment.kt | 2 +- .../information/InformationTermsFragment.kt | 2 +- .../ui/main/MainOverviewFragment.kt | 2 +- .../ui/main/MainShareFragment.kt | 2 +- .../ui/riskdetails/RiskDetailsFragment.kt | 2 +- .../ui/settings/SettingsFragment.kt | 2 +- .../settings/SettingsNotificationFragment.kt | 2 +- .../ui/settings/SettingsResetFragment.kt | 2 +- .../ui/settings/SettingsTracingFragment.kt | 2 +- .../submission/SubmissionContactFragment.kt | 2 +- .../SubmissionDispatcherFragment.kt | 2 +- .../ui/submission/SubmissionDoneFragment.kt | 2 +- .../ui/submission/SubmissionIntroFragment.kt | 2 +- ...ssionResultPositiveOtherWarningFragment.kt | 2 +- .../ui/submission/SubmissionTanFragment.kt | 2 +- .../SubmissionTestResultFragment.kt | 2 +- .../util/formatter/FormatterRiskHelper.kt | 8 +-- .../src/main/res/drawable/ic_close_dark.xml | 12 ++++ .../src/main/res/drawable/ic_close_light.xml | 12 ++++ .../main/res/layout/fragment_information.xml | 1 - .../res/layout/fragment_information_about.xml | 1 - .../layout/fragment_information_contact.xml | 1 - .../res/layout/fragment_information_legal.xml | 1 - .../layout/fragment_information_privacy.xml | 1 - .../layout/fragment_information_technical.xml | 1 - .../res/layout/fragment_information_terms.xml | 1 - .../src/main/res/layout/fragment_main.xml | 37 +++++------ .../res/layout/fragment_main_overview.xml | 1 - .../main/res/layout/fragment_main_share.xml | 1 - .../main/res/layout/fragment_risk_details.xml | 26 +++++++- .../src/main/res/layout/fragment_settings.xml | 1 - .../fragment_settings_notifications.xml | 1 - .../res/layout/fragment_settings_reset.xml | 1 - .../res/layout/fragment_settings_tracing.xml | 1 - .../src/main/res/layout/include_header.xml | 64 ++++++------------- .../main/res/layout/include_onboarding.xml | 1 - .../src/main/res/layout/include_risk_card.xml | 28 ++++---- .../res/layout/include_risk_card_header.xml | 27 +------- .../res/layout/include_submission_contact.xml | 1 - .../res/layout/include_submission_intro.xml | 1 - ...lude_submission_positive_other_warning.xml | 1 - .../layout/include_submission_test_result.xml | 1 - .../src/main/res/values/dimens.xml | 6 +- .../src/main/res/values/strings.xml | 2 + .../src/main/res/values/styles.xml | 8 +-- 50 files changed, 133 insertions(+), 157 deletions(-) create mode 100644 Corona-Warn-App/src/main/res/drawable/ic_close_dark.xml create mode 100644 Corona-Warn-App/src/main/res/drawable/ic_close_light.xml diff --git a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/information/InformationAboutFragment.kt b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/information/InformationAboutFragment.kt index 95a4182275b..4fb3f4ea0a4 100644 --- a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/information/InformationAboutFragment.kt +++ b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/information/InformationAboutFragment.kt @@ -39,7 +39,7 @@ class InformationAboutFragment : BaseFragment() { } private fun setButtonOnClickListener() { - binding.informationAboutHeader.headerButtonBack.buttonIcon.setOnClickListener { + binding.informationAboutHeader.headerToolbar.setNavigationOnClickListener { (activity as MainActivity).goBack() } } diff --git a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/information/InformationContactFragment.kt b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/information/InformationContactFragment.kt index 88f37c5fd8b..595fb2df009 100644 --- a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/information/InformationContactFragment.kt +++ b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/information/InformationContactFragment.kt @@ -41,7 +41,7 @@ class InformationContactFragment : BaseFragment() { } private fun setButtonOnClickListener() { - binding.informationContactHeader.headerButtonBack.buttonIcon.setOnClickListener { + binding.informationContactHeader.headerToolbar.setNavigationOnClickListener { (activity as MainActivity).goBack() } binding.informationContactNavigationRowPhone.navigationRow.setOnClickListener { diff --git a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/information/InformationFragment.kt b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/information/InformationFragment.kt index 80e7e541cd5..8e44bce61ff 100644 --- a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/information/InformationFragment.kt +++ b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/information/InformationFragment.kt @@ -74,7 +74,7 @@ class InformationFragment : BaseFragment() { InformationFragmentDirections.actionInformationFragmentToInformationTechnicalFragment() ) } - binding.informationHeader.headerButtonBack.buttonIcon.setOnClickListener { + binding.informationHeader.headerToolbar.setNavigationOnClickListener { (activity as MainActivity).goBack() } } diff --git a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/information/InformationLegalFragment.kt b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/information/InformationLegalFragment.kt index 16abadd8c53..298e5275cdb 100644 --- a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/information/InformationLegalFragment.kt +++ b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/information/InformationLegalFragment.kt @@ -39,7 +39,7 @@ class InformationLegalFragment : BaseFragment() { } private fun setButtonOnClickListener() { - binding.informationLegalHeader.headerButtonBack.buttonIcon.setOnClickListener { + binding.informationLegalHeader.headerToolbar.setNavigationOnClickListener { (activity as MainActivity).goBack() } } diff --git a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/information/InformationPrivacyFragment.kt b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/information/InformationPrivacyFragment.kt index b3ab39e4cc4..75e3d748329 100644 --- a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/information/InformationPrivacyFragment.kt +++ b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/information/InformationPrivacyFragment.kt @@ -39,7 +39,7 @@ class InformationPrivacyFragment : BaseFragment() { } private fun setButtonOnClickListener() { - binding.informationPrivacyHeader.headerButtonBack.buttonIcon.setOnClickListener { + binding.informationPrivacyHeader.headerToolbar.setNavigationOnClickListener { (activity as MainActivity).goBack() } } diff --git a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/information/InformationTechnicalFragment.kt b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/information/InformationTechnicalFragment.kt index 9ce43c29ff7..d28274e6a15 100644 --- a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/information/InformationTechnicalFragment.kt +++ b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/information/InformationTechnicalFragment.kt @@ -39,7 +39,7 @@ class InformationTechnicalFragment : BaseFragment() { } private fun setButtonOnClickListener() { - binding.informationTechnicalHeader.headerButtonBack.buttonIcon.setOnClickListener { + binding.informationTechnicalHeader.headerToolbar.setNavigationOnClickListener { (activity as MainActivity).goBack() } } diff --git a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/information/InformationTermsFragment.kt b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/information/InformationTermsFragment.kt index 8189f124017..1a96747418f 100644 --- a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/information/InformationTermsFragment.kt +++ b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/information/InformationTermsFragment.kt @@ -39,7 +39,7 @@ class InformationTermsFragment : BaseFragment() { } private fun setButtonOnClickListener() { - binding.informationTermsHeader.headerButtonBack.buttonIcon.setOnClickListener { + binding.informationTermsHeader.headerToolbar.setNavigationOnClickListener { (activity as MainActivity).goBack() } } diff --git a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/main/MainOverviewFragment.kt b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/main/MainOverviewFragment.kt index 40502e58607..28b9c00ba30 100644 --- a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/main/MainOverviewFragment.kt +++ b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/main/MainOverviewFragment.kt @@ -43,7 +43,7 @@ class MainOverviewFragment : BaseFragment() { } private fun setButtonOnClickListener() { - binding.mainOverviewHeader.headerButtonBack.buttonIcon.setOnClickListener { + binding.mainOverviewHeader.headerToolbar.setNavigationOnClickListener { (activity as MainActivity).goBack() } } diff --git a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/main/MainShareFragment.kt b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/main/MainShareFragment.kt index 8ba1bb2e6fc..d8cad38c46f 100644 --- a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/main/MainShareFragment.kt +++ b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/main/MainShareFragment.kt @@ -51,7 +51,7 @@ class MainShareFragment : BaseFragment() { binding.mainShareButton.setOnClickListener { ShareHelper.shareText(this, getString(R.string.main_share_message), null) } - binding.mainShareHeader.headerButtonBack.buttonIcon.setOnClickListener { + binding.mainShareHeader.headerToolbar.setNavigationOnClickListener { (activity as MainActivity).goBack() } } diff --git a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/riskdetails/RiskDetailsFragment.kt b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/riskdetails/RiskDetailsFragment.kt index 893a95287d2..3c753af5782 100644 --- a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/riskdetails/RiskDetailsFragment.kt +++ b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/riskdetails/RiskDetailsFragment.kt @@ -71,7 +71,7 @@ class RiskDetailsFragment : BaseFragment() { RiskDetailsFragmentDirections.actionRiskDetailsFragmentToSettingsTracingFragment() ) } - binding.riskDetailsRiskCard.riskCardHeader.riskCardHeaderButtonBack.setOnClickListener { + binding.riskDetailsToolbar.setNavigationOnClickListener { (activity as MainActivity).goBack() } } diff --git a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/settings/SettingsFragment.kt b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/settings/SettingsFragment.kt index f7aab9c197b..4f5c8b56026 100644 --- a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/settings/SettingsFragment.kt +++ b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/settings/SettingsFragment.kt @@ -63,7 +63,7 @@ class SettingsFragment : BaseFragment() { val tracingRow = binding.settingsTracing.settingsRow val notificationRow = binding.settingsNotifications.settingsRow val resetRow = binding.settingsReset - val goBack = binding.settingsHeader.headerButtonBack.buttonIcon + val goBack = binding.settingsHeader.headerToolbar resetRow.setOnClickListener { doNavigate( SettingsFragmentDirections.actionSettingsFragmentToSettingsResetFragment() diff --git a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/settings/SettingsNotificationFragment.kt b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/settings/SettingsNotificationFragment.kt index 2344f700960..862b943ef08 100644 --- a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/settings/SettingsNotificationFragment.kt +++ b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/settings/SettingsNotificationFragment.kt @@ -68,7 +68,7 @@ class SettingsNotificationFragment : Fragment() { // Settings val settingsRow = binding.settingsNavigationRowSystem.navigationRow val goBack = - binding.settingsNotificationsHeader.headerButtonBack.buttonIcon + binding.settingsNotificationsHeader.headerToolbar // Update Risk updateRiskNotificationSwitch.setOnCheckedChangeListener { _, _ -> // android calls this listener also on start, so it has to be verified if the user pressed the switch diff --git a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/settings/SettingsResetFragment.kt b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/settings/SettingsResetFragment.kt index 4e8397913ec..13e05292e8c 100644 --- a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/settings/SettingsResetFragment.kt +++ b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/settings/SettingsResetFragment.kt @@ -55,7 +55,7 @@ class SettingsResetFragment : BaseFragment() { binding.settingsResetButtonCancel.setOnClickListener { (activity as MainActivity).goBack() } - binding.settingsResetHeader.headerButtonBack.buttonIcon.setOnClickListener { + binding.settingsResetHeader.headerToolbar.setNavigationOnClickListener { (activity as MainActivity).goBack() } } diff --git a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/settings/SettingsTracingFragment.kt b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/settings/SettingsTracingFragment.kt index bde273bd129..0eb9d83e999 100644 --- a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/settings/SettingsTracingFragment.kt +++ b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/settings/SettingsTracingFragment.kt @@ -108,7 +108,7 @@ class SettingsTracingFragment : BaseFragment(), } } } - binding.settingsTracingHeader.headerButtonBack.buttonIcon.setOnClickListener { + binding.settingsTracingHeader.headerToolbar.setNavigationOnClickListener { (activity as MainActivity).goBack() } binding.settingsTracingStatusBluetooth.tracingStatusCardButton.setOnClickListener { diff --git a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/submission/SubmissionContactFragment.kt b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/submission/SubmissionContactFragment.kt index 0d1693898f5..27886c7020f 100644 --- a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/submission/SubmissionContactFragment.kt +++ b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/submission/SubmissionContactFragment.kt @@ -39,7 +39,7 @@ class SubmissionContactFragment : BaseFragment() { } private fun setButtonOnClickListener() { - binding.submissionContactHeader.headerButtonBack.buttonIcon.setOnClickListener { + binding.submissionContactHeader.headerToolbar.setNavigationOnClickListener { (activity as MainActivity).goBack() } binding.submissionContactButtonCall.setOnClickListener { diff --git a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/submission/SubmissionDispatcherFragment.kt b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/submission/SubmissionDispatcherFragment.kt index 4178eea3bd4..73bf2aa3534 100644 --- a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/submission/SubmissionDispatcherFragment.kt +++ b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/submission/SubmissionDispatcherFragment.kt @@ -40,7 +40,7 @@ class SubmissionDispatcherFragment : BaseFragment() { } private fun setButtonOnClickListener() { - binding.submissionDispatcherHeader.headerButtonBack.buttonIcon.setOnClickListener { + binding.submissionDispatcherHeader.headerToolbar.setNavigationOnClickListener { (activity as MainActivity).goBack() } binding.submissionDispatcherQr.dispatcherCard.setOnClickListener { diff --git a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/submission/SubmissionDoneFragment.kt b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/submission/SubmissionDoneFragment.kt index 330c86d79ff..60c9300d935 100644 --- a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/submission/SubmissionDoneFragment.kt +++ b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/submission/SubmissionDoneFragment.kt @@ -36,7 +36,7 @@ class SubmissionDoneFragment : BaseFragment() { } private fun setButtonOnClickListener() { - binding.submissionDoneHeader.headerButtonBack.buttonIcon.setOnClickListener { + binding.submissionDoneHeader.headerToolbar.setNavigationOnClickListener { doNavigate( SubmissionDoneFragmentDirections.actionSubmissionDoneFragmentToMainFragment() ) diff --git a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/submission/SubmissionIntroFragment.kt b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/submission/SubmissionIntroFragment.kt index 219457cb2e0..0dc26e99bb9 100644 --- a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/submission/SubmissionIntroFragment.kt +++ b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/submission/SubmissionIntroFragment.kt @@ -36,7 +36,7 @@ class SubmissionIntroFragment : BaseFragment() { } private fun setButtonOnClickListener() { - binding.submissionIntroHeader.headerButtonBack.buttonIcon.setOnClickListener { + binding.submissionIntroHeader.headerToolbar.setNavigationOnClickListener { doNavigate(SubmissionIntroFragmentDirections.actionSubmissionIntroFragmentToMainFragment()) } binding.submissionIntroButtonNext.setOnClickListener { diff --git a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/submission/SubmissionResultPositiveOtherWarningFragment.kt b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/submission/SubmissionResultPositiveOtherWarningFragment.kt index 02872234709..401edf1528a 100644 --- a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/submission/SubmissionResultPositiveOtherWarningFragment.kt +++ b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/submission/SubmissionResultPositiveOtherWarningFragment.kt @@ -148,7 +148,7 @@ class SubmissionResultPositiveOtherWarningFragment : BaseFragment(), binding.submissionPositiveOtherWarningButtonNext.setOnClickListener { initiateWarningOthers() } - binding.submissionPositiveOtherWarningHeader.headerButtonBack.buttonIcon.setOnClickListener { + binding.submissionPositiveOtherWarningHeader.headerToolbar.setNavigationOnClickListener { navigateToSubmissionResultFragment() } } diff --git a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/submission/SubmissionTanFragment.kt b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/submission/SubmissionTanFragment.kt index 62877109447..7a6036caaff 100644 --- a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/submission/SubmissionTanFragment.kt +++ b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/submission/SubmissionTanFragment.kt @@ -95,7 +95,7 @@ class SubmissionTanFragment : BaseFragment() { binding.submissionTanInput.listener = { tan -> viewModel.tan.value = tan } binding.submissionTanButtonEnter.setOnClickListener { storeTanAndContinue() } - binding.submissionTanHeader.headerButtonBack.buttonIcon.setOnClickListener { navigateToDispatchScreen() } + binding.submissionTanHeader.headerToolbar.setNavigationOnClickListener { navigateToDispatchScreen() } submissionViewModel.registrationState.observeEvent(viewLifecycleOwner, { if (ApiRequestState.SUCCESS == it) { diff --git a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/submission/SubmissionTestResultFragment.kt b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/submission/SubmissionTestResultFragment.kt index 3037b5b61e0..ca4d2d67f31 100644 --- a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/submission/SubmissionTestResultFragment.kt +++ b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/submission/SubmissionTestResultFragment.kt @@ -134,7 +134,7 @@ class SubmissionTestResultFragment : BaseFragment() { ) } - binding.submissionTestResultHeader.headerButtonBack.buttonIcon.setOnClickListener { + binding.submissionTestResultHeader.headerToolbar.setNavigationOnClickListener { doNavigate( SubmissionTestResultFragmentDirections.actionSubmissionResultFragmentToMainFragment() ) diff --git a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/util/formatter/FormatterRiskHelper.kt b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/util/formatter/FormatterRiskHelper.kt index 743c2af9459..9b0914336fa 100644 --- a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/util/formatter/FormatterRiskHelper.kt +++ b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/util/formatter/FormatterRiskHelper.kt @@ -352,12 +352,12 @@ fun formatStableIconColor(riskLevelScore: Int?): Int = * @param riskLevelScore * @return */ -fun formatStableBackButtonColor(riskLevelScore: Int?): ColorStateList? { +fun formatStableBackButtonIcon(riskLevelScore: Int?): Drawable? { val appContext = CoronaWarnApplication.getAppContext() - return if (!isTracingOffRiskLevel(riskLevelScore)) { - appContext.getColorStateList(R.color.button_back) + return if (isTracingOffRiskLevel(riskLevelScore)) { + appContext.getDrawable(R.drawable.ic_close_dark) } else { - appContext.getColorStateList(R.color.button_back_stable) + appContext.getDrawable(R.drawable.ic_close_light) } } diff --git a/Corona-Warn-App/src/main/res/drawable/ic_close_dark.xml b/Corona-Warn-App/src/main/res/drawable/ic_close_dark.xml new file mode 100644 index 00000000000..6b3c8307a45 --- /dev/null +++ b/Corona-Warn-App/src/main/res/drawable/ic_close_dark.xml @@ -0,0 +1,12 @@ + + + diff --git a/Corona-Warn-App/src/main/res/drawable/ic_close_light.xml b/Corona-Warn-App/src/main/res/drawable/ic_close_light.xml new file mode 100644 index 00000000000..a0fd695b693 --- /dev/null +++ b/Corona-Warn-App/src/main/res/drawable/ic_close_light.xml @@ -0,0 +1,12 @@ + + + diff --git a/Corona-Warn-App/src/main/res/layout/fragment_information.xml b/Corona-Warn-App/src/main/res/layout/fragment_information.xml index da08ae6e6ea..2d53533aa11 100644 --- a/Corona-Warn-App/src/main/res/layout/fragment_information.xml +++ b/Corona-Warn-App/src/main/res/layout/fragment_information.xml @@ -25,7 +25,6 @@ app:title="@{@string/information_title}" /> + app:layout_constraintTop_toTopOf="parent"> @@ -117,9 +111,9 @@ @@ -128,7 +122,7 @@ layout="@layout/include_risk_card" android:layout_width="@dimen/match_constraint" android:layout_height="wrap_content" - android:layout_marginTop="@dimen/spacing_normal" + android:layout_marginTop="@dimen/spacing_small" android:visibility="@{FormatterSubmissionHelper.formatShowRiskStatusCard(submissionViewModel.deviceUiState)}" app:layout_constraintEnd_toStartOf="@+id/guideline_end" app:layout_constraintStart_toStartOf="@+id/guideline_start" @@ -140,7 +134,7 @@ + app:constraint_referenced_ids="main_test, main_test_done, main_test_positive, main_risk" /> + app:layout_constraintGuide_begin="@dimen/spacing_small" /> + app:layout_constraintGuide_end="@dimen/spacing_small" /> + app:layout_constraintGuide_end="@dimen/spacing_small" /> + app:layout_constraintGuide_begin="@dimen/spacing_small" /> diff --git a/Corona-Warn-App/src/main/res/layout/fragment_main_overview.xml b/Corona-Warn-App/src/main/res/layout/fragment_main_overview.xml index ea311e0253a..7bbf40dd22c 100644 --- a/Corona-Warn-App/src/main/res/layout/fragment_main_overview.xml +++ b/Corona-Warn-App/src/main/res/layout/fragment_main_overview.xml @@ -19,7 +19,6 @@ app:title="@{@string/main_overview_title}" /> + + + + + + + app:layout_constraintTop_toBottomOf="@+id/risk_details_app_bar_layout"> + xmlns:app="http://schemas.android.com/apk/res-auto"> @@ -18,48 +17,27 @@ android:layout_width="match_parent" android:layout_height="wrap_content"> - - - - - - - - - - + app:elevation="0dp" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent"> + + + + + \ No newline at end of file diff --git a/Corona-Warn-App/src/main/res/layout/include_onboarding.xml b/Corona-Warn-App/src/main/res/layout/include_onboarding.xml index 4da20ae8591..065e9dc6c15 100644 --- a/Corona-Warn-App/src/main/res/layout/include_onboarding.xml +++ b/Corona-Warn-App/src/main/res/layout/include_onboarding.xml @@ -33,7 +33,6 @@ diff --git a/Corona-Warn-App/src/main/res/layout/include_risk_card.xml b/Corona-Warn-App/src/main/res/layout/include_risk_card.xml index 4155aa9faab..5eabb51784e 100644 --- a/Corona-Warn-App/src/main/res/layout/include_risk_card.xml +++ b/Corona-Warn-App/src/main/res/layout/include_risk_card.xml @@ -32,7 +32,7 @@ - - - - - - + app:layout_constraintTop_toTopOf="parent" /> diff --git a/Corona-Warn-App/src/main/res/layout/include_submission_intro.xml b/Corona-Warn-App/src/main/res/layout/include_submission_intro.xml index 3b015e2c1de..06ae9ec3392 100644 --- a/Corona-Warn-App/src/main/res/layout/include_submission_intro.xml +++ b/Corona-Warn-App/src/main/res/layout/include_submission_intro.xml @@ -3,7 +3,6 @@ xmlns:app="http://schemas.android.com/apk/res-auto"> diff --git a/Corona-Warn-App/src/main/res/layout/include_submission_positive_other_warning.xml b/Corona-Warn-App/src/main/res/layout/include_submission_positive_other_warning.xml index 9faffe421e6..7e71f6d2a19 100644 --- a/Corona-Warn-App/src/main/res/layout/include_submission_positive_other_warning.xml +++ b/Corona-Warn-App/src/main/res/layout/include_submission_positive_other_warning.xml @@ -3,7 +3,6 @@ xmlns:app="http://schemas.android.com/apk/res-auto"> diff --git a/Corona-Warn-App/src/main/res/layout/include_submission_test_result.xml b/Corona-Warn-App/src/main/res/layout/include_submission_test_result.xml index f28092392ee..b08af9be3c1 100644 --- a/Corona-Warn-App/src/main/res/layout/include_submission_test_result.xml +++ b/Corona-Warn-App/src/main/res/layout/include_submission_test_result.xml @@ -13,7 +13,6 @@ diff --git a/Corona-Warn-App/src/main/res/values/dimens.xml b/Corona-Warn-App/src/main/res/values/dimens.xml index b7a0fb6555c..9bb11cf8391 100644 --- a/Corona-Warn-App/src/main/res/values/dimens.xml +++ b/Corona-Warn-App/src/main/res/values/dimens.xml @@ -3,7 +3,7 @@ 48dp 24dp 16dp - 6dp + 8dp 3dp @@ -19,7 +19,7 @@ 4sp - 50dp + 40dp 10dp @@ -54,7 +54,7 @@ @dimen/spacing_tiny 4dp 20dp - 35dp + 40dp 35dp 35dp 40dp diff --git a/Corona-Warn-App/src/main/res/values/strings.xml b/Corona-Warn-App/src/main/res/values/strings.xml index 229669dc8ba..070c1c2b310 100644 --- a/Corona-Warn-App/src/main/res/values/strings.xml +++ b/Corona-Warn-App/src/main/res/values/strings.xml @@ -290,6 +290,8 @@ Risk Details ###################################### --> + + Ihr Risikostatus Verhalten diff --git a/Corona-Warn-App/src/main/res/values/styles.xml b/Corona-Warn-App/src/main/res/values/styles.xml index 44d3f74ccf1..263640fb389 100644 --- a/Corona-Warn-App/src/main/res/values/styles.xml +++ b/Corona-Warn-App/src/main/res/values/styles.xml @@ -65,10 +65,10 @@ @color/colorTextPrimary1 @drawable/rectangle @color/button_main_tracing - @dimen/button_padding_start_end - @dimen/button_padding_top_bottom - @dimen/button_padding_start_end - @dimen/button_padding_top_bottom + @dimen/spacing_small + @dimen/spacing_tiny + @dimen/spacing_small + @dimen/spacing_tiny + +