Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update shields to match web #4338

Merged
merged 4 commits into from
Nov 17, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/4338.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Make the verification shields the same in Element Web and Element Android
Original file line number Diff line number Diff line change
Expand Up @@ -36,21 +36,30 @@ class ShieldImageView @JvmOverloads constructor(
}
}

fun render(roomEncryptionTrustLevel: RoomEncryptionTrustLevel?) {
fun render(roomEncryptionTrustLevel: RoomEncryptionTrustLevel?, borderLess: Boolean = false) {
isVisible = roomEncryptionTrustLevel != null

when (roomEncryptionTrustLevel) {
RoomEncryptionTrustLevel.Default -> {
contentDescription = context.getString(R.string.a11y_trust_level_default)
setImageResource(R.drawable.ic_shield_black)
setImageResource(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@chagai95 updating these to use setAttributeTintedImageResource and then supplying a theme colour will allow customisations

if (borderLess) R.drawable.ic_shield_black_no_border
else R.drawable.ic_shield_black
)
}
RoomEncryptionTrustLevel.Warning -> {
contentDescription = context.getString(R.string.a11y_trust_level_warning)
setImageResource(R.drawable.ic_shield_warning)
setImageResource(
if (borderLess) R.drawable.ic_shield_warning_no_border
else R.drawable.ic_shield_warning
)
}
RoomEncryptionTrustLevel.Trusted -> {
contentDescription = context.getString(R.string.a11y_trust_level_trusted)
setImageResource(R.drawable.ic_shield_trusted)
setImageResource(
if (borderLess) R.drawable.ic_shield_trusted_no_border
else R.drawable.ic_shield_trusted
)
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ abstract class BottomSheetVerificationBigImageItem : VectorEpoxyModel<BottomShee

override fun bind(holder: Holder) {
super.bind(holder)
holder.image.render(roomEncryptionTrustLevel)
holder.image.render(roomEncryptionTrustLevel, borderLess = true)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice!

}

class Holder : VectorEpoxyHolder() {
Expand Down
9 changes: 3 additions & 6 deletions vector/src/main/res/drawable/ic_shield_black.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,7 @@
android:viewportHeight="24">
<path
android:strokeWidth="1"
android:pathData="M12,21C12,21 21,17.2 21,11.5V4.85L12,2L3,4.85V11.5C3,17.2 12,21 12,21Z"
android:strokeLineJoin="round"
android:fillColor="#2E2F32"
android:fillType="evenOdd"
android:strokeColor="#ffffff"
android:strokeLineCap="round"/>
android:pathData="M12.0077,23.4869C12.0051,23.4875 12.0025,23.4881 12,23.4886C11.9975,23.4881 11.9949,23.4875 11.9923,23.4869C11.9204,23.4706 11.8129,23.4452 11.6749,23.4092C11.3989,23.3373 11.0015,23.2235 10.5233,23.0575C9.5654,22.725 8.2921,22.186 7.0225,21.3608C4.4897,19.7145 2,16.954 2,12.405V3.4496L12,0.521L22,3.4496V12.405C22,16.954 19.5103,19.7145 16.9775,21.3608C15.7079,22.186 14.4346,22.725 13.4767,23.0575C12.9985,23.2235 12.6011,23.3373 12.3251,23.4092C12.1871,23.4452 12.0796,23.4706 12.0077,23.4869Z"
android:fillColor="#17191C"
android:strokeColor="#ffffff"/>
</vector>
9 changes: 9 additions & 0 deletions vector/src/main/res/drawable/ic_shield_black_no_border.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="#17191C"
android:pathData="M12.0077,23.4869C12.0051,23.4875 12.0025,23.4881 12,23.4886C11.9975,23.4881 11.9949,23.4875 11.9923,23.4869C11.9204,23.4706 11.8129,23.4452 11.6749,23.4092C11.3989,23.3373 11.0015,23.2235 10.5233,23.0575C9.5654,22.725 8.2921,22.186 7.0225,21.3608C4.4897,19.7145 2,16.954 2,12.405V3.4496L12,0.521L22,3.4496V12.405C22,16.954 19.5103,19.7145 16.9775,21.3608C15.7079,22.186 14.4346,22.725 13.4767,23.0575C12.9985,23.2235 12.6011,23.3373 12.3251,23.4092C12.1871,23.4452 12.0796,23.4706 12.0077,23.4869Z" />
</vector>
13 changes: 5 additions & 8 deletions vector/src/main/res/drawable/ic_shield_custom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,9 @@
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:strokeWidth="1"
android:pathData="M12,21C12,21 21,17.2 21,11.5V4.85L12,2L3,4.85V11.5C3,17.2 12,21 12,21Z"
android:strokeLineJoin="round"
android:fillColor="#03B381"
android:fillType="evenOdd"
android:strokeColor="#ffffff"
android:strokeLineCap="round"/>
<path
android:fillColor="#03B381"
android:pathData="M12.0077,23.4869C12.0051,23.4875 12.0025,23.4881 12,23.4886C11.9975,23.4881 11.9949,23.4875 11.9923,23.4869C11.9204,23.4706 11.8129,23.4452 11.6749,23.4092C11.3989,23.3373 11.0015,23.2235 10.5233,23.0575C9.5654,22.725 8.2921,22.186 7.0225,21.3608C4.4897,19.7145 2,16.954 2,12.405V3.4496L12,0.521L22,3.4496V12.405C22,16.954 19.5103,19.7145 16.9775,21.3608C15.7079,22.186 14.4346,22.725 13.4767,23.0575C12.9985,23.2235 12.6011,23.3373 12.3251,23.4092C12.1871,23.4452 12.0796,23.4706 12.0077,23.4869Z"
android:strokeWidth="1"
android:strokeColor="#ffffff" />
</vector>
14 changes: 5 additions & 9 deletions vector/src/main/res/drawable/ic_shield_trusted.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,10 @@
android:viewportHeight="24">
<path
android:strokeWidth="1"
android:pathData="M12,21C12,21 21,17.2 21,11.5V4.85L12,2L3,4.85V11.5C3,17.2 12,21 12,21Z"
android:strokeLineJoin="round"
android:fillColor="#03B381"
android:fillType="evenOdd"
android:strokeColor="#ffffff"
android:strokeLineCap="round"/>
android:pathData="M12.0077,23.4869C12.0051,23.4875 12.0025,23.4881 12,23.4886C11.9975,23.4881 11.9949,23.4875 11.9923,23.4869C11.9204,23.4706 11.8129,23.4452 11.6749,23.4092C11.3989,23.3373 11.0015,23.2235 10.5233,23.0575C9.5654,22.725 8.2921,22.186 7.0225,21.3608C4.4897,19.7145 2,16.954 2,12.405V3.4496L12,0.521L22,3.4496V12.405C22,16.954 19.5103,19.7145 16.9775,21.3608C15.7079,22.186 14.4346,22.725 13.4767,23.0575C12.9985,23.2235 12.6011,23.3373 12.3251,23.4092C12.1871,23.4452 12.0796,23.4706 12.0077,23.4869Z"
android:fillColor="#0DBD8B"
android:strokeColor="#ffffff"/>
<path
android:pathData="M17.2268,7.8065C17.6053,8.1718 17.6053,8.7639 17.2268,9.1291L11.4013,14.7502C11.0228,15.1154 10.4091,15.1154 10.0306,14.7502L10.0145,14.7342C10.0084,14.7286 10.0023,14.7229 9.9964,14.7171L7.3235,12.1381C6.926,11.7546 6.926,11.1328 7.3235,10.7493C7.7209,10.3658 8.3653,10.3658 8.7627,10.7493L10.7838,12.6995L15.8561,7.8065C16.2346,7.4413 16.8483,7.4413 17.2268,7.8065Z"
android:fillColor="#ffffff"
android:fillType="evenOdd"/>
android:pathData="M17.4157,6.8094C17.1457,6.5244 16.6957,6.5094 16.4107,6.7794L10.0057,12.7794L7.6507,11.1294C7.3357,10.9194 6.9007,10.9194 6.6007,11.1894C6.2407,11.4894 6.2107,12.0294 6.5107,12.3894L9.2257,15.5094C9.2707,15.5544 9.3157,15.6144 9.3757,15.6444C9.8857,16.0644 10.6507,15.9894 11.0707,15.4794L11.1157,15.4194L17.4457,7.7544C17.6557,7.4844 17.6557,7.0794 17.4157,6.8094Z"
android:fillColor="#ffffff"/>
</vector>
12 changes: 12 additions & 0 deletions vector/src/main/res/drawable/ic_shield_trusted_no_border.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:pathData="M1.5,12.405V3.075L12,0L22.5,3.075V12.405C22.5,21.945 12,24 12,24C12,24 1.5,21.945 1.5,12.405Z"
android:fillColor="#0DBD8B"/>
<path
android:pathData="M17.4157,6.8094C17.1457,6.5244 16.6957,6.5094 16.4107,6.7794L10.0057,12.7794L7.6507,11.1294C7.3357,10.9194 6.9007,10.9194 6.6007,11.1894C6.2407,11.4894 6.2107,12.0294 6.5107,12.3894L9.2257,15.5094C9.2707,15.5544 9.3157,15.6144 9.3757,15.6444C9.8857,16.0644 10.6507,15.9894 11.0707,15.4794L11.1157,15.4194L17.4457,7.7544C17.6557,7.4844 17.6557,7.0794 17.4157,6.8094Z"
android:fillColor="#ffffff"/>
</vector>
17 changes: 6 additions & 11 deletions vector/src/main/res/drawable/ic_shield_warning.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,11 @@
android:viewportHeight="24">
<path
android:strokeWidth="1"
android:pathData="m12,21s9,-3.8 9,-9.5v-6.65l-9,-2.85 -9,2.85v6.65c0,5.7 9,9.5 9,9.5z"
android:strokeLineJoin="round"
android:fillColor="#ff4b55"
android:strokeColor="#fff"
android:fillType="evenOdd"
android:strokeLineCap="round"/>
android:pathData="M12.0077,23.4869C12.0051,23.4875 12.0025,23.4881 12,23.4886C11.9975,23.4881 11.9949,23.4875 11.9923,23.4869C11.9204,23.4706 11.8129,23.4452 11.6749,23.4092C11.3989,23.3373 11.0015,23.2235 10.5233,23.0575C9.5654,22.725 8.2921,22.186 7.0225,21.3608C4.4897,19.7145 2,16.954 2,12.405V3.4496L12,0.521L22,3.4496V12.405C22,16.954 19.5103,19.7145 16.9775,21.3608C15.7079,22.186 14.4346,22.725 13.4767,23.0575C12.9985,23.2235 12.6011,23.3373 12.3251,23.4092C12.1871,23.4452 12.0796,23.4706 12.0077,23.4869Z"
android:fillColor="#FF4B55"
android:strokeColor="#ffffff"/>
<path
android:pathData="M12.05,5.5L12.05,5.5A1.25,1.25 0,0 1,13.3 6.75L13.3,12.25A1.25,1.25 0,0 1,12.05 13.5L12.05,13.5A1.25,1.25 0,0 1,10.8 12.25L10.8,6.75A1.25,1.25 0,0 1,12.05 5.5z"
android:fillColor="#fff"/>
<path
android:pathData="M12.05,15L12.05,15A1.25,1.25 0,0 1,13.3 16.25L13.3,16.25A1.25,1.25 0,0 1,12.05 17.5L12.05,17.5A1.25,1.25 0,0 1,10.8 16.25L10.8,16.25A1.25,1.25 0,0 1,12.05 15z"
android:fillColor="#fff"/>
android:pathData="M10.8527,8.0725C10.7964,7.4313 11.2689,6.8688 11.9102,6.8238C12.5402,6.7788 13.1027,7.2513 13.1702,7.8925V8.0725L12.8102,12.5725C12.7764,12.9888 12.4277,13.3038 12.0114,13.3038H11.9439C11.5502,13.27 11.2464,12.9663 11.2127,12.5725L10.8527,8.0725ZM12.9888,15.5076C12.9888,16.0543 12.5456,16.4976 11.9988,16.4976C11.452,16.4976 11.0088,16.0543 11.0088,15.5076C11.0088,14.9608 11.452,14.5176 11.9988,14.5176C12.5456,14.5176 12.9888,14.9608 12.9888,15.5076Z"
android:fillColor="#ffffff"
android:fillType="evenOdd"/>
</vector>
18 changes: 18 additions & 0 deletions vector/src/main/res/drawable/ic_shield_warning_no_border.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:strokeWidth="1"
android:pathData="M12.0077,23.4869C12.0051,23.4875 12.0025,23.4881 12,23.4886C11.9975,23.4881 11.9949,23.4875 11.9923,23.4869C11.9204,23.4706 11.8129,23.4452 11.6749,23.4092C11.3989,23.3373 11.0015,23.2235 10.5233,23.0575C9.5654,22.725 8.2921,22.186 7.0225,21.3608C4.4897,19.7145 2,16.954 2,12.405V3.4496L12,0.521L22,3.4496V12.405C22,16.954 19.5103,19.7145 16.9775,21.3608C15.7079,22.186 14.4346,22.725 13.4767,23.0575C12.9985,23.2235 12.6011,23.3373 12.3251,23.4092C12.1871,23.4452 12.0796,23.4706 12.0077,23.4869Z"
android:fillColor="#FF4B55"
android:strokeColor="#ffffff"/>
<path
android:pathData="M1.5,12.405V3.075L12,0L22.5,3.075V12.405C22.5,21.945 12,24 12,24C12,24 1.5,21.945 1.5,12.405Z"
android:fillColor="#FF4B55"/>
<path
android:pathData="M10.8527,8.0725C10.7964,7.4313 11.2689,6.8688 11.9102,6.8238C12.5402,6.7788 13.1027,7.2513 13.1702,7.8925V8.0725L12.8102,12.5725C12.7764,12.9888 12.4277,13.3038 12.0114,13.3038H11.9439C11.5502,13.27 11.2464,12.9663 11.2127,12.5725L10.8527,8.0725ZM12.9888,15.5076C12.9888,16.0543 12.5456,16.4976 11.9988,16.4976C11.452,16.4976 11.0088,16.0543 11.0088,15.5076C11.0088,14.9608 11.452,14.5176 11.9988,14.5176C12.5456,14.5176 12.9888,14.9608 12.9888,15.5076Z"
android:fillColor="#ffffff"
android:fillType="evenOdd"/>
</vector>
25 changes: 10 additions & 15 deletions vector/src/main/res/drawable/ic_shield_warning_small.xml
Original file line number Diff line number Diff line change
@@ -1,20 +1,15 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="16dp"
android:height="16dp"
android:viewportWidth="24"
android:viewportHeight="24">
android:width="12dp"
android:height="12dp"
android:viewportWidth="12"
android:viewportHeight="12">
<path
android:strokeWidth="1"
android:pathData="m12,21s9,-3.8 9,-9.5v-6.65l-9,-2.85 -9,2.85v6.65c0,5.7 9,9.5 9,9.5z"
android:strokeLineJoin="round"
android:fillColor="#ff4b55"
android:strokeColor="#fff"
android:fillType="evenOdd"
android:strokeLineCap="round"/>
android:pathData="M6.0995,11.4627C6.0611,11.4727 6.0278,11.481 6,11.4876C5.9722,11.481 5.9389,11.4727 5.9005,11.4627C5.768,11.4282 5.5757,11.3731 5.3437,11.2926C4.8779,11.1309 4.2608,10.8694 3.6475,10.4708C2.4272,9.6776 1.25,8.3665 1.25,6.2025V1.9121L6,0.521L10.75,1.9121V6.2025C10.75,8.3665 9.5728,9.6776 8.3525,10.4708C7.7392,10.8694 7.1221,11.1309 6.6563,11.2926C6.4243,11.3731 6.232,11.4282 6.0995,11.4627Z"
android:fillColor="#FF4B55"
android:strokeColor="#ffffff"/>
<path
android:pathData="M12.05,5.5L12.05,5.5A1.25,1.25 0,0 1,13.3 6.75L13.3,12.25A1.25,1.25 0,0 1,12.05 13.5L12.05,13.5A1.25,1.25 0,0 1,10.8 12.25L10.8,6.75A1.25,1.25 0,0 1,12.05 5.5z"
android:fillColor="#fff"/>
<path
android:pathData="M12.05,15L12.05,15A1.25,1.25 0,0 1,13.3 16.25L13.3,16.25A1.25,1.25 0,0 1,12.05 17.5L12.05,17.5A1.25,1.25 0,0 1,10.8 16.25L10.8,16.25A1.25,1.25 0,0 1,12.05 15z"
android:fillColor="#fff"/>
android:pathData="M5.4263,4.0363C5.3982,3.7156 5.6345,3.4344 5.9551,3.4119C6.2701,3.3894 6.5513,3.6256 6.5851,3.9463V4.0363L6.4051,6.2863C6.3882,6.4944 6.2138,6.6519 6.0057,6.6519H5.972C5.7751,6.635 5.6232,6.4831 5.6063,6.2863L5.4263,4.0363ZM6.4944,7.7538C6.4944,8.0272 6.2728,8.2488 5.9994,8.2488C5.726,8.2488 5.5044,8.0272 5.5044,7.7538C5.5044,7.4804 5.726,7.2588 5.9994,7.2588C6.2728,7.2588 6.4944,7.4804 6.4944,7.7538Z"
android:fillColor="#ffffff"
android:fillType="evenOdd"/>
</vector>
4 changes: 2 additions & 2 deletions vector/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2898,7 +2898,7 @@

<string name="a11y_qr_code_for_verification">QR code</string>

<string name="qr_code_scanned_by_other_notice">Almost there! Is %s showing the same shield?</string>
<string name="qr_code_scanned_by_other_notice">Almost there! Is %s showing a tick?</string>
<string name="qr_code_scanned_by_other_yes">Yes</string>
<string name="qr_code_scanned_by_other_no">No</string>

Expand Down Expand Up @@ -3051,7 +3051,7 @@
<string name="add_a_topic_link_text">Add a topic</string>
<string name="topic_prefix">"Topic: "</string>

<string name="qr_code_scanned_self_verif_notice">Almost there! Is the other device showing the same shield?</string>
<string name="qr_code_scanned_self_verif_notice">Almost there! Is the other device showing a tick?</string>
<string name="qr_code_scanned_verif_waiting_notice">Almost there! Waiting for confirmation…</string>
<string name="qr_code_scanned_verif_waiting">Waiting for %s…</string>

Expand Down