Use borderless shield for verification (web parity)

This commit is contained in:
Valere 2021-11-17 09:26:38 +01:00
parent dc708438a6
commit 1a204c6b5a
5 changed files with 46 additions and 6 deletions

View File

@ -16,12 +16,12 @@
*/
package im.vector.app.features.crypto.verification.epoxy
import android.widget.ImageView
import com.airbnb.epoxy.EpoxyAttribute
import com.airbnb.epoxy.EpoxyModelClass
import im.vector.app.R
import im.vector.app.core.epoxy.VectorEpoxyHolder
import im.vector.app.core.epoxy.VectorEpoxyModel
import im.vector.app.core.ui.views.ShieldImageView
import org.matrix.android.sdk.api.crypto.RoomEncryptionTrustLevel
/**
@ -35,10 +35,23 @@ abstract class BottomSheetVerificationBigImageItem : VectorEpoxyModel<BottomShee
override fun bind(holder: Holder) {
super.bind(holder)
holder.image.render(roomEncryptionTrustLevel)
when (roomEncryptionTrustLevel) {
RoomEncryptionTrustLevel.Default -> {
holder.image.contentDescription = holder.view.context.getString(R.string.a11y_trust_level_default)
holder.image.setImageResource(R.drawable.ic_shield_black)
}
RoomEncryptionTrustLevel.Warning -> {
holder.image.contentDescription = holder.view.context.getString(R.string.a11y_trust_level_warning)
holder.image.setImageResource(R.drawable.ic_shield_warning_no_border)
}
RoomEncryptionTrustLevel.Trusted -> {
holder.image.contentDescription = holder.view.context.getString(R.string.a11y_trust_level_trusted)
holder.image.setImageResource(R.drawable.ic_shield_trusted_no_border)
}
}
}
class Holder : VectorEpoxyHolder() {
val image by bind<ShieldImageView>(R.id.itemVerificationBigImage)
val image by bind<ImageView>(R.id.itemVerificationBigImage)
}
}

View File

@ -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>

View File

@ -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>

View File

@ -1,5 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<im.vector.app.core.ui.views.ShieldImageView xmlns:android="http://schemas.android.com/apk/res/android"
<ImageView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:contentDescription="@string/trusted"
tools:src="@drawable/ic_shield_trusted_no_border"
android:id="@+id/itemVerificationBigImage"
android:layout_width="match_parent"
android:layout_height="180dp"

View File

@ -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>
@ -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>