use data binder for contact details activity

This commit is contained in:
Christian Schneppe 2018-03-16 21:56:40 +01:00
parent f26cab3b03
commit 3b65baa172
3 changed files with 297 additions and 315 deletions

View file

@ -96,6 +96,10 @@ android {
dimension "distribution"
}
dataBinding {
enabled true
}
dexOptions {
// Skip pre-dexing when running on Travis CI or when disabled via -Dpre-dex=false.
preDexLibraries = preDexEnabled && !travisBuild

View file

@ -1,10 +1,10 @@
package de.pixart.messenger.ui;
import android.support.v7.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.databinding.DataBindingUtil;
import android.graphics.PorterDuff;
import android.net.Uri;
import android.os.Bundle;
@ -14,24 +14,18 @@ import android.provider.ContactsContract.Contacts;
import android.provider.ContactsContract.Intents;
import android.support.v4.content.ContextCompat;
import android.support.v7.app.ActionBar;
import android.support.v7.widget.CardView;
import android.support.v7.app.AlertDialog;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.CompoundButton.OnCheckedChangeListener;
import android.widget.ImageButton;
import android.widget.LinearLayout;
import android.widget.QuickContactBadge;
import android.widget.TextView;
import android.widget.Toast;
import com.wefika.flowlayout.FlowLayout;
import org.openintents.openpgp.util.OpenPgpUtils;
import java.util.List;
@ -52,6 +46,7 @@ import de.pixart.messenger.utils.CryptoHelper;
import de.pixart.messenger.utils.Namespace;
import de.pixart.messenger.utils.UIHelper;
import de.pixart.messenger.utils.XmppUri;
import de.pixart.messenger.databinding.ActivityContactDetailsBinding;
import de.pixart.messenger.xmpp.OnKeyStatusUpdated;
import de.pixart.messenger.xmpp.OnUpdateBlocklist;
import de.pixart.messenger.xmpp.XmppConnection;
@ -110,22 +105,11 @@ public class ContactDetailsActivity extends OmemoActivity implements OnAccountUp
}
}
};
ActivityContactDetailsBinding binding;
private Jid accountJid;
private TextView lastseen;
private Jid contactJid;
private TextView contactDisplayName;
private TextView contactJidTv;
private TextView accountJidTv;
private TextView statusMessage;
private TextView resource;
private CheckBox send;
private CheckBox receive;
private Button addContactButton;
private Button mShowInactiveDevicesButton;
private QuickContactBadge badge;
private LinearLayout keys;
private CardView keysWrapper;
private FlowLayout tags;
private boolean showDynamicTags = false;
private boolean showLastSeen = false;
private boolean showInactiveOmemo = false;
@ -273,27 +257,13 @@ public class ContactDetailsActivity extends OmemoActivity implements OnAccountUp
}
}
this.messageFingerprint = getIntent().getStringExtra("fingerprint");
setContentView(R.layout.activity_contact_details);
contactDisplayName = findViewById(R.id.contact_display_name);
contactJidTv = findViewById(R.id.details_contactjid);
accountJidTv = findViewById(R.id.details_account);
lastseen = findViewById(R.id.details_lastseen);
statusMessage = findViewById(R.id.status_message);
resource = findViewById(R.id.resource);
send = findViewById(R.id.details_send_presence);
receive = findViewById(R.id.details_receive_presence);
badge = findViewById(R.id.details_contact_badge);
addContactButton = findViewById(R.id.add_contact_button);
keys = findViewById(R.id.details_contact_keys);
keysWrapper = findViewById(R.id.keys_wrapper);
tags = findViewById(R.id.tags);
mShowInactiveDevicesButton = findViewById(R.id.show_inactive_devices);
this.binding = DataBindingUtil.setContentView(this, R.layout.activity_contact_details);
if (getSupportActionBar() != null) {
getSupportActionBar().setHomeButtonEnabled(true);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
}
mShowInactiveDevicesButton.setOnClickListener(v -> {
binding.showInactiveDevices.setOnClickListener(v -> {
showInactiveOmemo = !showInactiveOmemo;
populateView();
});
@ -425,18 +395,21 @@ public class ContactDetailsActivity extends OmemoActivity implements OnAccountUp
invalidateOptionsMenu();
setTitle(contact.getDisplayName());
if (contact.getServer().toString().toLowerCase().equals(accountJid.getDomainpart().toLowerCase())) {
contactDisplayName.setText(contact.getDisplayName());
binding.contactDisplayName.setText(contact.getDisplayName());
} else {
contactDisplayName.setText(contact.getDisplayJid());
binding.contactDisplayName.setText(contact.getDisplayJid());
}
if (contact.showInRoster()) {
send.setVisibility(View.VISIBLE);
receive.setVisibility(View.VISIBLE);
addContactButton.setVisibility(View.VISIBLE);
addContactButton.setText(getString(R.string.action_delete_contact));
addContactButton.getBackground().setColorFilter(getWarningButtonColor(), PorterDuff.Mode.MULTIPLY);
binding.detailsSendPresence.setVisibility(View.VISIBLE);
binding.detailsReceivePresence.setVisibility(View.VISIBLE);
binding.addContactButton.setVisibility(View.VISIBLE);
binding.addContactButton.setText(getString(R.string.action_delete_contact));
binding.addContactButton.getBackground().setColorFilter(getWarningButtonColor(), PorterDuff.Mode.MULTIPLY);
binding.detailsSendPresence.setOnCheckedChangeListener(null);
binding.detailsReceivePresence.setOnCheckedChangeListener(null);
final AlertDialog.Builder deleteFromRosterDialog = new AlertDialog.Builder(ContactDetailsActivity.this);
addContactButton.setOnClickListener(new OnClickListener() {
binding.addContactButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View view) {
deleteFromRosterDialog.setNegativeButton(getString(R.string.cancel), null);
@ -448,15 +421,15 @@ public class ContactDetailsActivity extends OmemoActivity implements OnAccountUp
removeFromRoster).create().show();
}
});
send.setOnCheckedChangeListener(null);
receive.setOnCheckedChangeListener(null);
binding.detailsSendPresence.setOnCheckedChangeListener(null);
binding.detailsReceivePresence.setOnCheckedChangeListener(null);
List<String> statusMessages = contact.getPresences().getStatusMessages();
if (statusMessages.size() == 0) {
statusMessage.setVisibility(View.GONE);
binding.statusMessage.setVisibility(View.GONE);
} else {
StringBuilder builder = new StringBuilder();
statusMessage.setVisibility(View.VISIBLE);
binding.statusMessage.setVisibility(View.VISIBLE);
int s = statusMessages.size();
for (int i = 0; i < s; ++i) {
if (s > 1) {
@ -467,85 +440,85 @@ public class ContactDetailsActivity extends OmemoActivity implements OnAccountUp
builder.append("\n");
}
}
statusMessage.setText(builder);
binding.statusMessage.setText(builder);
}
String resources = contact.getPresences().getMostAvailableResource();
if (resources.length() == 0) {
resource.setVisibility(View.GONE);
binding.resource.setVisibility(View.GONE);
} else {
resource.setVisibility(View.VISIBLE);
resource.setText(resources);
binding.resource.setVisibility(View.VISIBLE);
binding.resource.setText(resources);
}
if (contact.getOption(Contact.Options.FROM)) {
send.setText(R.string.send_presence_updates);
send.setChecked(true);
binding.detailsSendPresence.setText(R.string.send_presence_updates);
binding.detailsSendPresence.setChecked(true);
} else if (contact.getOption(Contact.Options.PENDING_SUBSCRIPTION_REQUEST)) {
send.setChecked(false);
send.setText(R.string.send_presence_updates);
binding.detailsSendPresence.setChecked(false);
binding.detailsSendPresence.setText(R.string.send_presence_updates);
} else {
send.setText(R.string.preemptively_grant);
binding.detailsSendPresence.setText(R.string.preemptively_grant);
if (contact.getOption(Contact.Options.PREEMPTIVE_GRANT)) {
send.setChecked(true);
binding.detailsSendPresence.setChecked(true);
} else {
send.setChecked(false);
binding.detailsSendPresence.setChecked(false);
}
}
if (contact.getOption(Contact.Options.TO)) {
receive.setText(R.string.receive_presence_updates);
receive.setChecked(true);
binding.detailsReceivePresence.setText(R.string.receive_presence_updates);
binding.detailsReceivePresence.setChecked(true);
} else {
receive.setText(R.string.ask_for_presence_updates);
binding.detailsReceivePresence.setText(R.string.ask_for_presence_updates);
if (contact.getOption(Contact.Options.ASKING)) {
receive.setChecked(true);
binding.detailsReceivePresence.setChecked(true);
} else {
receive.setChecked(false);
binding.detailsReceivePresence.setChecked(false);
}
}
if (contact.getAccount().isOnlineAndConnected()) {
receive.setEnabled(true);
send.setEnabled(true);
binding.detailsReceivePresence.setEnabled(true);
binding.detailsSendPresence.setEnabled(true);
} else {
receive.setEnabled(false);
send.setEnabled(false);
binding.detailsReceivePresence.setEnabled(false);
binding.detailsSendPresence.setEnabled(false);
}
send.setOnCheckedChangeListener(this.mOnSendCheckedChange);
receive.setOnCheckedChangeListener(this.mOnReceiveCheckedChange);
binding.detailsSendPresence.setOnCheckedChangeListener(this.mOnSendCheckedChange);
binding.detailsReceivePresence.setOnCheckedChangeListener(this.mOnReceiveCheckedChange);
} else {
addContactButton.setVisibility(View.VISIBLE);
addContactButton.setText(getString(R.string.add_contact));
addContactButton.getBackground().clearColorFilter();
addContactButton.setOnClickListener(new OnClickListener() {
binding.addContactButton.setVisibility(View.VISIBLE);
binding.addContactButton.setText(getString(R.string.add_contact));
binding.addContactButton.getBackground().clearColorFilter();
binding.addContactButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View view) {
showAddToRosterDialog(contact);
}
});
send.setVisibility(View.GONE);
receive.setVisibility(View.GONE);
statusMessage.setVisibility(View.GONE);
binding.detailsSendPresence.setVisibility(View.GONE);
binding.detailsReceivePresence.setVisibility(View.GONE);
binding.statusMessage.setVisibility(View.GONE);
}
if (contact.isBlocked() && !this.showDynamicTags) {
lastseen.setVisibility(View.VISIBLE);
lastseen.setText(R.string.contact_blocked);
binding.detailsLastseen.setVisibility(View.VISIBLE);
binding.detailsLastseen.setText(R.string.contact_blocked);
} else {
if (showLastSeen
&& contact.getLastseen() > 0
&& contact.getPresences().allOrNonSupport(Namespace.IDLE)) {
lastseen.setVisibility(View.VISIBLE);
lastseen.setText(UIHelper.lastseen(getApplicationContext(), contact.isActive(), contact.getLastseen()));
binding.detailsLastseen.setVisibility(View.VISIBLE);
binding.detailsLastseen.setText(UIHelper.lastseen(getApplicationContext(), contact.isActive(), contact.getLastseen()));
} else {
lastseen.setVisibility(View.GONE);
binding.detailsLastseen.setVisibility(View.GONE);
}
}
if (contact.getPresences().size() > 1) {
contactJidTv.setText(contact.getDisplayJid() + " ("
binding.detailsContactjid.setText(contact.getDisplayJid() + " ("
+ contact.getPresences().size() + ")");
} else {
contactJidTv.setText(contact.getDisplayJid());
binding.detailsContactjid.setText(contact.getDisplayJid());
}
String account;
if (Config.DOMAIN_LOCK != null) {
@ -553,17 +526,17 @@ public class ContactDetailsActivity extends OmemoActivity implements OnAccountUp
} else {
account = contact.getAccount().getJid().toBareJid().toString();
}
accountJidTv.setText(getString(R.string.using_account, account));
badge.setImageBitmap(avatarService().get(contact, getPixel(Config.AVATAR_SIZE)));
badge.setOnClickListener(this.onBadgeClick);
binding.detailsAccount.setText(getString(R.string.using_account, account));
binding.detailsContactBadge.setImageBitmap(avatarService().get(contact, getPixel(Config.AVATAR_SIZE)));
binding.detailsContactBadge.setOnClickListener(this.onBadgeClick);
keys.removeAllViews();
binding.detailsContactKeys.removeAllViews();
boolean hasKeys = false;
LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
if (Config.supportOtr()) {
for (final String otrFingerprint : contact.getOtrFingerprints()) {
hasKeys = true;
View view = inflater.inflate(R.layout.contact_key, keys, false);
View view = inflater.inflate(R.layout.contact_key, binding.detailsContactKeys, false);
TextView key = view.findViewById(R.id.key);
TextView keyType = view.findViewById(R.id.key_type);
ImageButton removeButton = view
@ -576,7 +549,7 @@ public class ContactDetailsActivity extends OmemoActivity implements OnAccountUp
} else {
keyType.setText(R.string.otr_fingerprint);
}
keys.addView(view);
binding.detailsContactKeys.addView(view);
removeButton.setOnClickListener(new OnClickListener() {
@Override
@ -603,21 +576,21 @@ public class ContactDetailsActivity extends OmemoActivity implements OnAccountUp
}
if (!trust.isCompromised()) {
boolean highlight = session.getFingerprint().equals(messageFingerprint);
addFingerprintRow(keys, session, highlight);
addFingerprintRow(binding.detailsContactKeys, session, highlight);
}
}
if (showsInactive || skippedInactive) {
mShowInactiveDevicesButton.setText(showsInactive ? R.string.hide_inactive_devices : R.string.show_inactive_devices);
mShowInactiveDevicesButton.setVisibility(View.VISIBLE);
binding.showInactiveDevices.setText(showsInactive ? R.string.hide_inactive_devices : R.string.show_inactive_devices);
binding.showInactiveDevices.setVisibility(View.VISIBLE);
} else {
mShowInactiveDevicesButton.setVisibility(View.GONE);
binding.showInactiveDevices.setVisibility(View.GONE);
}
} else {
mShowInactiveDevicesButton.setVisibility(View.GONE);
binding.showInactiveDevices.setVisibility(View.GONE);
}
if (Config.supportOpenPgp() && contact.getPgpKeyId() != 0) {
hasKeys = true;
View view = inflater.inflate(R.layout.contact_key, keys, false);
View view = inflater.inflate(R.layout.contact_key, binding.detailsContactKeys, false);
TextView key = view.findViewById(R.id.key);
TextView keyType = view.findViewById(R.id.key_type);
keyType.setText(R.string.openpgp_key_id);
@ -635,21 +608,21 @@ public class ContactDetailsActivity extends OmemoActivity implements OnAccountUp
view.setOnClickListener(openKey);
key.setOnClickListener(openKey);
keyType.setOnClickListener(openKey);
keys.addView(view);
binding.detailsContactKeys.addView(view);
}
keysWrapper.setVisibility(hasKeys ? View.VISIBLE : View.GONE);
binding.keysWrapper.setVisibility(hasKeys ? View.VISIBLE : View.GONE);
List<ListItem.Tag> tagList = contact.getTags(this);
if (tagList.size() == 0 || !this.showDynamicTags) {
tags.setVisibility(View.GONE);
binding.tags.setVisibility(View.GONE);
} else {
tags.setVisibility(View.VISIBLE);
tags.removeAllViewsInLayout();
binding.tags.setVisibility(View.VISIBLE);
binding.tags.removeAllViewsInLayout();
for (final ListItem.Tag tag : tagList) {
final TextView tv = (TextView) inflater.inflate(R.layout.list_item_tag, tags, false);
final TextView tv = (TextView) inflater.inflate(R.layout.list_item_tag, binding.tags, false);
tv.setText(tag.getName());
tv.setBackgroundColor(tag.getColor());
tags.addView(tv);
binding.tags.addView(tv);
}
}
}

View file

@ -1,251 +1,256 @@
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@color/grey200">
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools">
<LinearLayout
android:id="@+id/details_main_layout"
<ScrollView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
android:layout_height="fill_parent"
android:background="@color/grey200">
<android.support.v7.widget.CardView
android:layout_width="match_parent"
<LinearLayout
android:id="@+id/details_main_layout"
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:orientation="vertical">
<RelativeLayout
<android.support.v7.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="@dimen/infocard_padding">
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.support.text.emoji.widget.EmojiTextView
android:id="@+id/contact_display_name"
android:layout_width="wrap_content"
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_gravity="center_horizontal"
android:paddingBottom="5dp"
android:text="@string/contact"
android:textAlignment="center"
android:textColor="@color/black87"
android:textIsSelectable="false"
android:textSize="?attr/TextSizeHeadline"
android:textStyle="bold" />
<QuickContactBadge
android:id="@+id/details_contact_badge"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/contact_display_name"
android:layout_centerHorizontal="true"
android:adjustViewBounds="true"
android:background="@drawable/message_border"
android:maxHeight="384dp"
android:maxWidth="384dp"
android:padding="1dp"
android:scaleType="centerCrop" />
<LinearLayout
android:id="@+id/details_jidbox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_alignParentStart="true"
android:layout_below="@+id/details_contact_badge"
android:layout_marginTop="16dp"
android:orientation="vertical">
<TextView
android:id="@+id/details_contactjid"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:text="@string/account_settings_example_jabber_id"
android:textColor="?attr/color_text_primary"
android:textIsSelectable="true"
android:textSize="?attr/TextSizeHeadline"
android:textStyle="bold"
android:visibility="gone" />
<com.wefika.flowlayout.FlowLayout
android:id="@+id/tags"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginBottom="4dp"
android:layout_marginLeft="-2dp"
android:layout_marginTop="4dp"
android:orientation="horizontal"></com.wefika.flowlayout.FlowLayout>
<TextView
android:id="@+id/details_lastseen"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginBottom="4dp"
android:layout_marginTop="4dp"
android:textColor="?attr/color_text_primary"
android:textSize="?attr/TextSizeBody" />
android:padding="@dimen/infocard_padding">
<android.support.text.emoji.widget.EmojiTextView
android:id="@+id/status_message"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginBottom="4dp"
android:layout_marginTop="4dp"
android:gravity="center_horizontal"
android:textColor="?attr/color_text_primary"
android:textSize="?attr/TextSizeBody"
android:textStyle="italic" />
<android.support.text.emoji.widget.EmojiTextView
android:id="@+id/resource"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginBottom="4dp"
android:layout_marginTop="4dp"
android:gravity="center_horizontal"
android:textColor="?attr/color_text_primary"
android:textSize="?attr/TextSizeBody"
android:textStyle="italic" />
<Button
android:id="@+id/add_contact_button"
android:id="@+id/contact_display_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_gravity="center_horizontal"
android:layout_marginBottom="4dp"
android:layout_marginTop="4dp"
android:text="@string/add_contact" />
android:paddingBottom="5dp"
android:text="@string/contact"
android:textAlignment="center"
android:textColor="@color/black87"
android:textIsSelectable="false"
android:textSize="?attr/TextSizeHeadline"
android:textStyle="bold" />
<CheckBox
android:id="@+id/details_send_presence"
<QuickContactBadge
android:id="@+id/details_contact_badge"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_below="@+id/add_contact_button"
android:layout_marginTop="4dp"
android:text="@string/send_presence_updates"
android:textColor="?attr/color_text_primary"
android:textSize="?attr/TextSizeBody" />
android:layout_below="@+id/contact_display_name"
android:layout_centerHorizontal="true"
android:adjustViewBounds="true"
android:background="@drawable/message_border"
android:maxHeight="384dp"
android:maxWidth="384dp"
android:padding="1dp"
android:scaleType="centerCrop" />
<CheckBox
android:id="@+id/details_receive_presence"
<LinearLayout
android:id="@+id/details_jidbox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_alignParentStart="true"
android:layout_below="@+id/details_send_presence"
android:text="@string/receive_presence_updates"
android:textColor="?attr/color_text_primary"
android:textSize="?attr/TextSizeBody" />
android:layout_below="@+id/details_contact_badge"
android:layout_marginTop="16dp"
android:orientation="vertical">
</LinearLayout>
<TextView
android:id="@+id/details_contactjid"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:text="@string/account_settings_example_jabber_id"
android:textColor="?attr/color_text_primary"
android:textIsSelectable="true"
android:textSize="?attr/TextSizeHeadline"
android:textStyle="bold"
android:visibility="gone" />
<TextView
android:id="@+id/details_account"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_below="@+id/details_jidbox"
android:layout_marginTop="32dp"
android:text="@string/using_account"
android:textColor="@color/black54"
android:textSize="?attr/TextSizeInfo"
android:visibility="gone" />
</RelativeLayout>
</android.support.v7.widget.CardView>
<com.wefika.flowlayout.FlowLayout
android:id="@+id/tags"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginBottom="4dp"
android:layout_marginLeft="-2dp"
android:layout_marginTop="4dp"
android:orientation="horizontal"></com.wefika.flowlayout.FlowLayout>
<android.support.v7.widget.CardView
android:layout_width="match_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">
<TextView
android:id="@+id/details_lastseen"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginBottom="4dp"
android:layout_marginTop="4dp"
android:textColor="?attr/color_text_primary"
android:textSize="?attr/TextSizeBody" />
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:background="@drawable/infocard_border"
android:padding="@dimen/infocard_padding"
android:touchscreenBlocksFocus="true">
<android.support.text.emoji.widget.EmojiTextView
android:id="@+id/status_message"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginBottom="4dp"
android:layout_marginTop="4dp"
android:gravity="center_horizontal"
android:textColor="?attr/color_text_primary"
android:textSize="?attr/TextSizeBody"
android:textStyle="italic" />
<TextView
android:id="@+id/notification_status_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:layout_toLeftOf="@+id/notification_status_button"
android:text="@string/notify_on_all_messages"
android:textColor="@color/black87"
android:textSize="?attr/TextSizeBody" />
<android.support.text.emoji.widget.EmojiTextView
android:id="@+id/resource"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginBottom="4dp"
android:layout_marginTop="4dp"
android:gravity="center_horizontal"
android:textColor="?attr/color_text_primary"
android:textSize="?attr/TextSizeBody"
android:textStyle="italic" />
<ImageButton
android:id="@+id/notification_status_button"
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_gravity="center_horizontal"
android:background="?android:selectableItemBackground"
android:padding="@dimen/image_button_padding"
android:src="@drawable/ic_notifications_grey600_24dp" />
</RelativeLayout>
<Button
android:id="@+id/add_contact_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_gravity="center_horizontal"
android:layout_marginBottom="4dp"
android:layout_marginTop="4dp"
android:text="@string/add_contact" />
</android.support.v7.widget.CardView>
<CheckBox
android:id="@+id/details_send_presence"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_below="@+id/add_contact_button"
android:layout_marginTop="4dp"
android:text="@string/send_presence_updates"
android:textColor="?attr/color_text_primary"
android:textSize="?attr/TextSizeBody" />
<android.support.v7.widget.CardView
android:id="@+id/keys_wrapper"
android:layout_width="match_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:orientation="vertical"
android:padding="@dimen/infocard_padding">
<CheckBox
android:id="@+id/details_receive_presence"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_below="@+id/details_send_presence"
android:text="@string/receive_presence_updates"
android:textColor="?attr/color_text_primary"
android:textSize="?attr/TextSizeBody" />
<LinearLayout
</LinearLayout>
<TextView
android:id="@+id/details_account"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_below="@+id/details_jidbox"
android:layout_marginTop="32dp"
android:text="@string/using_account"
android:textColor="@color/black54"
android:textSize="?attr/TextSizeInfo"
android:visibility="gone" />
</RelativeLayout>
</android.support.v7.widget.CardView>
<android.support.v7.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
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">
<LinearLayout
android:id="@+id/details_contact_keys"
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:divider="?android:dividerHorizontal"
android:orientation="vertical"
android:showDividers="middle"></LinearLayout>
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:background="@drawable/infocard_border"
android:padding="@dimen/infocard_padding"
android:touchscreenBlocksFocus="true">
<Button
android:id="@+id/show_inactive_devices"
style="?android:attr/borderlessButtonStyle"
android:layout_width="wrap_content"
<TextView
android:id="@+id/notification_status_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:layout_toLeftOf="@+id/notification_status_button"
android:text="@string/notify_on_all_messages"
android:textColor="@color/black87"
android:textSize="?attr/TextSizeBody" />
<ImageButton
android:id="@+id/notification_status_button"
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_gravity="center_horizontal"
android:background="?android:selectableItemBackground"
android:padding="@dimen/image_button_padding"
android:src="@drawable/ic_notifications_grey600_24dp" />
</RelativeLayout>
</android.support.v7.widget.CardView>
<android.support.v7.widget.CardView
android:id="@+id/keys_wrapper"
android:layout_width="match_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:orientation="vertical"
android:padding="@dimen/infocard_padding">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="8dp"
android:text="@string/show_inactive_devices"
android:textColor="@color/accent" />
</LinearLayout>
</android.support.v7.widget.CardView>
</LinearLayout>
</ScrollView>
android:orientation="vertical">
<LinearLayout
android:id="@+id/details_contact_keys"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:divider="?android:dividerHorizontal"
android:orientation="vertical"
android:showDividers="middle"></LinearLayout>
<Button
android:id="@+id/show_inactive_devices"
style="?android:attr/borderlessButtonStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="8dp"
android:text="@string/show_inactive_devices"
android:textColor="@color/accent" />
</LinearLayout>
</android.support.v7.widget.CardView>
</LinearLayout>
</ScrollView>
</layout>