From 149875654ca0f6e5f4cb51ccb564f637b11f9c9d Mon Sep 17 00:00:00 2001 From: Christian Schneppe Date: Tue, 20 Mar 2018 20:25:30 +0100 Subject: create dedicated button to enable undecided accounts --- art/md_switch_thumb_disable.svg | 67 --------------------- art/md_switch_thumb_off_normal.svg | 63 ------------------- art/md_switch_thumb_off_pressed.svg | 66 -------------------- art/md_switch_thumb_on_normal.svg | 61 ------------------- art/md_switch_thumb_on_pressed.svg | 70 ---------------------- art/render.rb | 5 -- .../java/de/pixart/messenger/ui/OmemoActivity.java | 12 ++-- src/main/res/layout/activity_muc_details.xml | 2 +- src/main/res/layout/contact.xml | 2 +- src/main/res/layout/contact_key.xml | 19 ++++-- src/main/res/values/attrs.xml | 3 + src/main/res/values/dimens.xml | 3 + src/main/res/values/themes.xml | 2 + 13 files changed, 30 insertions(+), 345 deletions(-) delete mode 100644 art/md_switch_thumb_disable.svg delete mode 100644 art/md_switch_thumb_off_normal.svg delete mode 100644 art/md_switch_thumb_off_pressed.svg delete mode 100644 art/md_switch_thumb_on_normal.svg delete mode 100644 art/md_switch_thumb_on_pressed.svg diff --git a/art/md_switch_thumb_disable.svg b/art/md_switch_thumb_disable.svg deleted file mode 100644 index 6639218fa..000000000 --- a/art/md_switch_thumb_disable.svg +++ /dev/null @@ -1,67 +0,0 @@ - - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/art/md_switch_thumb_off_normal.svg b/art/md_switch_thumb_off_normal.svg deleted file mode 100644 index 9c86e37d3..000000000 --- a/art/md_switch_thumb_off_normal.svg +++ /dev/null @@ -1,63 +0,0 @@ - - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/art/md_switch_thumb_off_pressed.svg b/art/md_switch_thumb_off_pressed.svg deleted file mode 100644 index fecb6bc2d..000000000 --- a/art/md_switch_thumb_off_pressed.svg +++ /dev/null @@ -1,66 +0,0 @@ - - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/art/md_switch_thumb_on_normal.svg b/art/md_switch_thumb_on_normal.svg deleted file mode 100644 index 8b66115e2..000000000 --- a/art/md_switch_thumb_on_normal.svg +++ /dev/null @@ -1,61 +0,0 @@ - - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/art/md_switch_thumb_on_pressed.svg b/art/md_switch_thumb_on_pressed.svg deleted file mode 100644 index 90d14cbe4..000000000 --- a/art/md_switch_thumb_on_pressed.svg +++ /dev/null @@ -1,70 +0,0 @@ - - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/art/render.rb b/art/render.rb index 260c7dc24..6b075b1ec 100755 --- a/art/render.rb +++ b/art/render.rb @@ -43,11 +43,6 @@ images = { 'ic_send_picture_away.svg' => ['ic_send_picture_away', 36], 'ic_send_picture_dnd.svg' => ['ic_send_picture_dnd', 36], 'ic_verified_fingerprint.svg' => ['ic_verified_fingerprint', 36], - 'md_switch_thumb_disable.svg' => ['switch_thumb_disable', 48], - 'md_switch_thumb_off_normal.svg' => ['switch_thumb_off_normal', 48], - 'md_switch_thumb_off_pressed.svg' => ['switch_thumb_off_pressed', 48], - 'md_switch_thumb_on_normal.svg' => ['switch_thumb_on_normal', 48], - 'md_switch_thumb_on_pressed.svg' => ['switch_thumb_on_pressed', 48], 'message_bubble_received.svg' => ['message_bubble_received.9', 0], 'message_bubble_received_warning.svg' => ['message_bubble_received_warning.9', 0], 'message_bubble_received_white.svg' => ['message_bubble_received_white.9', 0], diff --git a/src/main/java/de/pixart/messenger/ui/OmemoActivity.java b/src/main/java/de/pixart/messenger/ui/OmemoActivity.java index e304a64ee..95b521086 100644 --- a/src/main/java/de/pixart/messenger/ui/OmemoActivity.java +++ b/src/main/java/de/pixart/messenger/ui/OmemoActivity.java @@ -1,7 +1,6 @@ package de.pixart.messenger.ui; -import android.content.DialogInterface; import android.content.Intent; import android.os.Bundle; import android.support.v4.content.ContextCompat; @@ -11,6 +10,7 @@ import android.view.ContextMenu; import android.view.MenuItem; import android.view.View; import android.widget.CompoundButton; +import android.widget.ImageButton; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.TextView; @@ -131,6 +131,7 @@ public abstract class OmemoActivity extends XmppActivity { View view = getLayoutInflater().inflate(R.layout.contact_key, keys, false); TextView key = view.findViewById(R.id.key); TextView keyType = view.findViewById(R.id.key_type); + ImageButton enableUndecided = view.findViewById(R.id.button_enable_device); if (Config.X509_VERIFICATION && status.getTrust() == FingerprintStatus.Trust.VERIFIED_X509) { key.setOnClickListener(v -> showX509Certificate(account, fingerprint)); keyType.setOnClickListener(v -> showX509Certificate(account, fingerprint)); @@ -160,12 +161,13 @@ public abstract class OmemoActivity extends XmppActivity { trustToggle.setVisibility(View.VISIBLE); trustToggle.setOnCheckedChangeListener(onCheckedChangeListener); if (status.getTrust() == FingerprintStatus.Trust.UNDECIDED && undecidedNeedEnablement) { - trustToggle.setOnClickListener(v -> { + enableUndecided.setVisibility(View.VISIBLE); + enableUndecided.setOnClickListener(v -> { account.getAxolotlService().setFingerprintTrust(fingerprint, FingerprintStatus.createActive(false)); - v.setEnabled(true); - v.setOnClickListener(null); + enableUndecided.setVisibility(View.GONE); + trustToggle.setVisibility(View.VISIBLE); }); - trustToggle.setEnabled(false); + trustToggle.setVisibility(View.GONE); } else { trustToggle.setOnClickListener(null); trustToggle.setEnabled(true); diff --git a/src/main/res/layout/activity_muc_details.xml b/src/main/res/layout/activity_muc_details.xml index 5dfe75458..35a779cf4 100644 --- a/src/main/res/layout/activity_muc_details.xml +++ b/src/main/res/layout/activity_muc_details.xml @@ -147,7 +147,7 @@ android:layout_centerVertical="true" android:layout_toRightOf="@+id/your_photo" android:orientation="vertical" - android:paddingLeft="8dp"> + android:paddingLeft="@dimen/avatar_item_distance"> + android:paddingLeft="@dimen/avatar_item_distance" > @@ -59,18 +60,25 @@ android:id="@+id/button_remove" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_gravity="center_horizontal" android:background="?attr/selectableItemBackgroundBorderless" android:padding="@dimen/image_button_padding" android:src="?attr/icon_remove" android:visibility="gone" /> + + @@ -81,7 +89,6 @@ android:layout_height="wrap_content" android:layout_alignParentRight="true" android:layout_centerVertical="true" - android:layout_gravity="center_horizontal" android:visibility="gone" /> diff --git a/src/main/res/values/attrs.xml b/src/main/res/values/attrs.xml index 208a60cfb..f9bdae03a 100644 --- a/src/main/res/values/attrs.xml +++ b/src/main/res/values/attrs.xml @@ -37,6 +37,7 @@ + @@ -57,5 +58,7 @@ + + \ No newline at end of file diff --git a/src/main/res/values/dimens.xml b/src/main/res/values/dimens.xml index 810feee69..933c7daea 100644 --- a/src/main/res/values/dimens.xml +++ b/src/main/res/values/dimens.xml @@ -6,5 +6,8 @@ 8dp 8dp 12dp + 48dp + 11sp 224dp + 16dp diff --git a/src/main/res/values/themes.xml b/src/main/res/values/themes.xml index 7c433f720..b70fe0bd7 100644 --- a/src/main/res/values/themes.xml +++ b/src/main/res/values/themes.xml @@ -49,8 +49,10 @@ @drawable/ic_import_export_white_24dp @drawable/ic_share_white_24dp @drawable/ic_barcode_scan_white_24dp + @drawable/ic_new_releases_black_24dp 16dp 16dp + 0.54 @drawable/ic_attach_camera @drawable/ic_attach_document -- cgit v1.2.3