aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorChristian Schneppe <christian@pix-art.de>2018-03-20 20:25:30 +0100
committerChristian Schneppe <christian@pix-art.de>2018-03-20 20:25:30 +0100
commit149875654ca0f6e5f4cb51ccb564f637b11f9c9d (patch)
tree08a590415bf31a670d6ec9b5116a545cef863eb9 /src
parent1eb3d7c971d9a8b8316f533eb454a2427bef455b (diff)
create dedicated button to enable undecided accounts
Diffstat (limited to 'src')
-rw-r--r--src/main/java/de/pixart/messenger/ui/OmemoActivity.java12
-rw-r--r--src/main/res/layout/activity_muc_details.xml2
-rw-r--r--src/main/res/layout/contact.xml2
-rw-r--r--src/main/res/layout/contact_key.xml19
-rw-r--r--src/main/res/values/attrs.xml3
-rw-r--r--src/main/res/values/dimens.xml3
-rw-r--r--src/main/res/values/themes.xml2
7 files changed, 30 insertions, 13 deletions
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.support.text.emoji.widget.EmojiTextView
android:id="@+id/muc_your_nick"
diff --git a/src/main/res/layout/contact.xml b/src/main/res/layout/contact.xml
index 159b1256a..c414271ab 100644
--- a/src/main/res/layout/contact.xml
+++ b/src/main/res/layout/contact.xml
@@ -21,7 +21,7 @@
android:layout_centerVertical="true"
android:layout_toRightOf="@+id/contact_photo"
android:orientation="vertical"
- android:paddingLeft="16dp">
+ android:paddingLeft="@dimen/avatar_item_distance" >
<android.support.text.emoji.widget.EmojiTextView
android:id="@+id/contact_display_name"
diff --git a/src/main/res/layout/contact_key.xml b/src/main/res/layout/contact_key.xml
index e276fc047..77b26f70d 100644
--- a/src/main/res/layout/contact_key.xml
+++ b/src/main/res/layout/contact_key.xml
@@ -49,9 +49,10 @@
<LinearLayout
android:id="@+id/action_container"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
+ android:layout_width="@dimen/key_action_width"
+ android:layout_height="48dp"
android:layout_alignParentRight="true"
+ android:gravity="center"
android:layout_centerVertical="true"
android:orientation="vertical">
@@ -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" />
+ <ImageButton
+ android:id="@+id/button_enable_device"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:alpha="?attr/icon_alpha"
+ android:background="?attr/selectableItemBackgroundBorderless"
+ android:padding="@dimen/image_button_padding"
+ android:src="?attr/icon_enable_undecided_device"
+ android:visibility="gone" />
+
<ImageView
android:id="@+id/verified_fingerprint"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:layout_gravity="center_horizontal"
- android:padding="@dimen/image_button_padding"
android:src="@drawable/ic_verified_fingerprint"
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" />
</LinearLayout>
</RelativeLayout>
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 @@
<attr name="icon_share" format="reference" />
<attr name="icon_import_export" format="reference" />
<attr name="icon_scan_qr_code" format="reference" />
+ <attr name="icon_enable_undecided_device" format="reference" />
<attr name="icon_notifications" format="reference" />
<attr name="icon_notifications_off" format="reference" />
@@ -57,5 +58,7 @@
<attr name="ic_file_pdf" format="reference" />
<attr name="ic_file_vcard" format="reference" />
<attr name="ic_file_calendar" format="reference" />
+
+ <attr name="icon_alpha" format="float"/>
</resources> \ 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 @@
<dimen name="card_padding_list">8dp</dimen> <!-- card_padding_regular minus list_padding -->
<dimen name="list_padding">8dp</dimen>
<dimen name="image_button_padding">12dp</dimen>
+ <dimen name="key_action_width">48dp</dimen> <!-- icon width (24dp) + 2 * image button padding -->
+ <dimen name="fineprint_size">11sp</dimen>
<dimen name="audio_player_width">224dp</dimen>
+ <dimen name="avatar_item_distance">16dp</dimen>
</resources>
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 @@
<item name="icon_import_export">@drawable/ic_import_export_white_24dp</item>
<item name="icon_share">@drawable/ic_share_white_24dp</item>
<item name="icon_scan_qr_code">@drawable/ic_barcode_scan_white_24dp</item>
+ <item type="reference" name="icon_enable_undecided_device">@drawable/ic_new_releases_black_24dp</item>
<item name="dialog_horizontal_padding">16dp</item>
<item name="dialog_vertical_padding">16dp</item>
+ <item type="float" name="icon_alpha">0.54</item>
<item name="ic_attach_camera">@drawable/ic_attach_camera</item>
<item name="ic_attach_document">@drawable/ic_attach_document</item>