add scan action to contact details

This commit is contained in:
Daniel Gultsch 2018-02-26 15:44:50 +01:00
parent 89bfae14b1
commit acc47fbeda
4 changed files with 61 additions and 26 deletions

View File

@ -435,6 +435,10 @@ public class ContactDetailsActivity extends OmemoActivity implements OnAccountUp
} else { } else {
binding.showInactiveDevices.setVisibility(View.GONE); 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) { if (Config.supportOpenPgp() && contact.getPgpKeyId() != 0) {
hasKeys = true; hasKeys = true;
View view = inflater.inflate(R.layout.contact_key, binding.detailsContactKeys, false); View view = inflater.inflate(R.layout.contact_key, binding.detailsContactKeys, false);

View File

@ -118,25 +118,45 @@
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical" android:orientation="vertical">
android:padding="@dimen/card_padding_list">
<LinearLayout <LinearLayout
android:id="@+id/details_contact_keys" android:id="@+id/details_contact_keys"
android:layout_width="fill_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical"> android:orientation="vertical"
android:padding="@dimen/card_padding_list">
</LinearLayout> </LinearLayout>
<Button <LinearLayout
android:id="@+id/show_inactive_devices"
style="?android:attr/borderlessButtonStyle"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="match_parent"
android:layout_gravity="center_horizontal"
android:layout_marginTop="8dp" android:layout_marginTop="8dp"
android:text="@string/show_inactive_devices" android:orientation="horizontal">
android:textColor="@color/accent"/>
<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> </LinearLayout>
</android.support.v7.widget.CardView> </android.support.v7.widget.CardView>
</LinearLayout> </LinearLayout>

View File

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

View File

@ -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="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="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="verify_omemo_keys">Verify OMEMO keys</string>
<string name="show_inactive_devices">Show inactive devices</string> <string name="show_inactive_devices">Show inactive</string>
<string name="hide_inactive_devices">Hide inactive devices</string> <string name="hide_inactive_devices">Hide inactive</string>
<string name="distrust_omemo_key">Distrust device</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="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> <string name="timeout_24_hours">24 hours</string>