diff --git a/src/main/java/eu/siacs/conversations/services/BarcodeProvider.java b/src/main/java/eu/siacs/conversations/services/BarcodeProvider.java index 9c50b081..ab737c3b 100644 --- a/src/main/java/eu/siacs/conversations/services/BarcodeProvider.java +++ b/src/main/java/eu/siacs/conversations/services/BarcodeProvider.java @@ -18,8 +18,9 @@ import android.util.Log; import com.google.zxing.BarcodeFormat; import com.google.zxing.EncodeHintType; -import com.google.zxing.aztec.AztecWriter; import com.google.zxing.common.BitMatrix; +import com.google.zxing.qrcode.QRCodeWriter; +import com.google.zxing.qrcode.decoder.ErrorCorrectionLevel; import java.io.File; import java.io.FileNotFoundException; @@ -106,7 +107,7 @@ public class BarcodeProvider extends ContentProvider implements ServiceConnectio if (!file.exists()) { file.getParentFile().mkdirs(); file.createNewFile(); - Bitmap bitmap = createAztecBitmap(account.getShareableUri(), 1024); + Bitmap bitmap = create2dBarcodeBitmap(account.getShareableUri(), 1024); OutputStream outputStream = new FileOutputStream(file); bitmap.compress(Bitmap.CompressFormat.PNG, 100, outputStream); outputStream.close(); @@ -181,12 +182,12 @@ public class BarcodeProvider extends ContentProvider implements ServiceConnectio return Uri.parse("content://" + packageId + AUTHORITY + "/" + account.getJid().toBareJid() + ".png"); } - public static Bitmap createAztecBitmap(String input, int size) { + public static Bitmap create2dBarcodeBitmap(String input, int size) { try { - final AztecWriter AZTEC_WRITER = new AztecWriter(); + final QRCodeWriter barcodeWriter = new QRCodeWriter(); final Hashtable hints = new Hashtable<>(); - hints.put(EncodeHintType.ERROR_CORRECTION, 10); - final BitMatrix result = AZTEC_WRITER.encode(input, BarcodeFormat.AZTEC, size, size, hints); + hints.put(EncodeHintType.ERROR_CORRECTION, ErrorCorrectionLevel.M); + final BitMatrix result = barcodeWriter.encode(input, BarcodeFormat.QR_CODE, size, size, hints); final int width = result.getWidth(); final int height = result.getHeight(); final int[] pixels = new int[width * height]; @@ -200,6 +201,7 @@ public class BarcodeProvider extends ContentProvider implements ServiceConnectio bitmap.setPixels(pixels, 0, width, 0, 0, width, height); return bitmap; } catch (final Exception e) { + e.printStackTrace(); return null; } } diff --git a/src/main/java/eu/siacs/conversations/ui/XmppActivity.java b/src/main/java/eu/siacs/conversations/ui/XmppActivity.java index ac3216e2..851eb9ab 100644 --- a/src/main/java/eu/siacs/conversations/ui/XmppActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/XmppActivity.java @@ -52,18 +52,12 @@ import android.widget.EditText; import android.widget.ImageView; import android.widget.Toast; -import com.google.zxing.BarcodeFormat; -import com.google.zxing.EncodeHintType; -import com.google.zxing.aztec.AztecWriter; -import com.google.zxing.common.BitMatrix; - import net.java.otr4j.session.SessionID; import java.io.FileNotFoundException; import java.lang.ref.WeakReference; import java.util.ArrayList; import java.util.Collections; -import java.util.Hashtable; import java.util.List; import java.util.Map; import java.util.concurrent.RejectedExecutionException; @@ -1059,7 +1053,7 @@ public abstract class XmppActivity extends Activity { Point size = new Point(); getWindowManager().getDefaultDisplay().getSize(size); final int width = (size.x < size.y ? size.x : size.y); - Bitmap bitmap = BarcodeProvider.createAztecBitmap(uri, width); + Bitmap bitmap = BarcodeProvider.create2dBarcodeBitmap(uri, width); ImageView view = new ImageView(this); view.setBackgroundColor(Color.WHITE); view.setImageBitmap(bitmap); diff --git a/src/main/res/values-eu/strings.xml b/src/main/res/values-eu/strings.xml index be458ab8..bf359888 100644 --- a/src/main/res/values-eu/strings.xml +++ b/src/main/res/values-eu/strings.xml @@ -176,6 +176,7 @@ Zure kontua ezabatzen baduzu zure elkarrizketa historia guztia galduko da Ahotsa grabatu Jabber IDa + Jabber IDa blokeatu Pasahitza erabiltzailea@adibidea.com Pasahitza berretsi @@ -470,6 +471,8 @@ Kontua ezgaitu %s idazten ari da... %s(e)k idazteari utzi dio + %s idazten ari dira… + %s idazteari utzi diote Idazketa jakinarazpenak Zure kontaktuak mezu berri bat noiz idazten ari zaren jakin dezaten baimendu Kokapena partekatu @@ -700,4 +703,9 @@ Mezua enkriptatzen Mezurik ez eskuratzen gelditze tarte lokalarengatik. Bideoa konprimatzen (%s%% osatua) + Dagokion elkarrizketa itxi egin da. + Kontaktua blokeatu da. + Ezezagunen jakinarazpenak + Ezezagunen mezuak jasotzerakoan jakinarazi. + Ezezagun baten mezu bat jaso duzu