add scan action to contact details

Daniel Gultsch created

Change summary

src/main/java/eu/siacs/conversations/ui/ContactDetailsActivity.java |  4 
src/main/res/layout/activity_contact_details.xml                    | 42 
src/main/res/layout/activity_muc_details.xml                        | 37 
src/main/res/values/strings.xml                                     |  4 
4 files changed, 61 insertions(+), 26 deletions(-)

Detailed changes

src/main/java/eu/siacs/conversations/ui/ContactDetailsActivity.java 🔗

@@ -435,6 +435,10 @@ public class ContactDetailsActivity extends OmemoActivity implements OnAccountUp
 		} else {
 			binding.showInactiveDevices.setVisibility(View.GONE);
 		}
+		binding.scanButton.setVisibility(hasKeys ? View.VISIBLE : View.GONE);
+		if (hasKeys) {
+			binding.scanButton.setOnClickListener((v)-> ScanActivity.scan(this));
+		}
 		if (Config.supportOpenPgp() && contact.getPgpKeyId() != 0) {
 			hasKeys = true;
 			View view = inflater.inflate(R.layout.contact_key, binding.detailsContactKeys, false);

src/main/res/layout/activity_contact_details.xml 🔗

@@ -118,25 +118,45 @@
                 <LinearLayout
                     android:layout_width="match_parent"
                     android:layout_height="wrap_content"
-                    android:orientation="vertical"
-                    android:padding="@dimen/card_padding_list">
+                    android:orientation="vertical">
 
                     <LinearLayout
                         android:id="@+id/details_contact_keys"
-                        android:layout_width="fill_parent"
+                        android:layout_width="match_parent"
                         android:layout_height="wrap_content"
-                        android:orientation="vertical">
+                        android:orientation="vertical"
+                        android:padding="@dimen/card_padding_list">
                     </LinearLayout>
 
-                    <Button
-                        android:id="@+id/show_inactive_devices"
-                        style="?android:attr/borderlessButtonStyle"
+                    <LinearLayout
                         android:layout_width="wrap_content"
-                        android:layout_height="wrap_content"
-                        android:layout_gravity="center_horizontal"
+                        android:layout_height="match_parent"
                         android:layout_marginTop="8dp"
-                        android:text="@string/show_inactive_devices"
-                        android:textColor="@color/accent"/>
+                        android:orientation="horizontal">
+
+
+                        <Button
+                            android:id="@+id/scan_button"
+                            style="?android:attr/borderlessButtonStyle"
+                            android:layout_width="wrap_content"
+                            android:layout_height="wrap_content"
+                            android:paddingLeft="16dp"
+                            android:paddingRight="16dp"
+                            android:minWidth="0dp"
+                            android:text="@string/scan_qr_code"
+                            android:textColor="?attr/colorAccent"/>
+
+                        <Button
+                            android:id="@+id/show_inactive_devices"
+                            style="?android:attr/borderlessButtonStyle"
+                            android:layout_width="wrap_content"
+                            android:layout_height="wrap_content"
+                            android:paddingLeft="16dp"
+                            android:paddingRight="16dp"
+                            android:minWidth="0dp"
+                            android:text="@string/show_inactive_devices"
+                            android:textColor="?attr/colorAccent"/>
+                    </LinearLayout>
                 </LinearLayout>
             </android.support.v7.widget.CardView>
         </LinearLayout>

src/main/res/layout/activity_muc_details.xml 🔗

@@ -193,25 +193,36 @@
             <LinearLayout
                 android:layout_width="match_parent"
                 android:layout_height="wrap_content"
-                android:orientation="vertical"
-                android:padding="@dimen/card_padding_list">
+                android:orientation="vertical">
 
                 <LinearLayout
                     android:id="@+id/muc_members"
-                    android:layout_width="fill_parent"
-                    android:layout_height="0dp"
-                    android:layout_weight="1"
-                    android:orientation="vertical">
+                    android:layout_width="match_parent"
+                    android:layout_height="wrap_content"
+                    android:orientation="vertical"
+                    android:padding="@dimen/card_padding_list">
                 </LinearLayout>
 
-                <Button
-                    android:id="@+id/invite"
-                    style="?android:attr/buttonStyleSmall"
+                <LinearLayout
                     android:layout_width="wrap_content"
-                    android:layout_height="wrap_content"
-                    android:layout_gravity="center_horizontal"
-                    android:layout_marginTop="24dp"
-                    android:text="@string/invite_contact"/>
+                    android:layout_height="match_parent"
+                    android:layout_marginTop="8dp"
+                    android:orientation="horizontal"
+                    android:layout_gravity="center_horizontal">
+
+
+                    <Button
+                        android:id="@+id/invite"
+                        style="?android:attr/borderlessButtonStyle"
+                        android:layout_width="wrap_content"
+                        android:layout_height="wrap_content"
+                        android:minWidth="0dp"
+                        android:paddingLeft="16dp"
+                        android:paddingRight="16dp"
+                        android:text="@string/invite_contact"
+                        android:textColor="?attr/colorAccent"/>
+
+                </LinearLayout>
             </LinearLayout>
         </android.support.v7.widget.CardView>
 

src/main/res/values/strings.xml 🔗

@@ -691,8 +691,8 @@
 	<string name="i_followed_this_link_from_a_trusted_source">I followed this link from a trusted source</string>
 	<string name="verifying_omemo_keys_trusted_source">You are about to verify the OMEMO keys of %1$s after clicking a link. This is only secure if you followed this link from a trusted source where only %2$s could have published this link.</string>
 	<string name="verify_omemo_keys">Verify OMEMO keys</string>
-	<string name="show_inactive_devices">Show inactive devices</string>
-	<string name="hide_inactive_devices">Hide inactive devices</string>
+	<string name="show_inactive_devices">Show inactive</string>
+	<string name="hide_inactive_devices">Hide inactive</string>
 	<string name="distrust_omemo_key">Distrust device</string>
 	<string name="distrust_omemo_key_text">Are you sure you want to remove the verification for this device?\nThis device and messages coming from that device will be marked as untrusted.</string>
 	<string name="timeout_24_hours">24 hours</string>