diff options
author | Christian Schneppe <christian@pix-art.de> | 2018-10-03 23:38:46 +0200 |
---|---|---|
committer | Christian Schneppe <christian@pix-art.de> | 2018-10-03 23:38:46 +0200 |
commit | 5ec3a3c508b3a4658047f4406aab2f68a63cdb80 (patch) | |
tree | f6d399f5fd4c3d06df3bf014052a1369c16be159 /src/main | |
parent | bd711e24581408c87e2230ffb6e9d2c7518ea4c9 (diff) |
reworked shortcut for QR-Code scanning in profile
fixes #190
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/de/pixart/messenger/ui/EditAccountActivity.java | 35 | ||||
-rw-r--r-- | src/main/java/de/pixart/messenger/utils/XmppUri.java | 2 | ||||
-rw-r--r-- | src/main/res/layout/activity_edit_account.xml | 60 | ||||
-rw-r--r-- | src/main/res/menu/editaccount.xml | 48 |
4 files changed, 48 insertions, 97 deletions
diff --git a/src/main/java/de/pixart/messenger/ui/EditAccountActivity.java b/src/main/java/de/pixart/messenger/ui/EditAccountActivity.java index 681e561c9..bc1fcce7a 100644 --- a/src/main/java/de/pixart/messenger/ui/EditAccountActivity.java +++ b/src/main/java/de/pixart/messenger/ui/EditAccountActivity.java @@ -9,8 +9,6 @@ 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; @@ -75,6 +73,7 @@ import de.pixart.messenger.xmpp.XmppConnection.Features; import de.pixart.messenger.xmpp.forms.Data; import de.pixart.messenger.xmpp.pep.Avatar; import rocks.xmpp.addr.Jid; + public class EditAccountActivity extends OmemoActivity implements OnAccountUpdate, OnUpdateBlocklist, OnKeyStatusUpdated, OnCaptchaRequested, KeyChainAliasCallback, XmppConnectionService.OnShowErrorToast, XmppConnectionService.OnMamPreferencesFetched { @@ -1098,22 +1097,6 @@ 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); } @@ -1130,22 +1113,6 @@ 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/java/de/pixart/messenger/utils/XmppUri.java b/src/main/java/de/pixart/messenger/utils/XmppUri.java index db0002a29..a44c9a174 100644 --- a/src/main/java/de/pixart/messenger/utils/XmppUri.java +++ b/src/main/java/de/pixart/messenger/utils/XmppUri.java @@ -22,7 +22,7 @@ public class XmppUri { private String name; private String action; private boolean safeSource = true; - private static final String OMEMO_URI_PARAM = "omemo-sid-"; + public static final String OMEMO_URI_PARAM = "omemo-sid-"; private static final String OTR_URI_PARAM = "otr-fingerprint"; public static final String ACTION_JOIN = "join"; public static final String ACTION_MESSAGE = "message"; diff --git a/src/main/res/layout/activity_edit_account.xml b/src/main/res/layout/activity_edit_account.xml index 2bfdf784c..b8c48a382 100644 --- a/src/main/res/layout/activity_edit_account.xml +++ b/src/main/res/layout/activity_edit_account.xml @@ -29,10 +29,10 @@ android:id="@+id/editor" android:layout_width="fill_parent" android:layout_height="wrap_content" - android:layout_marginBottom="@dimen/activity_vertical_margin" android:layout_marginLeft="@dimen/activity_horizontal_margin" - android:layout_marginRight="@dimen/activity_horizontal_margin" android:layout_marginTop="@dimen/activity_vertical_margin" + android:layout_marginRight="@dimen/activity_horizontal_margin" + android:layout_marginBottom="@dimen/activity_vertical_margin" android:orientation="vertical" android:padding="@dimen/card_padding_regular" card_view:cardBackgroundColor="?attr/color_background_secondary"> @@ -51,8 +51,8 @@ android:layout_marginBottom="@dimen/avatar_item_distance" android:adjustViewBounds="true" android:contentDescription="@string/account_image_description" - android:maxHeight="384dp" android:maxWidth="384dp" + android:maxHeight="384dp" android:padding="1dp" app:riv_border_color="?attr/color_border" app:riv_border_width="1dp" @@ -179,8 +179,8 @@ android:layout_height="wrap_content" android:layout_centerHorizontal="true" android:layout_gravity="center_horizontal" - android:layout_marginBottom="4dp" android:layout_marginTop="4dp" + android:layout_marginBottom="4dp" android:text="@string/show_privacy" android:visibility="gone" /> @@ -190,8 +190,8 @@ android:layout_height="wrap_content" android:layout_centerHorizontal="true" android:layout_gravity="center_horizontal" - android:layout_marginBottom="4dp" android:layout_marginTop="4dp" + android:layout_marginBottom="4dp" android:text="@string/show_termsofuse" android:visibility="gone" /> </LinearLayout> @@ -202,10 +202,10 @@ android:id="@+id/os_optimization" android:layout_width="fill_parent" android:layout_height="wrap_content" - android:layout_marginBottom="@dimen/activity_vertical_margin" android:layout_marginLeft="@dimen/activity_horizontal_margin" - android:layout_marginRight="@dimen/activity_horizontal_margin" android:layout_marginTop="@dimen/activity_vertical_margin" + android:layout_marginRight="@dimen/activity_horizontal_margin" + android:layout_marginBottom="@dimen/activity_vertical_margin" android:visibility="gone" card_view:cardBackgroundColor="?attr/color_background_secondary"> @@ -260,10 +260,10 @@ android:id="@+id/stats" android:layout_width="fill_parent" android:layout_height="fill_parent" - android:layout_marginBottom="@dimen/activity_vertical_margin" android:layout_marginLeft="@dimen/activity_horizontal_margin" - android:layout_marginRight="@dimen/activity_horizontal_margin" android:layout_marginTop="@dimen/activity_vertical_margin" + android:layout_marginRight="@dimen/activity_horizontal_margin" + android:layout_marginBottom="@dimen/activity_vertical_margin" android:background="@drawable/infocard_border" android:orientation="vertical" android:padding="@dimen/card_padding_regular" @@ -556,11 +556,11 @@ <LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_alignParentLeft="true" android:layout_alignParentStart="true" + android:layout_alignParentLeft="true" android:layout_centerVertical="true" - android:layout_toLeftOf="@+id/key_actions" android:layout_toStartOf="@+id/key_actions" + android:layout_toLeftOf="@+id/key_actions" android:orientation="vertical"> <TextView @@ -596,16 +596,6 @@ 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> @@ -618,11 +608,11 @@ <LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_alignParentLeft="true" android:layout_alignParentStart="true" + android:layout_alignParentLeft="true" android:layout_centerVertical="true" - android:layout_toLeftOf="@+id/axolotl_actions" android:layout_toStartOf="@+id/axolotl_actions" + android:layout_toLeftOf="@+id/axolotl_actions" android:orientation="vertical"> <TextView @@ -658,16 +648,6 @@ 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" @@ -685,10 +665,10 @@ android:id="@+id/other_device_keys_card" android:layout_width="fill_parent" android:layout_height="wrap_content" - android:layout_marginBottom="@dimen/activity_vertical_margin" android:layout_marginLeft="@dimen/activity_horizontal_margin" - android:layout_marginRight="@dimen/activity_horizontal_margin" android:layout_marginTop="@dimen/activity_vertical_margin" + android:layout_marginRight="@dimen/activity_horizontal_margin" + android:layout_marginBottom="@dimen/activity_vertical_margin" android:visibility="gone" card_view:cardBackgroundColor="?attr/color_background_secondary"> @@ -729,11 +709,11 @@ android:id="@+id/button_bar" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_alignParentBottom="true" - android:layout_alignParentEnd="true" + android:layout_alignParentStart="true" android:layout_alignParentLeft="true" + android:layout_alignParentEnd="true" android:layout_alignParentRight="true" - android:layout_alignParentStart="true"> + android:layout_alignParentBottom="true"> <Button android:id="@+id/cancel_button" @@ -746,8 +726,8 @@ <View android:layout_width="1dp" android:layout_height="fill_parent" - android:layout_marginBottom="7dp" - android:layout_marginTop="7dp" /> + android:layout_marginTop="7dp" + android:layout_marginBottom="7dp" /> <Button android:id="@+id/save_button" diff --git a/src/main/res/menu/editaccount.xml b/src/main/res/menu/editaccount.xml index cbdde1fce..09919b9fe 100644 --- a/src/main/res/menu/editaccount.xml +++ b/src/main/res/menu/editaccount.xml @@ -5,11 +5,12 @@ android:id="@+id/action_change_presence" android:icon="@drawable/ic_new_releases_white_24dp" android:title="@string/edit_status_message" - app:showAsAction="always" /> + app:showAsAction="ifRoom" /> - <item android:id="@+id/action_share" - android:title="@string/share_uri_with" + <item + android:id="@+id/action_share" android:icon="@drawable/ic_share_white_24dp" + android:title="@string/share_uri_with" app:showAsAction="always"> <menu> <item @@ -21,57 +22,60 @@ <item android:id="@+id/action_share_barcode" android:title="@string/share_as_barcode" /> - <item - android:id="@+id/action_show_qr_code" - android:title="@string/show_qr_code" /> </menu> </item> <item + android:id="@+id/action_show_qr_code" + android:icon="@drawable/ic_qrcode_white_24dp" + android:title="@string/show_qr_code" + app:showAsAction="always" /> + + <item android:id="@+id/action_show_block_list" - app:showAsAction="always" android:icon="@drawable/ic_speaker_notes_off_white_24dp" - android:title="@string/show_block_list" /> + android:title="@string/show_block_list" + app:showAsAction="ifRoom" /> <item android:id="@+id/action_renew_certificate" - app:showAsAction="never" android:title="@string/action_renew_certificate" - android:visible="false" /> + android:visible="false" + app:showAsAction="never" /> <item android:id="@+id/action_server_info_show_more" android:checkable="true" android:checked="false" - app:showAsAction="never" - android:title="@string/server_info_show_more" /> + android:title="@string/server_info_show_more" + app:showAsAction="never" /> <item android:id="@+id/action_mam_prefs" android:icon="@drawable/ic_cloud_white_24dp" - app:showAsAction="always" - android:title="@string/mam_prefs" /> + android:title="@string/mam_prefs" + app:showAsAction="ifRoom" /> <item android:id="@+id/action_show_password" - app:showAsAction="never" - android:title="@string/show_password" /> + android:title="@string/show_password" + app:showAsAction="never" /> <item android:id="@+id/action_change_password_on_server" - app:showAsAction="always" android:icon="@drawable/ic_vpn_key_white_24dp" - android:title="@string/change_password" /> + android:title="@string/change_password" + app:showAsAction="ifRoom" /> <item android:id="@+id/mgmt_account_reconnect" - app:showAsAction="never" - android:title="@string/mgmt_account_reconnect" /> + android:title="@string/mgmt_account_reconnect" + app:showAsAction="never" /> <item android:id="@+id/mgmt_account_announce_pgp" android:title="@string/mgmt_account_publish_pgp" /> <item android:id="@+id/action_settings" android:orderInCategory="100" - app:showAsAction="never" - android:title="@string/action_settings" /> + android:title="@string/action_settings" + app:showAsAction="never" /> </menu>
\ No newline at end of file |