invert qr code colors when night mode is enabled

This commit is contained in:
pokkst 2022-09-13 15:04:23 -05:00
parent e3252b5762
commit de5c096261
No known key found for this signature in database
GPG key ID: 90C2ED85E67A50FF

View file

@ -22,7 +22,9 @@ import com.google.zxing.qrcode.decoder.ErrorCorrectionLevel;
import com.m2049r.xmrwallet.R; import com.m2049r.xmrwallet.R;
import com.m2049r.xmrwallet.data.Subaddress; import com.m2049r.xmrwallet.data.Subaddress;
import com.m2049r.xmrwallet.service.AddressService; import com.m2049r.xmrwallet.service.AddressService;
import com.m2049r.xmrwallet.util.DayNightMode;
import com.m2049r.xmrwallet.util.Helper; import com.m2049r.xmrwallet.util.Helper;
import com.m2049r.xmrwallet.util.NightmodeHelper;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
@ -59,10 +61,11 @@ public class ReceiveBottomSheetDialog extends BottomSheetDialogFragment {
int[] pixels = new int[width * height]; int[] pixels = new int[width * height];
for (int i = 0; i < height; i++) { for (int i = 0; i < height; i++) {
for (int j = 0; j < width; j++) { for (int j = 0; j < width; j++) {
boolean night = NightmodeHelper.getPreferredNightmode() == DayNightMode.NIGHT;
if (bitMatrix.get(j, i)) { if (bitMatrix.get(j, i)) {
pixels[i * width + j] = 0x00000000; pixels[i * width + j] = night ? 0xffffffff : 0x00000000;
} else { } else {
pixels[i * height + j] = 0xffffffff; pixels[i * height + j] = night ? getResources().getColor(R.color.oled_colorBackground) : 0xffffffff;
} }
} }
} }