Search in sources :

Example 6 with Fingerprint

use of org.whispersystems.libsignal.fingerprint.Fingerprint in project Signal-Android by WhisperSystems.

the class VerifyDisplayFragment method setFingerprintViews.

private void setFingerprintViews(Fingerprint fingerprint, boolean animate) {
    String[] segments = getSegments(fingerprint, codes.length);
    for (int i = 0; i < codes.length; i++) {
        if (animate)
            setCodeSegment(codes[i], segments[i]);
        else
            codes[i].setText(segments[i]);
    }
    byte[] qrCodeData = fingerprint.getScannableFingerprint().getSerialized();
    String qrCodeString = new String(qrCodeData, Charset.forName("ISO-8859-1"));
    Bitmap qrCodeBitmap = QrCode.create(qrCodeString);
    qrCode.setImageBitmap(qrCodeBitmap);
    if (animate) {
        ViewUtil.fadeIn(qrCode, 1000);
        ViewUtil.fadeIn(tapLabel, 1000);
        ViewUtil.fadeOut(loading, 300, View.GONE);
    } else {
        qrCode.setVisibility(View.VISIBLE);
        tapLabel.setVisibility(View.VISIBLE);
        loading.setVisibility(View.GONE);
    }
}
Also used : Bitmap(android.graphics.Bitmap) Fingerprint(org.whispersystems.libsignal.fingerprint.Fingerprint)

Example 7 with Fingerprint

use of org.whispersystems.libsignal.fingerprint.Fingerprint in project Signal-Android by signalapp.

the class VerifyDisplayFragment method getFormattedSafetyNumbers.

@NonNull
private String getFormattedSafetyNumbers(@NonNull Fingerprint fingerprint, int segmentCount) {
    String[] segments = getSegments(fingerprint, segmentCount);
    StringBuilder result = new StringBuilder();
    for (int i = 0; i < segments.length; i++) {
        result.append(segments[i]);
        if (i != segments.length - 1) {
            if (((i + 1) % 4) == 0)
                result.append('\n');
            else
                result.append(' ');
        }
    }
    return result.toString();
}
Also used : Fingerprint(org.whispersystems.libsignal.fingerprint.Fingerprint) NonNull(androidx.annotation.NonNull)

Example 8 with Fingerprint

use of org.whispersystems.libsignal.fingerprint.Fingerprint in project Signal-Android by signalapp.

the class VerifyDisplayFragment method setFingerprintViews.

private void setFingerprintViews(Fingerprint fingerprint, boolean animate) {
    String[] segments = getSegments(fingerprint, codes.length);
    for (int i = 0; i < codes.length; i++) {
        if (animate)
            setCodeSegment(codes[i], segments[i]);
        else
            codes[i].setText(segments[i]);
    }
    byte[] qrCodeData = fingerprint.getScannableFingerprint().getSerialized();
    String qrCodeString = new String(qrCodeData, Charset.forName("ISO-8859-1"));
    Bitmap qrCodeBitmap = QrCode.create(qrCodeString);
    qrCode.setImageBitmap(qrCodeBitmap);
    if (animate) {
        ViewUtil.fadeIn(qrCode, 1000);
        ViewUtil.fadeIn(tapLabel, 1000);
        ViewUtil.fadeOut(loading, 300, View.GONE);
    } else {
        qrCode.setVisibility(View.VISIBLE);
        tapLabel.setVisibility(View.VISIBLE);
        loading.setVisibility(View.GONE);
    }
}
Also used : Bitmap(android.graphics.Bitmap) Fingerprint(org.whispersystems.libsignal.fingerprint.Fingerprint)

Aggregations

Fingerprint (org.whispersystems.libsignal.fingerprint.Fingerprint)8 Bitmap (android.graphics.Bitmap)4 NonNull (androidx.annotation.NonNull)4 TypeEvaluator (android.animation.TypeEvaluator)2 ValueAnimator (android.animation.ValueAnimator)2 ActivityNotFoundException (android.content.ActivityNotFoundException)2 Context (android.content.Context)2 Intent (android.content.Intent)2 BitmapFactory (android.graphics.BitmapFactory)2 Canvas (android.graphics.Canvas)2 PorterDuff (android.graphics.PorterDuff)2 BitmapDrawable (android.graphics.drawable.BitmapDrawable)2 Bundle (android.os.Bundle)2 Html (android.text.Html)2 TextUtils (android.text.TextUtils)2 LinkMovementMethod (android.text.method.LinkMovementMethod)2 ContextMenu (android.view.ContextMenu)2 LayoutInflater (android.view.LayoutInflater)2 MenuInflater (android.view.MenuInflater)2 MenuItem (android.view.MenuItem)2