diff --git a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/bugreporting/debuglog/ui/upload/DebugLogUploadFragment.kt b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/bugreporting/debuglog/ui/upload/DebugLogUploadFragment.kt index 6aac39aad2378643f4bd87797f38c2fb34e66bb8..af206680ac14c808d620a1227eca3d8d2b5090d9 100644 --- a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/bugreporting/debuglog/ui/upload/DebugLogUploadFragment.kt +++ b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/bugreporting/debuglog/ui/upload/DebugLogUploadFragment.kt @@ -34,7 +34,7 @@ class DebugLogUploadFragment : Fragment(R.layout.bugreporting_debuglog_upload_fr vm.onUploadLog() } - debugLogSharePrivacyInformation.setOnClickListener { + debugLogPrivacyInformation.setOnClickListener { vm.onPrivacyButtonPress() } diff --git a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/util/ui/views/MoreInformationView.kt b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/util/ui/views/MoreInformationView.kt new file mode 100644 index 0000000000000000000000000000000000000000..a36e2c0ba31cd4bc69328077c0aac71246b82ecf --- /dev/null +++ b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/util/ui/views/MoreInformationView.kt @@ -0,0 +1,49 @@ +package de.rki.coronawarnapp.util.ui.views + +import android.content.Context +import android.util.AttributeSet +import android.util.TypedValue +import android.view.LayoutInflater +import androidx.constraintlayout.widget.ConstraintLayout +import androidx.core.content.withStyledAttributes +import androidx.core.view.isVisible +import de.rki.coronawarnapp.R +import de.rki.coronawarnapp.databinding.ViewMoreInformationBinding + +class MoreInformationView @JvmOverloads constructor( + context: Context, + attrs: AttributeSet? = null, + defStyleAttr: Int = 0 +) : ConstraintLayout(context, attrs, defStyleAttr) { + + private val binding: ViewMoreInformationBinding + + init { + LayoutInflater.from(context).inflate(R.layout.view_more_information, this, true) + + val outValue = TypedValue() + getContext().theme.resolveAttribute(android.R.attr.selectableItemBackground, outValue, true) + setBackgroundResource(outValue.resourceId) + binding = ViewMoreInformationBinding.bind(this) + + context.withStyledAttributes(attrs, R.styleable.MoreInformationView) { + + val titleText = getText(R.styleable.MoreInformationView_titleText) ?: "" + val subtitleText = getText(R.styleable.MoreInformationView_subtitleText) ?: "" + val isTopDividerVisible = getBoolean(R.styleable.MoreInformationView_isTopDividerVisible, true) + val isBottomDividerVisible = getBoolean(R.styleable.MoreInformationView_isBottomDividerVisible, true) + + binding.apply { + + topDivider.isVisible = isTopDividerVisible + bottomDivider.isVisible = isBottomDividerVisible + + moreInformationTitle.text = titleText + moreInformationTitle.isVisible = titleText.isNotEmpty() + + moreInformationSubtitle.text = subtitleText + moreInformationSubtitle.isVisible = subtitleText.isNotEmpty() + } + } + } +} diff --git a/Corona-Warn-App/src/main/res/layout/bugreporting_debuglog_fragment.xml b/Corona-Warn-App/src/main/res/layout/bugreporting_debuglog_fragment.xml index dfc9429fea8f718c297e10d12afeae2dbed68eb9..d69123be4662229553f0146c98cefeb6079c9cef 100644 --- a/Corona-Warn-App/src/main/res/layout/bugreporting_debuglog_fragment.xml +++ b/Corona-Warn-App/src/main/res/layout/bugreporting_debuglog_fragment.xml @@ -24,124 +24,65 @@ android:layout_height="0dp" android:layout_marginBottom="12dp" android:clipToPadding="false" - android:paddingBottom="32dp" + android:paddingBottom="8dp" app:layout_constraintBottom_toTopOf="@id/log_control_container" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@id/toolbar"> - <androidx.constraintlayout.widget.ConstraintLayout + <LinearLayout android:layout_width="match_parent" - android:layout_height="0dp"> + android:layout_height="0dp" + android:orientation="vertical"> <TextView android:id="@+id/explanation_section_one" style="@style/body1" - android:layout_width="0dp" + android:layout_width="match_parent" android:layout_height="wrap_content" - android:layout_margin="24dp" - android:padding="16dp" - android:text="@string/debugging_debuglog_intro_explanation_section_one" - app:layout_constraintEnd_toEndOf="parent" - app:layout_constraintStart_toStartOf="parent" - app:layout_constraintTop_toTopOf="parent" /> + android:layout_marginHorizontal="24dp" + android:layout_marginTop="24dp" + android:text="@string/debugging_debuglog_intro_explanation_section_one" /> <TextView android:id="@+id/explanation_section_two" style="@style/body1" - android:layout_width="0dp" + android:layout_width="match_parent" android:layout_height="wrap_content" - android:layout_margin="24dp" - android:text="@string/debugging_debuglog_intro_explanation_section_two" - app:layout_constraintEnd_toEndOf="parent" - app:layout_constraintStart_toStartOf="parent" - app:layout_constraintTop_toBottomOf="@id/explanation_section_one" /> + android:layout_marginHorizontal="24dp" + android:layout_marginTop="16dp" + android:text="@string/debugging_debuglog_intro_explanation_section_two" /> <include android:id="@+id/debug_log_privacy_card" layout="@layout/include_debuglog_privacy_card" - android:layout_width="0dp" + android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginHorizontal="@dimen/guideline_card" - android:layout_marginTop="16dp" - android:focusable="true" - app:layout_constraintEnd_toEndOf="parent" - app:layout_constraintStart_toStartOf="parent" - app:layout_constraintTop_toBottomOf="@id/explanation_section_two" /> + android:layout_marginVertical="24dp" + android:focusable="true" /> - <androidx.constraintlayout.widget.ConstraintLayout + <de.rki.coronawarnapp.util.ui.views.MoreInformationView android:id="@+id/debug_log_history_container" android:layout_width="match_parent" android:layout_height="wrap_content" - android:visibility="gone" - app:layout_constraintEnd_toEndOf="parent" - app:layout_constraintStart_toStartOf="parent" - app:layout_constraintTop_toBottomOf="@id/debug_log_privacy_card"> - - <TextView - android:id="@+id/log_history_title" - style="@style/body1" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:layout_margin="24dp" - android:text="@string/debugging_debuglog_id_history_title" - app:layout_constraintEnd_toEndOf="parent" - app:layout_constraintStart_toStartOf="parent" - app:layout_constraintTop_toTopOf="parent" /> - - <TextView - android:id="@+id/log_history_body" - style="@style/TextAppearance.AppCompat.Caption" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:layout_marginHorizontal="24dp" - android:layout_marginTop="4dp" - android:text="@string/debugging_debuglog_id_history_body" - app:layout_constraintEnd_toEndOf="parent" - app:layout_constraintStart_toStartOf="parent" - app:layout_constraintTop_toBottomOf="@id/log_history_title" /> - - </androidx.constraintlayout.widget.ConstraintLayout> - - <View - android:id="@+id/debug_log_first_divider" - android:layout_width="0dp" - android:layout_height="@dimen/card_divider" android:layout_marginHorizontal="24dp" - android:layout_marginTop="24dp" - android:background="?android:attr/listDivider" - app:layout_constraintEnd_toEndOf="parent" - app:layout_constraintStart_toStartOf="parent" - app:layout_constraintTop_toBottomOf="@id/debug_log_history_container" /> + android:focusable="true" + android:visibility="gone" + app:isBottomDividerVisible="false" + app:subtitleText="@string/debugging_debuglog_id_history_body" + app:titleText="@string/debugging_debuglog_id_history_title" + tools:visibility="visible" /> - <TextView + <de.rki.coronawarnapp.util.ui.views.MoreInformationView android:id="@+id/debug_log_privacy_information" - style="@style/subtitle" - android:layout_width="0dp" + android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginHorizontal="24dp" - android:background="?selectableItemBackground" - android:clickable="true" android:focusable="true" - android:paddingVertical="8dp" - android:text="@string/contact_diary_onboarding_legal_information" - app:layout_constraintEnd_toEndOf="parent" - app:layout_constraintStart_toStartOf="parent" - app:layout_constraintTop_toBottomOf="@id/debug_log_first_divider" - tools:text="@string/contact_diary_onboarding_legal_information" /> - - <View - android:id="@+id/debug_log_second_divider" - android:layout_width="0dp" - android:layout_height="@dimen/card_divider" - android:layout_marginHorizontal="24dp" - android:layout_marginBottom="24dp" - android:background="?android:attr/listDivider" - app:layout_constraintEnd_toEndOf="parent" - app:layout_constraintStart_toStartOf="parent" - app:layout_constraintTop_toBottomOf="@id/debug_log_privacy_information" /> + app:titleText="@string/contact_diary_onboarding_legal_information" /> - </androidx.constraintlayout.widget.ConstraintLayout> + </LinearLayout> </ScrollView> @@ -150,9 +91,10 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@color/colorSurface1" + android:elevation="8dp" android:orientation="vertical" android:paddingStart="24dp" - android:paddingTop="16dp" + android:paddingTop="8dp" android:paddingEnd="24dp" android:paddingBottom="16dp" app:layout_constraintBottom_toBottomOf="parent" @@ -164,27 +106,31 @@ style="@style/headline5" android:layout_width="match_parent" android:layout_height="wrap_content" - android:layout_marginBottom="16dp" + android:layout_marginBottom="8dp" android:accessibilityHeading="true" android:focusable="true" android:text="@string/debugging_debuglog_current_status_title" /> <androidx.constraintlayout.widget.ConstraintLayout android:id="@+id/debug_log_current_status_card" - style="@style/cardTracing" android:layout_width="match_parent" android:layout_height="wrap_content" - android:layout_marginBottom="16dp"> + android:layout_marginBottom="16dp" + android:background="@drawable/card" + android:backgroundTint="@color/colorSurface2" + android:minHeight="64dp"> <ImageView android:id="@+id/debuglog_activity_indicator" android:layout_width="36dp" android:layout_height="36dp" + android:layout_marginVertical="8dp" + android:layout_marginStart="16dp" android:importantForAccessibility="no" android:src="@drawable/ic_debug_log_indicator_deactivated" - app:layout_constraintBottom_toBottomOf="@id/debuglog_status_secondary" + app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintStart_toStartOf="parent" - app:layout_constraintTop_toTopOf="@id/debuglog_status_primary" + app:layout_constraintTop_toTopOf="parent" tools:src="@drawable/ic_debug_log_indicator_deactivated" /> <TextView @@ -193,9 +139,13 @@ android:layout_width="0dp" android:layout_height="wrap_content" android:layout_marginStart="16dp" + android:layout_marginTop="8dp" + android:layout_marginEnd="16dp" + app:layout_constraintBottom_toTopOf="@id/debuglog_status_secondary" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toEndOf="@id/debuglog_activity_indicator" app:layout_constraintTop_toTopOf="parent" + app:layout_constraintVertical_chainStyle="packed" tools:text="@string/debugging_debuglog_status_not_recording" /> <TextView @@ -204,6 +154,9 @@ android:layout_width="0dp" android:layout_height="wrap_content" android:layout_marginStart="16dp" + android:layout_marginEnd="16dp" + android:layout_marginBottom="8dp" + app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toEndOf="@id/debuglog_activity_indicator" app:layout_constraintTop_toBottomOf="@id/debuglog_status_primary" @@ -216,7 +169,7 @@ style="@style/buttonPrimary" android:layout_width="match_parent" android:layout_height="wrap_content" - android:layout_marginBottom="16dp" + android:layout_marginBottom="8dp" android:text="@string/debugging_debuglog_action_share_log" tools:text="@string/debugging_debuglog_action_share_log" /> @@ -225,7 +178,7 @@ style="@style/buttonPrimary" android:layout_width="match_parent" android:layout_height="wrap_content" - android:layout_marginBottom="16dp" + android:layout_marginBottom="8dp" android:text="@string/debugging_debuglog_action_local_log_store" tools:text="@string/debugging_debuglog_action_local_log_store" /> diff --git a/Corona-Warn-App/src/main/res/layout/bugreporting_debuglog_upload_fragment.xml b/Corona-Warn-App/src/main/res/layout/bugreporting_debuglog_upload_fragment.xml index 236c03b46084c06bf16e5abe51d1809b155e74c8..6298fc9a4191e54736eba5c2e72d548ae515e4a5 100644 --- a/Corona-Warn-App/src/main/res/layout/bugreporting_debuglog_upload_fragment.xml +++ b/Corona-Warn-App/src/main/res/layout/bugreporting_debuglog_upload_fragment.xml @@ -1,7 +1,6 @@ <?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:bind="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/content_container" android:layout_width="match_parent" @@ -29,101 +28,53 @@ app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@id/toolbar"> - <androidx.constraintlayout.widget.ConstraintLayout + <LinearLayout android:layout_width="match_parent" - android:layout_height="wrap_content"> + android:layout_height="wrap_content" + android:orientation="vertical"> <TextView android:id="@+id/bugreporting_share_log_body_one" style="@style/subtitle" - android:layout_width="0dp" + android:layout_width="match_parent" android:layout_height="wrap_content" - android:layout_marginTop="@dimen/spacing_normal" + android:layout_marginHorizontal="24dp" + android:layout_marginTop="24dp" android:focusable="true" android:text="@string/debugging_debuglog_share_log_section_one" - app:layout_constraintEnd_toEndOf="@id/guideline_end" - app:layout_constraintStart_toStartOf="@id/guideline_start" - app:layout_constraintTop_toTopOf="parent" tools:text="@string/debugging_debuglog_share_log_section_one" /> <TextView android:id="@+id/bugreporting_share_log_body_two" style="@style/subtitle" - android:layout_width="0dp" + android:layout_width="match_parent" android:layout_height="wrap_content" - android:layout_marginTop="@dimen/spacing_normal" + android:layout_marginHorizontal="24dp" + android:layout_marginTop="16dp" android:focusable="true" android:text="@string/debugging_debuglog_share_log_section_two" - app:layout_constraintEnd_toEndOf="@id/guideline_end" - app:layout_constraintStart_toStartOf="@id/guideline_start" - app:layout_constraintTop_toBottomOf="@id/bugreporting_share_log_body_one" tools:text="@string/debugging_debuglog_share_log_section_two" /> <include android:id="@+id/bugreporting_share_log_privacy_card" layout="@layout/include_debugging_debuglog_share_privacy_card" - android:layout_width="0dp" + android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginHorizontal="@dimen/guideline_card" - android:layout_marginTop="@dimen/spacing_normal" - android:focusable="true" - app:layout_constraintEnd_toEndOf="parent" - app:layout_constraintStart_toStartOf="parent" - app:layout_constraintTop_toBottomOf="@id/bugreporting_share_log_body_two" /> - - <View - android:id="@+id/bugreporting_share_log_first_divider" - android:layout_width="0dp" - android:layout_height="@dimen/card_divider" - android:layout_marginTop="@dimen/spacing_small" - android:background="?android:attr/listDivider" - app:layout_constraintEnd_toStartOf="@id/guideline_end" - app:layout_constraintStart_toStartOf="@id/guideline_start" - app:layout_constraintTop_toBottomOf="@id/bugreporting_share_log_privacy_card" /> + android:layout_marginVertical="24dp" + android:focusable="true" /> - <TextView - android:id="@+id/debug_log_share_privacy_information" - style="@style/subtitle" - android:layout_width="0dp" + <de.rki.coronawarnapp.util.ui.views.MoreInformationView + android:id="@+id/debug_log_privacy_information" + android:layout_marginHorizontal="24dp" + android:layout_width="match_parent" android:layout_height="wrap_content" - android:background="?selectableItemBackground" - android:clickable="true" android:focusable="true" - android:paddingVertical="@dimen/spacing_tiny" - android:text="@string/debugging_debuglog_share_log_privacy_information" - app:layout_constraintEnd_toEndOf="@id/guideline_end" - app:layout_constraintStart_toStartOf="@id/guideline_start" - app:layout_constraintTop_toBottomOf="@id/bugreporting_share_log_first_divider" - tools:text="@string/debugging_debuglog_share_log_privacy_information" /> - - <View - android:id="@+id/bugreporting_share_log_second_divider" - android:layout_width="0dp" - android:layout_height="@dimen/card_divider" - android:background="?android:attr/listDivider" - app:layout_constraintBottom_toBottomOf="parent" - bind:layout_constraintEnd_toStartOf="@id/guideline_end" - bind:layout_constraintStart_toStartOf="@id/guideline_start" - bind:layout_constraintTop_toBottomOf="@id/debug_log_share_privacy_information" /> + app:titleText="@string/debugging_debuglog_share_log_privacy_information" /> - <androidx.constraintlayout.widget.Guideline - android:id="@+id/guideline_start" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:orientation="vertical" - app:layout_constraintGuide_begin="@dimen/guideline_start" /> - - <androidx.constraintlayout.widget.Guideline - android:id="@+id/guideline_end" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:orientation="vertical" - app:layout_constraintGuide_end="@dimen/guideline_end" /> - - </androidx.constraintlayout.widget.ConstraintLayout> + </LinearLayout> </ScrollView> - <android.widget.Button android:id="@+id/upload_action" style="@style/buttonPrimary" diff --git a/Corona-Warn-App/src/main/res/layout/view_more_information.xml b/Corona-Warn-App/src/main/res/layout/view_more_information.xml new file mode 100644 index 0000000000000000000000000000000000000000..f5248050c17666091569256a668cbd4c53f03eea --- /dev/null +++ b/Corona-Warn-App/src/main/res/layout/view_more_information.xml @@ -0,0 +1,55 @@ +<?xml version="1.0" encoding="utf-8"?> +<merge 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" + tools:layout_width="match_parent" + tools:layout_height="wrap_content" + tools:parentTag="androidx.constraintlayout.widget.ConstraintLayout"> + + <View + android:id="@+id/top_divider" + android:layout_width="match_parent" + android:layout_height="@dimen/card_divider" + android:background="@color/colorHairline" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" /> + + <TextView + android:id="@+id/more_information_title" + style="@style/subtitle" + android:layout_width="0dp" + android:layout_height="wrap_content" + android:layout_marginTop="16dp" + app:layout_constraintBottom_toTopOf="@id/more_information_subtitle" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" + app:layout_goneMarginBottom="16dp" + app:layout_constraintVertical_chainStyle="packed" + tools:text="Custom Title (is mandatory)" /> + + <TextView + android:id="@+id/more_information_subtitle" + style="@style/TextAppearance.AppCompat.Caption" + android:layout_width="0dp" + android:layout_height="wrap_content" + android:layout_marginTop="4dp" + android:layout_marginBottom="16dp" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@id/more_information_title" + tools:text="Custom Subtitle (is optional)" /> + + <View + android:id="@+id/bottom_divider" + android:layout_width="match_parent" + android:layout_height="@dimen/card_divider" + android:layout_marginTop="12dp" + android:background="@color/colorHairline" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" /> + +</merge> diff --git a/Corona-Warn-App/src/main/res/values/attrs.xml b/Corona-Warn-App/src/main/res/values/attrs.xml index adaecc5e822c0a653b59294a20e35a87c697e73f..6ff2a5d3b289bf4be15f39c201c06965b41bbf8d 100644 --- a/Corona-Warn-App/src/main/res/values/attrs.xml +++ b/Corona-Warn-App/src/main/res/values/attrs.xml @@ -39,4 +39,11 @@ <attr name="android:backgroundTint" /> <attr name="android:foregroundTint" /> </declare-styleable> + + <declare-styleable name="MoreInformationView"> + <attr name="isTopDividerVisible" format="boolean" /> + <attr name="isBottomDividerVisible" format="boolean" /> + <attr name="titleText" format="string" localization="suggested" /> + <attr name="subtitleText" format="string" /> + </declare-styleable> </resources> \ No newline at end of file