mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-07-13 17:23:56 +01:00
Update safety number screen to be in line with design.
This commit is contained in:
+1
-1
@@ -115,7 +115,7 @@ class SafetyNumberQrView : ConstraintLayout {
|
||||
|
||||
val qrCodeData = fingerprint.scannableFingerprint.serialized
|
||||
val qrCodeString = String(qrCodeData, Charset.forName("ISO-8859-1"))
|
||||
val qrCodeBitmap = QrCodeUtil.create(qrCodeString)
|
||||
val qrCodeBitmap = QrCodeUtil.createNoPadding(qrCodeString)
|
||||
|
||||
qrCode.setImageBitmap(qrCodeBitmap)
|
||||
shareButton.visible = true
|
||||
|
||||
@@ -8,6 +8,7 @@ import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.google.zxing.BarcodeFormat;
|
||||
import com.google.zxing.EncodeHintType;
|
||||
import com.google.zxing.WriterException;
|
||||
import com.google.zxing.common.BitMatrix;
|
||||
import com.google.zxing.qrcode.QRCodeWriter;
|
||||
@@ -15,6 +16,9 @@ import com.google.zxing.qrcode.QRCodeWriter;
|
||||
import org.signal.core.util.logging.Log;
|
||||
import org.signal.core.util.Stopwatch;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public final class QrCodeUtil {
|
||||
|
||||
private QrCodeUtil() {
|
||||
@@ -22,13 +26,22 @@ public final class QrCodeUtil {
|
||||
|
||||
public static final String TAG = Log.tag(QrCodeUtil.class);
|
||||
|
||||
public static @NonNull Bitmap create(@Nullable String data) {
|
||||
return create(data, Color.BLACK, Color.TRANSPARENT);
|
||||
public static @NonNull Bitmap createNoPadding(@Nullable String data) {
|
||||
Map<EncodeHintType, Integer> hints = new HashMap<>();
|
||||
hints.put(EncodeHintType.MARGIN, 0);
|
||||
return create(data, Color.BLACK, Color.TRANSPARENT, hints);
|
||||
}
|
||||
|
||||
public static @NonNull Bitmap create(@Nullable String data,
|
||||
@ColorInt int foregroundColor,
|
||||
@ColorInt int backgroundColor)
|
||||
@ColorInt int backgroundColor) {
|
||||
return create(data, foregroundColor, backgroundColor, null);
|
||||
}
|
||||
|
||||
public static @NonNull Bitmap create(@Nullable String data,
|
||||
@ColorInt int foregroundColor,
|
||||
@ColorInt int backgroundColor,
|
||||
@Nullable Map<EncodeHintType,?> hints)
|
||||
{
|
||||
if (data == null || data.length() == 0) {
|
||||
Log.w(TAG, "No data");
|
||||
@@ -38,7 +51,7 @@ public final class QrCodeUtil {
|
||||
try {
|
||||
Stopwatch stopwatch = new Stopwatch("QrGen");
|
||||
QRCodeWriter qrCodeWriter = new QRCodeWriter();
|
||||
BitMatrix qrData = qrCodeWriter.encode(data, BarcodeFormat.QR_CODE, 512, 512);
|
||||
BitMatrix qrData = qrCodeWriter.encode(data, BarcodeFormat.QR_CODE, 512, 512, hints);
|
||||
int qrWidth = qrData.getWidth();
|
||||
int qrHeight = qrData.getHeight();
|
||||
int[] pixels = new int[qrWidth * qrHeight];
|
||||
|
||||
@@ -40,13 +40,14 @@
|
||||
android:text="@string/verify_display_fragment__loading"
|
||||
android:textSize="20sp" />
|
||||
|
||||
<org.thoughtcrime.securesms.components.SquareImageView
|
||||
<ImageView
|
||||
android:id="@+id/qr_code"
|
||||
android:layout_width="120dp"
|
||||
android:layout_height="120dp"
|
||||
android:layout_marginHorizontal="20dp"
|
||||
android:layout_marginTop="20dp"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:scaleType="centerCrop"
|
||||
android:visibility="invisible"
|
||||
tools:src="@drawable/ic_about_mc_80"
|
||||
tools:visibility="visible" />
|
||||
@@ -100,7 +101,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/verify_identity_vertical_margin"
|
||||
android:layout_marginBottom="49dp"
|
||||
android:layout_marginHorizontal="25dp"
|
||||
android:layout_marginHorizontal="24dp"
|
||||
app:layout_constraintTop_toBottomOf="@id/qr_code_container"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
|
||||
@@ -91,7 +91,6 @@
|
||||
android:id="@+id/dot_indicators"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
app:tabBackground="@drawable/safety_dot_indicator"
|
||||
app:tabGravity="center"
|
||||
app:tabPaddingEnd="10dp"
|
||||
@@ -104,8 +103,8 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="32dp"
|
||||
android:layout_marginTop="@dimen/verify_identity_vertical_margin"
|
||||
android:layout_marginEnd="32dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginBottom="20dp"
|
||||
android:gravity="center"
|
||||
android:lineSpacingExtra="3sp"
|
||||
@@ -143,11 +142,12 @@
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/verify_button"
|
||||
style="@style/Signal.Widget.Button.Large.Tonal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/dsl_settings_gutter"
|
||||
android:layout_marginTop="16dp"
|
||||
android:layout_marginEnd="@dimen/dsl_settings_gutter"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:text="@string/verify_display_fragment__mark_as_verified"
|
||||
android:textAllCaps="false" />
|
||||
</FrameLayout>
|
||||
|
||||
@@ -313,7 +313,7 @@
|
||||
<style name="IdentityKey">
|
||||
<item name="android:fontFamily">monospace</item>
|
||||
<item name="android:typeface">monospace</item>
|
||||
<item name="android:textSize">16sp</item>
|
||||
<item name="android:textSize">15sp</item>
|
||||
<item name="android:clickable">false</item>
|
||||
<item name="android:focusable">false</item>
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user