Manage group links behind feature flag.

This commit is contained in:
Alan Evans
2020-08-26 15:59:34 -03:00
parent 860f06ec9e
commit bfed03b7b5
51 changed files with 2177 additions and 80 deletions

View File

@@ -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);
}
}
}