diff options
Diffstat (limited to 'src/main/java/de')
-rw-r--r-- | src/main/java/de/pixart/messenger/ui/EditAccountActivity.java | 35 |
1 files changed, 34 insertions, 1 deletions
diff --git a/src/main/java/de/pixart/messenger/ui/EditAccountActivity.java b/src/main/java/de/pixart/messenger/ui/EditAccountActivity.java index be4222e78..681e561c9 100644 --- a/src/main/java/de/pixart/messenger/ui/EditAccountActivity.java +++ b/src/main/java/de/pixart/messenger/ui/EditAccountActivity.java @@ -9,6 +9,8 @@ import android.content.IntentSender; import android.content.SharedPreferences; import android.databinding.DataBindingUtil; import android.graphics.Bitmap; +import android.graphics.Color; +import android.graphics.Point; import android.net.Uri; import android.os.Bundle; import android.os.Handler; @@ -834,7 +836,6 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat intent.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); intent.setType("image/png"); startActivity(Intent.createChooser(intent, getText(R.string.share_with))); - } private void changeMoreTableVisibility(boolean visible) { @@ -1097,6 +1098,22 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat Toast.LENGTH_SHORT).show(); } }); + this.binding.actionShowQrCode.setVisibility(View.VISIBLE); + this.binding.actionShowQrCode.setOnClickListener(v -> { + if (otrFingerprint == null || otrFingerprint.isEmpty()) { + return; + } + Point size = new Point(); + getWindowManager().getDefaultDisplay().getSize(size); + final int width = (size.x < size.y ? size.x : size.y); + Bitmap bitmap = BarcodeProvider.create2dBarcodeBitmap(otrFingerprint, width); + ImageView view = new ImageView(this); + view.setBackgroundColor(Color.WHITE); + view.setImageBitmap(bitmap); + AlertDialog.Builder builder = new AlertDialog.Builder(this); + builder.setView(view); + builder.create().show(); + }); } else { this.binding.otrFingerprintBox.setVisibility(View.GONE); } @@ -1113,6 +1130,22 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat this.binding.axolotlFingerprint.setText(CryptoHelper.prettifyFingerprint(ownAxolotlFingerprint.substring(2))); this.binding.actionCopyAxolotlToClipboard.setVisibility(View.VISIBLE); this.binding.actionCopyAxolotlToClipboard.setOnClickListener(v -> copyOmemoFingerprint(ownAxolotlFingerprint)); + this.binding.actionShowAxoloqrCode.setVisibility(View.VISIBLE); + this.binding.actionShowAxoloqrCode.setOnClickListener(v -> { + if (otrFingerprint == null || otrFingerprint.isEmpty()) { + return; + } + Point size = new Point(); + getWindowManager().getDefaultDisplay().getSize(size); + final int width = (size.x < size.y ? size.x : size.y); + Bitmap bitmap = BarcodeProvider.create2dBarcodeBitmap(ownAxolotlFingerprint, width); + ImageView view = new ImageView(this); + view.setBackgroundColor(Color.WHITE); + view.setImageBitmap(bitmap); + AlertDialog.Builder builder = new AlertDialog.Builder(this); + builder.setView(view); + builder.create().show(); + }); } else { this.binding.axolotlFingerprintBox.setVisibility(View.GONE); } |