diff options
14 files changed, 79 insertions, 10 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); } diff --git a/src/main/res/drawable-hdpi/ic_qrcode_grey600_24dp.png b/src/main/res/drawable-hdpi/ic_qrcode_grey600_24dp.png Binary files differnew file mode 100644 index 000000000..5114bbd0d --- /dev/null +++ b/src/main/res/drawable-hdpi/ic_qrcode_grey600_24dp.png diff --git a/src/main/res/drawable-hdpi/ic_qrcode_white_24dp.png b/src/main/res/drawable-hdpi/ic_qrcode_white_24dp.png Binary files differnew file mode 100644 index 000000000..cf8d6a8c9 --- /dev/null +++ b/src/main/res/drawable-hdpi/ic_qrcode_white_24dp.png diff --git a/src/main/res/drawable-mdpi/ic_qrcode_grey600_24dp.png b/src/main/res/drawable-mdpi/ic_qrcode_grey600_24dp.png Binary files differnew file mode 100644 index 000000000..24cb66d42 --- /dev/null +++ b/src/main/res/drawable-mdpi/ic_qrcode_grey600_24dp.png diff --git a/src/main/res/drawable-mdpi/ic_qrcode_white_24dp.png b/src/main/res/drawable-mdpi/ic_qrcode_white_24dp.png Binary files differnew file mode 100644 index 000000000..7e28f95dc --- /dev/null +++ b/src/main/res/drawable-mdpi/ic_qrcode_white_24dp.png diff --git a/src/main/res/drawable-xhdpi/ic_qrcode_grey600_24dp.png b/src/main/res/drawable-xhdpi/ic_qrcode_grey600_24dp.png Binary files differnew file mode 100644 index 000000000..3a100a3ed --- /dev/null +++ b/src/main/res/drawable-xhdpi/ic_qrcode_grey600_24dp.png diff --git a/src/main/res/drawable-xhdpi/ic_qrcode_white_24dp.png b/src/main/res/drawable-xhdpi/ic_qrcode_white_24dp.png Binary files differnew file mode 100644 index 000000000..fcb2de2c3 --- /dev/null +++ b/src/main/res/drawable-xhdpi/ic_qrcode_white_24dp.png diff --git a/src/main/res/drawable-xxhdpi/ic_qrcode_grey600_24dp.png b/src/main/res/drawable-xxhdpi/ic_qrcode_grey600_24dp.png Binary files differnew file mode 100644 index 000000000..1ff70a5c8 --- /dev/null +++ b/src/main/res/drawable-xxhdpi/ic_qrcode_grey600_24dp.png diff --git a/src/main/res/drawable-xxhdpi/ic_qrcode_white_24dp.png b/src/main/res/drawable-xxhdpi/ic_qrcode_white_24dp.png Binary files differnew file mode 100644 index 000000000..2928df951 --- /dev/null +++ b/src/main/res/drawable-xxhdpi/ic_qrcode_white_24dp.png diff --git a/src/main/res/drawable-xxxhdpi/ic_qrcode_grey600_24dp.png b/src/main/res/drawable-xxxhdpi/ic_qrcode_grey600_24dp.png Binary files differnew file mode 100644 index 000000000..ccd1ac6b7 --- /dev/null +++ b/src/main/res/drawable-xxxhdpi/ic_qrcode_grey600_24dp.png diff --git a/src/main/res/drawable-xxxhdpi/ic_qrcode_white_24dp.png b/src/main/res/drawable-xxxhdpi/ic_qrcode_white_24dp.png Binary files differnew file mode 100644 index 000000000..3ec200f7a --- /dev/null +++ b/src/main/res/drawable-xxxhdpi/ic_qrcode_white_24dp.png diff --git a/src/main/res/layout/activity_edit_account.xml b/src/main/res/layout/activity_edit_account.xml index 342d748f0..2bfdf784c 100644 --- a/src/main/res/layout/activity_edit_account.xml +++ b/src/main/res/layout/activity_edit_account.xml @@ -557,8 +557,10 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentLeft="true" + android:layout_alignParentStart="true" android:layout_centerVertical="true" - android:layout_toLeftOf="@+id/action_copy_to_clipboard" + android:layout_toLeftOf="@+id/key_actions" + android:layout_toStartOf="@+id/key_actions" android:orientation="vertical"> <TextView @@ -576,17 +578,35 @@ </LinearLayout> - <ImageButton - android:id="@+id/action_copy_to_clipboard" + <LinearLayout + android:id="@+id/key_actions" android:layout_width="wrap_content" android:layout_height="wrap_content" + android:layout_alignParentEnd="true" android:layout_alignParentRight="true" android:layout_centerVertical="true" - android:background="?attr/selectableItemBackgroundBorderless" - android:contentDescription="@string/copy_otr_clipboard_description" - android:padding="@dimen/image_button_padding" - android:src="?attr/icon_copy" - android:visibility="visible" /> + android:orientation="horizontal"> + + <ImageButton + android:id="@+id/action_copy_to_clipboard" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:background="?attr/selectableItemBackgroundBorderless" + android:contentDescription="@string/copy_otr_clipboard_description" + android:padding="@dimen/image_button_padding" + android:src="?attr/icon_copy" + android:visibility="visible" /> + + <ImageButton + android:id="@+id/action_show_qr_code" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:background="?attr/selectableItemBackgroundBorderless" + android:contentDescription="@string/show_qr_code" + android:padding="@dimen/image_button_padding" + android:src="?attr/icon_show_qr_code" + android:visibility="visible" /> + </LinearLayout> </RelativeLayout> <RelativeLayout @@ -599,8 +619,10 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentLeft="true" + android:layout_alignParentStart="true" android:layout_centerVertical="true" android:layout_toLeftOf="@+id/axolotl_actions" + android:layout_toStartOf="@+id/axolotl_actions" android:orientation="vertical"> <TextView @@ -620,9 +642,10 @@ android:id="@+id/axolotl_actions" android:layout_width="wrap_content" android:layout_height="wrap_content" + android:layout_alignParentEnd="true" android:layout_alignParentRight="true" android:layout_centerVertical="true" - android:orientation="vertical"> + android:orientation="horizontal"> <ImageButton android:id="@+id/action_copy_axolotl_to_clipboard" @@ -635,6 +658,16 @@ android:visibility="visible" /> <ImageButton + android:id="@+id/action_show_axoloqr_code" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:background="?attr/selectableItemBackgroundBorderless" + android:contentDescription="@string/copy_omemo_clipboard_description" + android:padding="@dimen/image_button_padding" + android:src="?attr/icon_show_qr_code" + android:visibility="visible" /> + + <ImageButton android:id="@+id/action_regenerate_omemo_key" android:layout_width="wrap_content" android:layout_height="wrap_content" diff --git a/src/main/res/values/attrs.xml b/src/main/res/values/attrs.xml index 672cb00fb..284e7d74b 100644 --- a/src/main/res/values/attrs.xml +++ b/src/main/res/values/attrs.xml @@ -58,6 +58,7 @@ <attr name="icon_chat" format="reference" /> <attr name="icon_copy" format="reference" /> <attr name="icon_discard" format="reference" /> + <attr name="icon_show_qr_code" format="reference" /> <attr name="icon_download" format="reference" /> <attr name="icon_edit" format="reference" /> <attr name="icon_edit_body" format="reference" /> diff --git a/src/main/res/values/themes.xml b/src/main/res/values/themes.xml index bbfaf6060..96a179311 100644 --- a/src/main/res/values/themes.xml +++ b/src/main/res/values/themes.xml @@ -80,6 +80,7 @@ <item name="icon_cancel" type="reference">@drawable/ic_cancel_black_24dp</item> <item name="icon_chat" type="reference">@drawable/ic_action_chat</item> <item name="icon_copy" type="reference">@drawable/ic_content_copy_grey600_24dp</item> + <item name="icon_show_qr_code" type="reference">@drawable/ic_qrcode_grey600_24dp</item> <item name="icon_discard" type="reference">@drawable/ic_delete_white_24dp</item> <item name="icon_download" type="reference">@drawable/ic_file_download_white_24dp</item> <item name="icon_edit" type="reference">@drawable/ic_edit_white_24dp</item> @@ -251,6 +252,7 @@ <item name="icon_add_person" type="reference">@drawable/ic_person_add_white_24dp</item> <item name="icon_cancel" type="reference">@drawable/ic_cancel_white_24dp</item> <item name="icon_copy" type="reference">@drawable/ic_content_copy_white_24dp</item> + <item name="icon_show_qr_code" type="reference">@drawable/ic_qrcode_white_24dp</item> <item name="icon_discard" type="reference">@drawable/ic_delete_white_24dp</item> <item name="icon_download" type="reference">@drawable/ic_file_download_white_24dp</item> <item name="icon_edit" type="reference">@drawable/ic_edit_white_24dp</item> |