mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-22 01:40:07 +01:00
Manage group links behind feature flag.
This commit is contained in:
@@ -2,6 +2,8 @@ package org.thoughtcrime.securesms.qr;
|
||||
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.Color;
|
||||
|
||||
import androidx.annotation.ColorInt;
|
||||
import androidx.annotation.NonNull;
|
||||
import org.thoughtcrime.securesms.logging.Log;
|
||||
|
||||
@@ -15,6 +17,10 @@ public class QrCode {
|
||||
public static final String TAG = QrCode.class.getSimpleName();
|
||||
|
||||
public static @NonNull Bitmap create(String data) {
|
||||
return create(data, Color.BLACK);
|
||||
}
|
||||
|
||||
public static @NonNull Bitmap create(String data, @ColorInt int foregroundColor) {
|
||||
try {
|
||||
BitMatrix result = new QRCodeWriter().encode(data, BarcodeFormat.QR_CODE, 512, 512);
|
||||
Bitmap bitmap = Bitmap.createBitmap(result.getWidth(), result.getHeight(), Bitmap.Config.ARGB_8888);
|
||||
@@ -22,7 +28,7 @@ public class QrCode {
|
||||
for (int y = 0; y < result.getHeight(); y++) {
|
||||
for (int x = 0; x < result.getWidth(); x++) {
|
||||
if (result.get(x, y)) {
|
||||
bitmap.setPixel(x, y, Color.BLACK);
|
||||
bitmap.setPixel(x, y, foregroundColor);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user