From 55663006655da93891cc85f0f292703ef181b725 Mon Sep 17 00:00:00 2001 From: Onuray Sahin Date: Tue, 11 Oct 2022 14:15:44 +0300 Subject: [PATCH] Add qr code options to layout. --- .../src/main/res/values/strings.xml | 2 + .../stylable_sessions_list_header_view.xml | 1 + .../devices/v2/list/SessionsListHeaderView.kt | 29 ++++--- .../res/layout/fragment_other_sessions.xml | 7 +- .../res/layout/fragment_settings_devices.xml | 76 ++++++++++++++----- 5 files changed, 83 insertions(+), 32 deletions(-) diff --git a/library/ui-strings/src/main/res/values/strings.xml b/library/ui-strings/src/main/res/values/strings.xml index d6a3cc8dbf..bf0bce8a8c 100644 --- a/library/ui-strings/src/main/res/values/strings.xml +++ b/library/ui-strings/src/main/res/values/strings.xml @@ -3303,6 +3303,8 @@ Session name Custom session names can help you recognize your devices more easily. Please be aware that session names are also visible to people you communicate with. + SIGN IN WITH QR CODE + You can use this device to sign in a mobile or web device with a QR code. There are two ways to do this: %s\nis looking a little empty. diff --git a/library/ui-styles/src/main/res/values/stylable_sessions_list_header_view.xml b/library/ui-styles/src/main/res/values/stylable_sessions_list_header_view.xml index d3b931e44a..f0907c8087 100644 --- a/library/ui-styles/src/main/res/values/stylable_sessions_list_header_view.xml +++ b/library/ui-styles/src/main/res/values/stylable_sessions_list_header_view.xml @@ -4,6 +4,7 @@ + diff --git a/vector/src/main/java/im/vector/app/features/settings/devices/v2/list/SessionsListHeaderView.kt b/vector/src/main/java/im/vector/app/features/settings/devices/v2/list/SessionsListHeaderView.kt index ef8682df01..c94dd469da 100644 --- a/vector/src/main/java/im/vector/app/features/settings/devices/v2/list/SessionsListHeaderView.kt +++ b/vector/src/main/java/im/vector/app/features/settings/devices/v2/list/SessionsListHeaderView.kt @@ -65,20 +65,29 @@ class SessionsListHeaderView @JvmOverloads constructor( return } + val showLearnMore = typedArray.getBoolean(R.styleable.SessionsListHeaderView_sessionListHeaderShowLearnMore, true) val learnMore = context.getString(R.string.action_learn_more) - val fullDescription = buildString { - append(description) - append(" ") - append(learnMore) + val fullDescription = if (showLearnMore) { + buildString { + append(description) + append(" ") + append(learnMore) + } + } else { + description } binding.sessionsListHeaderDescription.isVisible = true - binding.sessionsListHeaderDescription.setTextWithColoredPart( - fullText = fullDescription, - coloredPart = learnMore, - underline = false - ) { - onLearnMoreClickListener?.invoke() + if (showLearnMore) { + binding.sessionsListHeaderDescription.setTextWithColoredPart( + fullText = fullDescription, + coloredPart = learnMore, + underline = false + ) { + onLearnMoreClickListener?.invoke() + } + } else { + binding.sessionsListHeaderDescription.text = fullDescription } } } diff --git a/vector/src/main/res/layout/fragment_other_sessions.xml b/vector/src/main/res/layout/fragment_other_sessions.xml index 037f85ad28..d78db073c4 100644 --- a/vector/src/main/res/layout/fragment_other_sessions.xml +++ b/vector/src/main/res/layout/fragment_other_sessions.xml @@ -53,11 +53,12 @@ android:id="@+id/deviceListHeaderOtherSessions" android:layout_width="0dp" android:layout_height="wrap_content" - app:sessionsListHeaderDescription="@string/device_manager_sessions_other_description" - app:sessionsListHeaderTitle="" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" - app:layout_constraintTop_toBottomOf="@id/appBarLayout" /> + app:layout_constraintTop_toBottomOf="@id/appBarLayout" + app:sessionListHeaderShowLearnMore="true" + app:sessionsListHeaderDescription="@string/device_manager_sessions_other_description" + app:sessionsListHeaderTitle="" /> + app:layout_constraintTop_toTopOf="parent" + app:sessionListHeaderShowLearnMore="true" + app:sessionsListHeaderDescription="@string/device_manager_header_section_security_recommendations_description" + app:sessionsListHeaderTitle="@string/device_manager_header_section_security_recommendations_title" /> + app:layout_constraintTop_toBottomOf="@id/deviceListHeaderSectionSecurityRecommendations" + app:recommendationDescription="@string/device_manager_unverified_sessions_description" + app:recommendationImageBackgroundTint="@color/shield_color_warning_background" + app:recommendationImageResource="@drawable/ic_shield_warning_no_border" + app:recommendationTitle="@string/device_manager_unverified_sessions_title" /> + app:layout_constraintTop_toBottomOf="@id/deviceListUnverifiedSessionsRecommendation" + app:recommendationDescription="@plurals/device_manager_inactive_sessions_description" + app:recommendationImageBackgroundTint="?vctr_system" + app:recommendationImageResource="@drawable/ic_inactive_sessions" + app:recommendationTitle="@string/device_manager_inactive_sessions_title" /> + app:layout_constraintTop_toBottomOf="@id/deviceListSecurityRecommendationsDivider" + app:sessionListHeaderShowLearnMore="false" + app:sessionsListHeaderDescription="" + app:sessionsListHeaderTitle="@string/device_manager_current_session_title" /> + app:layout_constraintTop_toBottomOf="@id/deviceListDividerCurrentSession" + app:sessionListHeaderShowLearnMore="true" + app:sessionsListHeaderDescription="@string/device_manager_sessions_other_description" + app:sessionsListHeaderTitle="@string/device_manager_sessions_other_title" /> + + +