mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2024-11-25 02:45:53 +03:00
Add qr code options to layout.
This commit is contained in:
parent
aacf2ba8a6
commit
5566300665
5 changed files with 83 additions and 32 deletions
|
@ -3303,6 +3303,8 @@
|
|||
<string name="device_manager_session_rename_edit_hint">Session name</string>
|
||||
<string name="device_manager_session_rename_description">Custom session names can help you recognize your devices more easily.</string>
|
||||
<string name="device_manager_session_rename_warning">Please be aware that session names are also visible to people you communicate with.</string>
|
||||
<string name="device_manager_sessions_sign_in_with_qr_code_title">SIGN IN WITH QR CODE</string>
|
||||
<string name="device_manager_sessions_sign_in_with_qr_code_description">You can use this device to sign in a mobile or web device with a QR code. There are two ways to do this:</string>
|
||||
|
||||
<!-- Note to translators: %s will be replaces with selected space name -->
|
||||
<string name="home_empty_space_no_rooms_title">%s\nis looking a little empty.</string>
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
<declare-styleable name="SessionsListHeaderView">
|
||||
<attr name="sessionsListHeaderTitle" format="string" />
|
||||
<attr name="sessionsListHeaderDescription" format="string" />
|
||||
<attr name="sessionListHeaderShowLearnMore" format="boolean" />
|
||||
</declare-styleable>
|
||||
|
||||
</resources>
|
||||
|
|
|
@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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="" />
|
||||
|
||||
<im.vector.app.features.settings.devices.v2.othersessions.OtherSessionsSecurityRecommendationView
|
||||
android:id="@+id/otherSessionsSecurityRecommendationView"
|
||||
|
|
|
@ -12,11 +12,12 @@
|
|||
android:id="@+id/deviceListHeaderSectionSecurityRecommendations"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
app:sessionsListHeaderDescription="@string/device_manager_header_section_security_recommendations_description"
|
||||
app:sessionsListHeaderTitle="@string/device_manager_header_section_security_recommendations_title"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
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" />
|
||||
|
||||
<im.vector.app.features.settings.devices.v2.list.SecurityRecommendationView
|
||||
android:id="@+id/deviceListUnverifiedSessionsRecommendation"
|
||||
|
@ -24,13 +25,13 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:layout_marginHorizontal="16dp"
|
||||
android:layout_marginVertical="16dp"
|
||||
app:recommendationTitle="@string/device_manager_unverified_sessions_title"
|
||||
app:recommendationDescription="@string/device_manager_unverified_sessions_description"
|
||||
app:recommendationImageResource="@drawable/ic_shield_warning_no_border"
|
||||
app:recommendationImageBackgroundTint="@color/shield_color_warning_background"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/deviceListHeaderSectionSecurityRecommendations"/>
|
||||
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" />
|
||||
|
||||
<im.vector.app.features.settings.devices.v2.list.SecurityRecommendationView
|
||||
android:id="@+id/deviceListInactiveSessionsRecommendation"
|
||||
|
@ -38,13 +39,13 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:layout_marginHorizontal="16dp"
|
||||
android:layout_marginVertical="16dp"
|
||||
app:recommendationTitle="@string/device_manager_inactive_sessions_title"
|
||||
app:recommendationDescription="@plurals/device_manager_inactive_sessions_description"
|
||||
app:recommendationImageResource="@drawable/ic_inactive_sessions"
|
||||
app:recommendationImageBackgroundTint="?vctr_system"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/deviceListUnverifiedSessionsRecommendation"/>
|
||||
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" />
|
||||
|
||||
<View
|
||||
android:id="@+id/deviceListSecurityRecommendationsDivider"
|
||||
|
@ -60,11 +61,12 @@
|
|||
android:id="@+id/deviceListHeaderCurrentSession"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
app:sessionsListHeaderDescription=""
|
||||
app:sessionsListHeaderTitle="@string/device_manager_current_session_title"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/deviceListSecurityRecommendationsDivider" />
|
||||
app:layout_constraintTop_toBottomOf="@id/deviceListSecurityRecommendationsDivider"
|
||||
app:sessionListHeaderShowLearnMore="false"
|
||||
app:sessionsListHeaderDescription=""
|
||||
app:sessionsListHeaderTitle="@string/device_manager_current_session_title" />
|
||||
|
||||
<im.vector.app.features.settings.devices.v2.list.SessionInfoView
|
||||
android:id="@+id/deviceListCurrentSession"
|
||||
|
@ -90,11 +92,12 @@
|
|||
android:id="@+id/deviceListHeaderOtherSessions"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
app:sessionsListHeaderDescription="@string/device_manager_sessions_other_description"
|
||||
app:sessionsListHeaderTitle="@string/device_manager_sessions_other_title"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/deviceListDividerCurrentSession" />
|
||||
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" />
|
||||
|
||||
<im.vector.app.features.settings.devices.v2.list.OtherSessionsView
|
||||
android:id="@+id/deviceListOtherSessions"
|
||||
|
@ -105,6 +108,41 @@
|
|||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/deviceListHeaderOtherSessions" />
|
||||
|
||||
<im.vector.app.features.settings.devices.v2.list.SessionsListHeaderView
|
||||
android:id="@+id/deviceListHeaderSignInWithQrCode"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/deviceListOtherSessions"
|
||||
app:sessionListHeaderShowLearnMore="false"
|
||||
app:sessionsListHeaderDescription="@string/device_manager_sessions_sign_in_with_qr_code_description"
|
||||
app:sessionsListHeaderTitle="@string/device_manager_sessions_sign_in_with_qr_code_title" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/deviceListHeaderScanQrCodeButton"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginHorizontal="16dp"
|
||||
android:layout_marginTop="12dp"
|
||||
android:text="@string/qr_code_login_scan_qr_code_button"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/deviceListHeaderSignInWithQrCode" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/deviceListHeaderShowQrCodeButton"
|
||||
style="@style/Widget.Vector.Button.Outlined"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginHorizontal="16dp"
|
||||
android:layout_marginTop="4dp"
|
||||
android:layout_marginBottom="12dp"
|
||||
android:text="@string/qr_code_login_show_qr_code_button"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/deviceListHeaderScanQrCodeButton" />
|
||||
|
||||
<include
|
||||
android:id="@+id/waiting_view"
|
||||
layout="@layout/merge_overlay_waiting_view"
|
||||
|
|
Loading…
Reference in a new issue