switch account activity to card view. started using data binder

Daniel Gultsch created

Change summary

src/main/java/eu/siacs/conversations/ui/EditAccountActivity.java |  405 
src/main/res/layout/activity_edit_account.xml                    | 1206 +
2 files changed, 776 insertions(+), 835 deletions(-)

Detailed changes

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

@@ -5,6 +5,7 @@ import android.content.ActivityNotFoundException;
 import android.content.DialogInterface;
 import android.content.Intent;
 import android.content.SharedPreferences;
+import android.databinding.DataBindingUtil;
 import android.graphics.Bitmap;
 import android.net.Uri;
 import android.os.Bundle;
@@ -50,6 +51,7 @@ import eu.siacs.conversations.Config;
 import eu.siacs.conversations.R;
 import eu.siacs.conversations.crypto.axolotl.AxolotlService;
 import eu.siacs.conversations.crypto.axolotl.XmppAxolotlSession;
+import eu.siacs.conversations.databinding.ActivityEditAccountBinding;
 import eu.siacs.conversations.entities.Account;
 import eu.siacs.conversations.services.BarcodeProvider;
 import eu.siacs.conversations.services.XmppConnectionService;
@@ -74,7 +76,6 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
 		OnKeyStatusUpdated, OnCaptchaRequested, KeyChainAliasCallback, XmppConnectionService.OnShowErrorToast, XmppConnectionService.OnMamPreferencesFetched {
 
 	private static final int REQUEST_DATA_SAVER = 0x37af244;
-	private AutoCompleteTextView mAccountJid;
 	private TextInputLayout mAccountJidLayout;
 	private EditText mPassword;
 	private TextInputLayout mPasswordLayout;
@@ -82,12 +83,9 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
 	private Button mCancelButton;
 	private Button mSaveButton;
 	private Button mDisableOsOptimizationsButton;
-	private TextView mDisableOsOptimizationsHeadline;
 	private TextView getmDisableOsOptimizationsBody;
 	private TableLayout mMoreTable;
 
-	private LinearLayout mStats;
-	private RelativeLayout mOsOptimizations;
 	private TextView mServerInfoSm;
 	private TextView mServerInfoRosterVersion;
 	private TextView mServerInfoCarbons;
@@ -112,7 +110,6 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
 	private ImageButton mAxolotlFingerprintToClipboardButton;
 	private ImageButton mPgpDeleteFingerprintButton;
 	private LinearLayout keys;
-	private LinearLayout keysCard;
 	private LinearLayout mNamePort;
 	private EditText mHostname;
 	private TextInputLayout mHostnameLayout;
@@ -146,15 +143,15 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
 			if (mAccount != null && mAccount.getStatus() == Account.State.DISABLED && !accountInfoEdited()) {
 				mAccount.setOption(Account.OPTION_DISABLED, false);
 				if (!xmppConnectionService.updateAccount(mAccount)) {
-					Toast.makeText(EditAccountActivity.this,R.string.unable_to_update_account,Toast.LENGTH_SHORT).show();
+					Toast.makeText(EditAccountActivity.this, R.string.unable_to_update_account, Toast.LENGTH_SHORT).show();
 				}
 				return;
 			}
 			final boolean registerNewAccount = mRegisterNew.isChecked() && !Config.DISALLOW_REGISTRATION_IN_UI;
-			if (mUsernameMode && mAccountJid.getText().toString().contains("@")) {
+			if (mUsernameMode && binding.accountJid.getText().toString().contains("@")) {
 				mAccountJidLayout.setError(getString(R.string.invalid_username));
 				removeErrorsOnAllBut(mAccountJidLayout);
-				mAccountJid.requestFocus();
+				binding.accountJid.requestFocus();
 				return;
 			}
 
@@ -168,7 +165,7 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
 					startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url.toString())));
 					return;
 				} catch (ActivityNotFoundException e) {
-					Toast.makeText(EditAccountActivity.this,R.string.application_found_to_open_website,Toast.LENGTH_SHORT);
+					Toast.makeText(EditAccountActivity.this, R.string.application_found_to_open_website, Toast.LENGTH_SHORT);
 					return;
 				}
 			}
@@ -176,9 +173,9 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
 			final Jid jid;
 			try {
 				if (mUsernameMode) {
-					jid = Jid.fromParts(mAccountJid.getText().toString(), getUserModeDomain(), null);
+					jid = Jid.fromParts(binding.accountJid.getText().toString(), getUserModeDomain(), null);
 				} else {
-					jid = Jid.fromString(mAccountJid.getText().toString());
+					jid = Jid.fromString(binding.accountJid.getText().toString());
 				}
 			} catch (final InvalidJidException e) {
 				if (mUsernameMode) {
@@ -186,15 +183,15 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
 				} else {
 					mAccountJidLayout.setError(getString(R.string.invalid_jid));
 				}
-				mAccountJid.requestFocus();
+				binding.accountJid.requestFocus();
 				removeErrorsOnAllBut(mAccountJidLayout);
 				return;
 			}
 			String hostname = null;
 			int numericPort = 5222;
 			if (mShowOptions) {
-				hostname = mHostname.getText().toString().replaceAll("\\s","");
-				final String port = mPort.getText().toString().replaceAll("\\s","");
+				hostname = mHostname.getText().toString().replaceAll("\\s", "");
+				final String port = mPort.getText().toString().replaceAll("\\s", "");
 				if (hostname.contains(" ")) {
 					mHostnameLayout.setError(getString(R.string.not_valid_hostname));
 					mHostname.requestFocus();
@@ -225,7 +222,7 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
 					mAccountJidLayout.setError(getString(R.string.invalid_jid));
 				}
 				removeErrorsOnAllBut(mAccountJidLayout);
-				mAccountJid.requestFocus();
+				binding.accountJid.requestFocus();
 				return;
 			}
 			if (mAccount != null) {
@@ -239,14 +236,14 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
 				mAccount.setPassword(password);
 				mAccount.setOption(Account.OPTION_REGISTER, registerNewAccount);
 				if (!xmppConnectionService.updateAccount(mAccount)) {
-					Toast.makeText(EditAccountActivity.this,R.string.unable_to_update_account,Toast.LENGTH_SHORT).show();
+					Toast.makeText(EditAccountActivity.this, R.string.unable_to_update_account, Toast.LENGTH_SHORT).show();
 					return;
 				}
 			} else {
 				if (xmppConnectionService.findAccountByJid(jid) != null) {
 					mAccountJidLayout.setError(getString(R.string.account_already_exists));
 					removeErrorsOnAllBut(mAccountJidLayout);
-					mAccountJid.requestFocus();
+					binding.accountJid.requestFocus();
 					return;
 				}
 				mAccount = new Account(jid.toBareJid(), password);
@@ -284,9 +281,10 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
 	private boolean mSavedInstanceInit = false;
 	private Button mClearDevicesButton;
 	private XmppUri pendingUri = null;
-    private boolean mUseTor;
+	private boolean mUseTor;
+	private ActivityEditAccountBinding binding;
 
-    public void refreshUiReal() {
+	public void refreshUiReal() {
 		invalidateOptionsMenu();
 		if (mAccount != null
 				&& mAccount.getStatus() != Account.State.ONLINE
@@ -369,25 +367,25 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
 		}
 	};
 
-    private View.OnFocusChangeListener mEditTextFocusListener = new View.OnFocusChangeListener() {
-        @Override
-        public void onFocusChange(View view, boolean b) {
-            EditText et = (EditText) view;
-            if (b) {
+	private View.OnFocusChangeListener mEditTextFocusListener = new View.OnFocusChangeListener() {
+		@Override
+		public void onFocusChange(View view, boolean b) {
+			EditText et = (EditText) view;
+			if (b) {
 				int resId = mUsernameMode ? R.string.username : R.string.account_settings_example_jabber_id;
 				if (view.getId() == R.id.hostname) {
-                    resId = mUseTor ? R.string.hostname_or_onion : R.string.hostname_example;
-                }
-                final int res = resId;
-				new Handler().postDelayed(() -> et.setHint(res),200);
-            } else {
-                et.setHint(null);
-            }
-        }
-    };
-
-
-    private final OnClickListener mAvatarClickListener = new OnClickListener() {
+					resId = mUseTor ? R.string.hostname_or_onion : R.string.hostname_example;
+				}
+				final int res = resId;
+				new Handler().postDelayed(() -> et.setHint(res), 200);
+			} else {
+				et.setHint(null);
+			}
+		}
+	};
+
+
+	private final OnClickListener mAvatarClickListener = new OnClickListener() {
 		@Override
 		public void onClick(final View view) {
 			if (mAccount != null) {
@@ -433,17 +431,17 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
 
 	@Override
 	protected void processFingerprintVerification(XmppUri uri) {
-		processFingerprintVerification(uri,true);
+		processFingerprintVerification(uri, true);
 	}
 
 
 	protected void processFingerprintVerification(XmppUri uri, boolean showWarningToast) {
 		if (mAccount != null && mAccount.getJid().toBareJid().equals(uri.getJid()) && uri.hasFingerprints()) {
-			if (xmppConnectionService.verifyFingerprints(mAccount,uri.getFingerprints())) {
-				Toast.makeText(this,R.string.verified_fingerprints,Toast.LENGTH_SHORT).show();
+			if (xmppConnectionService.verifyFingerprints(mAccount, uri.getFingerprints())) {
+				Toast.makeText(this, R.string.verified_fingerprints, Toast.LENGTH_SHORT).show();
 			}
 		} else if (showWarningToast) {
-			Toast.makeText(this,R.string.invalid_barcode,Toast.LENGTH_SHORT).show();
+			Toast.makeText(this, R.string.invalid_barcode, Toast.LENGTH_SHORT).show();
 		}
 	}
 
@@ -459,7 +457,7 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
 			this.mSaveButton.setEnabled(true);
 			this.mSaveButton.setTextColor(getPrimaryTextColor());
 		} else if (mAccount != null
-				&& (mAccount.getStatus() == Account.State.CONNECTING || mAccount.getStatus() == Account.State.REGISTRATION_SUCCESSFUL|| mFetchingAvatar)) {
+				&& (mAccount.getStatus() == Account.State.CONNECTING || mAccount.getStatus() == Account.State.REGISTRATION_SUCCESSFUL || mFetchingAvatar)) {
 			this.mSaveButton.setEnabled(false);
 			this.mSaveButton.setTextColor(getSecondaryTextColor());
 			this.mSaveButton.setText(R.string.account_status_connecting);
@@ -479,7 +477,7 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
 					}
 				} else {
 					XmppConnection connection = mAccount == null ? null : mAccount.getXmppConnection();
-					URL url = connection != null &&  mAccount.getStatus() == Account.State.PAYMENT_REQUIRED ? connection.getRedirectionUrl() : null;
+					URL url = connection != null && mAccount.getStatus() == Account.State.PAYMENT_REQUIRED ? connection.getRedirectionUrl() : null;
 					if (url != null) {
 						this.mSaveButton.setText(R.string.open_website);
 					} else {
@@ -488,7 +486,7 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
 				}
 			} else {
 				XmppConnection connection = mAccount == null ? null : mAccount.getXmppConnection();
-				URL url = connection != null &&  mAccount.getStatus() == Account.State.REGISTRATION_WEB ? connection.getRedirectionUrl() : null;
+				URL url = connection != null && mAccount.getStatus() == Account.State.REGISTRATION_WEB ? connection.getRedirectionUrl() : null;
 				if (url != null && mRegisterNew.isChecked()) {
 					this.mSaveButton.setText(R.string.open_website);
 				} else {
@@ -515,7 +513,7 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
 		} else {
 			unmodified = this.mAccount.getJid().toBareJid().toString();
 		}
-		return !unmodified.equals(this.mAccountJid.getText().toString());
+		return !unmodified.equals(this.binding.accountJid.getText().toString());
 	}
 
 	protected boolean passwordChangedInMagicCreateMode() {
@@ -542,10 +540,9 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
 			this.mSavedInstanceAccount = savedInstanceState.getString("account");
 			this.mSavedInstanceInit = savedInstanceState.getBoolean("initMode", false);
 		}
-		setContentView(R.layout.activity_edit_account);
-		this.mAccountJid = (AutoCompleteTextView) findViewById(R.id.account_jid);
-		this.mAccountJid.addTextChangedListener(this.mTextWatcher);
-		this.mAccountJid.setOnFocusChangeListener(this.mEditTextFocusListener);
+		this.binding = DataBindingUtil.setContentView(this, R.layout.activity_edit_account);
+		binding.accountJid.addTextChangedListener(this.mTextWatcher);
+		binding.accountJid.setOnFocusChangeListener(this.mEditTextFocusListener);
 		this.mAccountJidLayout = (TextInputLayout) findViewById(R.id.account_jid_layout);
 		this.mPassword = (EditText) findViewById(R.id.account_password);
 		this.mPassword.addTextChangedListener(this.mTextWatcher);
@@ -553,10 +550,7 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
 		this.mAvatar = (ImageView) findViewById(R.id.avater);
 		this.mAvatar.setOnClickListener(this.mAvatarClickListener);
 		this.mRegisterNew = (CheckBox) findViewById(R.id.account_register_new);
-		this.mStats = (LinearLayout) findViewById(R.id.stats);
-		this.mOsOptimizations = (RelativeLayout) findViewById(R.id.os_optimization);
 		this.mDisableOsOptimizationsButton = (Button) findViewById(R.id.os_optimization_disable);
-		this.mDisableOsOptimizationsHeadline = (TextView) findViewById(R.id.os_optimization_headline);
 		this.getmDisableOsOptimizationsBody = (TextView) findViewById(R.id.os_optimization_body);
 		this.mSessionEst = (TextView) findViewById(R.id.session_est);
 		this.mServerInfoRosterVersion = (TextView) findViewById(R.id.server_info_roster_version);
@@ -581,13 +575,12 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
 		this.mAxolotlFingerprintBox = (RelativeLayout) findViewById(R.id.axolotl_fingerprint_box);
 		this.mAxolotlFingerprintToClipboardButton = (ImageButton) findViewById(R.id.action_copy_axolotl_to_clipboard);
 		this.mOwnFingerprintDesc = (TextView) findViewById(R.id.own_fingerprint_desc);
-		this.keysCard = (LinearLayout) findViewById(R.id.other_device_keys_card);
 		this.keys = (LinearLayout) findViewById(R.id.other_device_keys);
 		this.mNamePort = (LinearLayout) findViewById(R.id.name_port);
 		this.mHostname = (EditText) findViewById(R.id.hostname);
 		this.mHostname.addTextChangedListener(mTextWatcher);
 		this.mHostname.setOnFocusChangeListener(mEditTextFocusListener);
-		this.mHostnameLayout = (TextInputLayout)findViewById(R.id.hostname_layout);
+		this.mHostnameLayout = (TextInputLayout) findViewById(R.id.hostname_layout);
 		this.mClearDevicesButton = (Button) findViewById(R.id.clear_devices);
 		this.mClearDevicesButton.setOnClickListener(new OnClickListener() {
 			@Override
@@ -598,7 +591,7 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
 		this.mPort = (EditText) findViewById(R.id.port);
 		this.mPort.setText("5222");
 		this.mPort.addTextChangedListener(mTextWatcher);
-		this.mPortLayout = (TextInputLayout)findViewById(R.id.port_layout);
+		this.mPortLayout = (TextInputLayout) findViewById(R.id.port_layout);
 		this.mSaveButton = (Button) findViewById(R.id.save_button);
 		this.mCancelButton = (Button) findViewById(R.id.cancel_button);
 		this.mSaveButton.setOnClickListener(this.mSaveButtonClickListener);
@@ -704,7 +697,7 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
 			}
 		}
 		SharedPreferences preferences = getPreferences();
-        mUseTor = Config.FORCE_ORBOT || preferences.getBoolean("use_tor", false);
+		mUseTor = Config.FORCE_ORBOT || preferences.getBoolean("use_tor", false);
 		this.mShowOptions = mUseTor || preferences.getBoolean("show_connection_options", false);
 		this.mNamePort.setVisibility(mShowOptions ? View.VISIBLE : View.GONE);
 	}
@@ -768,12 +761,12 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
 			this.mCancelButton.setTextColor(getSecondaryTextColor());
 		}
 		if (mUsernameMode) {
-			this.mAccountJid.setHint(R.string.username_hint);
+			this.binding.accountJid.setHint(R.string.username_hint);
 		} else {
 			final KnownHostsAdapter mKnownHostsAdapter = new KnownHostsAdapter(this,
 					R.layout.simple_list_item,
 					xmppConnectionService.getKnownHosts());
-			this.mAccountJid.setAdapter(mKnownHostsAdapter);
+			this.binding.accountJid.setAdapter(mKnownHostsAdapter);
 		}
 
 		if (pendingUri != null) {
@@ -831,7 +824,7 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
 
 	private void shareBarcode() {
 		Intent intent = new Intent(Intent.ACTION_SEND);
-		intent.putExtra(Intent.EXTRA_STREAM,BarcodeProvider.getUriForAccount(this,mAccount));
+		intent.putExtra(Intent.EXTRA_STREAM, BarcodeProvider.getUriForAccount(this, mAccount));
 		intent.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
 		intent.setType("image/png");
 		startActivity(Intent.createChooser(intent, getText(R.string.share_with)));
@@ -856,7 +849,7 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
 
 	private void changePresence() {
 		Intent intent = new Intent(this, SetPresenceActivity.class);
-		intent.putExtra(SetPresenceActivity.EXTRA_ACCOUNT,mAccount.getJid().toBareJid().toString());
+		intent.putExtra(SetPresenceActivity.EXTRA_ACCOUNT, mAccount.getJid().toBareJid().toString());
 		startActivity(intent);
 	}
 
@@ -869,11 +862,11 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
 
 	private void updateAccountInformation(boolean init) {
 		if (init) {
-			this.mAccountJid.getEditableText().clear();
+			this.binding.accountJid.getEditableText().clear();
 			if (mUsernameMode) {
-				this.mAccountJid.getEditableText().append(this.mAccount.getJid().getLocalpart());
+				this.binding.accountJid.getEditableText().append(this.mAccount.getJid().getLocalpart());
 			} else {
-				this.mAccountJid.getEditableText().append(this.mAccount.getJid().toBareJid().toString());
+				this.binding.accountJid.getEditableText().append(this.mAccount.getJid().toBareJid().toString());
 			}
 			this.mPassword.getEditableText().clear();
 			this.mPassword.getEditableText().append(this.mAccount.getPassword());
@@ -886,9 +879,9 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
 		}
 
 		final boolean editable = !mAccount.isOptionSet(Account.OPTION_LOGGED_IN_SUCCESSFULLY);
-		this.mAccountJid.setEnabled(editable);
-		this.mAccountJid.setFocusable(editable);
-		this.mAccountJid.setFocusableInTouchMode(editable);
+		this.binding.accountJid.setEnabled(editable);
+		this.binding.accountJid.setFocusable(editable);
+		this.binding.accountJid.setFocusableInTouchMode(editable);
 		if (editable) {
 			this.mPassword.setCustomSelectionActionModeCallback(null);
 		} else {
@@ -910,10 +903,10 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
 		}
 		if (this.mAccount.isOnlineAndConnected() && !this.mFetchingAvatar) {
 			Features features = this.mAccount.getXmppConnection().getFeatures();
-			this.mStats.setVisibility(View.VISIBLE);
+			this.binding.stats.setVisibility(View.VISIBLE);
 			boolean showBatteryWarning = !xmppConnectionService.getPushManagementService().available(mAccount) && isOptimizingBattery();
 			boolean showDataSaverWarning = isAffectedByDataSaver();
-			showOsOptimizationWarning(showBatteryWarning,showDataSaverWarning);
+			showOsOptimizationWarning(showBatteryWarning, showDataSaverWarning);
 			this.mSessionEst.setText(UIHelper.readableTimeDifferenceFull(this, this.mAccount.getXmppConnection()
 					.getLastSessionEstablished()));
 			if (features.rosterVersioning()) {
@@ -974,18 +967,8 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
 			}
 			final long pgpKeyId = this.mAccount.getPgpId();
 			if (pgpKeyId != 0 && Config.supportOpenPgp()) {
-				OnClickListener openPgp = new OnClickListener() {
-					@Override
-					public void onClick(View view) {
-						launchOpenKeyChain(pgpKeyId);
-					}
-				};
-				OnClickListener delete = new OnClickListener() {
-					@Override
-					public void onClick(View view) {
-						showDeletePgpDialog();
-					}
-				};
+				OnClickListener openPgp = view -> launchOpenKeyChain(pgpKeyId);
+				OnClickListener delete = view -> showDeletePgpDialog();
 				this.mPgpFingerprintBox.setVisibility(View.VISIBLE);
 				this.mPgpFingerprint.setText(OpenPgpUtils.convertKeyIdToHex(pgpKeyId));
 				this.mPgpFingerprint.setOnClickListener(openPgp);
@@ -1004,22 +987,15 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
 				}
 				this.mOtrFingerprintBox.setVisibility(View.VISIBLE);
 				this.mOtrFingerprint.setText(CryptoHelper.prettifyFingerprint(otrFingerprint));
-				this.mOtrFingerprintToClipboardButton
-						.setVisibility(View.VISIBLE);
-				this.mOtrFingerprintToClipboardButton
-						.setOnClickListener(new View.OnClickListener() {
-
-							@Override
-							public void onClick(final View v) {
-
-								if (copyTextToClipboard(CryptoHelper.prettifyFingerprint(otrFingerprint), R.string.otr_fingerprint)) {
-									Toast.makeText(
-											EditAccountActivity.this,
-											R.string.toast_message_otr_fingerprint,
-											Toast.LENGTH_SHORT).show();
-								}
-							}
-						});
+				this.mOtrFingerprintToClipboardButton.setVisibility(View.VISIBLE);
+				this.mOtrFingerprintToClipboardButton.setOnClickListener(v -> {
+					if (copyTextToClipboard(CryptoHelper.prettifyFingerprint(otrFingerprint), R.string.otr_fingerprint)) {
+						Toast.makeText(
+								EditAccountActivity.this,
+								R.string.toast_message_otr_fingerprint,
+								Toast.LENGTH_SHORT).show();
+					}
+				});
 			} else {
 				this.mOtrFingerprintBox.setVisibility(View.GONE);
 			}
@@ -1034,30 +1010,22 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
 					this.mOwnFingerprintDesc.setText(R.string.omemo_fingerprint);
 				}
 				this.mAxolotlFingerprint.setText(CryptoHelper.prettifyFingerprint(ownAxolotlFingerprint.substring(2)));
-				this.mAxolotlFingerprintToClipboardButton
-						.setVisibility(View.VISIBLE);
-				this.mAxolotlFingerprintToClipboardButton
-						.setOnClickListener(new View.OnClickListener() {
-
-							@Override
-							public void onClick(final View v) {
-								copyOmemoFingerprint(ownAxolotlFingerprint);
-							}
-						});
+				this.mAxolotlFingerprintToClipboardButton.setVisibility(View.VISIBLE);
+				this.mAxolotlFingerprintToClipboardButton.setOnClickListener(v -> copyOmemoFingerprint(ownAxolotlFingerprint));
 			} else {
 				this.mAxolotlFingerprintBox.setVisibility(View.GONE);
 			}
 			boolean hasKeys = false;
 			keys.removeAllViews();
-			for(XmppAxolotlSession session : mAccount.getAxolotlService().findOwnSessions()) {
+			for (XmppAxolotlSession session : mAccount.getAxolotlService().findOwnSessions()) {
 				if (!session.getTrust().isCompromised()) {
 					boolean highlight = session.getFingerprint().equals(messageFingerprint);
-					addFingerprintRow(keys,session,highlight);
+					addFingerprintRow(keys, session, highlight);
 					hasKeys = true;
 				}
 			}
 			if (hasKeys && Config.supportOmemo()) {
-				keysCard.setVisibility(View.VISIBLE);
+				this.binding.otherDeviceKeysCard.setVisibility(View.VISIBLE);
 				Set<Integer> otherDevices = mAccount.getAxolotlService().getOwnDeviceIds();
 				if (otherDevices == null || otherDevices.isEmpty()) {
 					mClearDevicesButton.setVisibility(View.GONE);
@@ -1065,7 +1033,7 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
 					mClearDevicesButton.setVisibility(View.VISIBLE);
 				}
 			} else {
-				keysCard.setVisibility(View.GONE);
+				this.binding.otherDeviceKeysCard.setVisibility(View.GONE);
 			}
 		} else {
 			final TextInputLayout errorLayout;
@@ -1087,12 +1055,13 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
 				errorLayout = null;
 			}
 			removeErrorsOnAllBut(errorLayout);
-			this.mStats.setVisibility(View.GONE);
+			this.binding.stats.setVisibility(View.GONE);
+			this.binding.otherDeviceKeysCard.setVisibility(View.GONE);
 		}
 	}
 
 	private void removeErrorsOnAllBut(TextInputLayout exception) {
-		if (this.mAccountJidLayout != exception){
+		if (this.mAccountJidLayout != exception) {
 			this.mAccountJidLayout.setErrorEnabled(false);
 			this.mAccountJidLayout.setError(null);
 		}
@@ -1114,54 +1083,45 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
 		AlertDialog.Builder builder = new AlertDialog.Builder(this);
 		builder.setTitle(R.string.unpublish_pgp);
 		builder.setMessage(R.string.unpublish_pgp_message);
-		builder.setNegativeButton(R.string.cancel,null);
-		builder.setPositiveButton(R.string.confirm, new DialogInterface.OnClickListener() {
-			@Override
-			public void onClick(DialogInterface dialogInterface, int i) {
-				mAccount.setPgpSignId(0);
-				mAccount.unsetPgpSignature();
-				xmppConnectionService.databaseBackend.updateAccount(mAccount);
-				xmppConnectionService.sendPresence(mAccount);
-				refreshUiReal();
-			}
+		builder.setNegativeButton(R.string.cancel, null);
+		builder.setPositiveButton(R.string.confirm, (dialogInterface, i) -> {
+			mAccount.setPgpSignId(0);
+			mAccount.unsetPgpSignature();
+			xmppConnectionService.databaseBackend.updateAccount(mAccount);
+			xmppConnectionService.sendPresence(mAccount);
+			refreshUiReal();
 		});
 		builder.create().show();
 	}
 
 	private void showOsOptimizationWarning(boolean showBatteryWarning, boolean showDataSaverWarning) {
-		this.mOsOptimizations.setVisibility(showBatteryWarning || showDataSaverWarning ? View.VISIBLE : View.GONE);
+		this.binding.osOptimization.setVisibility(showBatteryWarning || showDataSaverWarning ? View.VISIBLE : View.GONE);
 		if (showDataSaverWarning) {
-			this.mDisableOsOptimizationsHeadline.setText(R.string.data_saver_enabled);
+			this.binding.osOptimizationHeadline.setText(R.string.data_saver_enabled);
 			this.getmDisableOsOptimizationsBody.setText(R.string.data_saver_enabled_explained);
 			this.mDisableOsOptimizationsButton.setText(R.string.allow);
-			this.mDisableOsOptimizationsButton.setOnClickListener(new OnClickListener() {
-				@Override
-				public void onClick(View v) {
-					Intent intent = new Intent(Settings.ACTION_IGNORE_BACKGROUND_DATA_RESTRICTIONS_SETTINGS);
-					Uri uri = Uri.parse("package:"+getPackageName());
-					intent.setData(uri);
-					try {
-						startActivityForResult(intent, REQUEST_DATA_SAVER);
-					} catch (ActivityNotFoundException e) {
-						Toast.makeText(EditAccountActivity.this, R.string.device_does_not_support_data_saver, Toast.LENGTH_SHORT).show();
-					}
+			this.mDisableOsOptimizationsButton.setOnClickListener(v -> {
+				Intent intent = new Intent(Settings.ACTION_IGNORE_BACKGROUND_DATA_RESTRICTIONS_SETTINGS);
+				Uri uri = Uri.parse("package:" + getPackageName());
+				intent.setData(uri);
+				try {
+					startActivityForResult(intent, REQUEST_DATA_SAVER);
+				} catch (ActivityNotFoundException e) {
+					Toast.makeText(EditAccountActivity.this, R.string.device_does_not_support_data_saver, Toast.LENGTH_SHORT).show();
 				}
 			});
 		} else if (showBatteryWarning) {
 			this.mDisableOsOptimizationsButton.setText(R.string.disable);
-			this.mDisableOsOptimizationsHeadline.setText(R.string.battery_optimizations_enabled);
+			this.binding.osOptimizationHeadline.setText(R.string.battery_optimizations_enabled);
 			this.getmDisableOsOptimizationsBody.setText(R.string.battery_optimizations_enabled_explained);
-			this.mDisableOsOptimizationsButton.setOnClickListener(new OnClickListener() {
-				@Override
-				public void onClick(View v) {
-					Intent intent = new Intent(Settings.ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS);
-					Uri uri = Uri.parse("package:"+getPackageName());
-					intent.setData(uri);
-					try {
-						startActivityForResult(intent, REQUEST_BATTERY_OP);
-					} catch (ActivityNotFoundException e) {
-						Toast.makeText(EditAccountActivity.this, R.string.device_does_not_support_battery_op, Toast.LENGTH_SHORT).show();
-					}
+			this.mDisableOsOptimizationsButton.setOnClickListener(v -> {
+				Intent intent = new Intent(Settings.ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS);
+				Uri uri = Uri.parse("package:" + getPackageName());
+				intent.setData(uri);
+				try {
+					startActivityForResult(intent, REQUEST_BATTERY_OP);
+				} catch (ActivityNotFoundException e) {
+					Toast.makeText(EditAccountActivity.this, R.string.device_does_not_support_battery_op, Toast.LENGTH_SHORT).show();
 				}
 			});
 		}
@@ -1174,12 +1134,7 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
 		builder.setMessage(getString(R.string.clear_other_devices_desc));
 		builder.setNegativeButton(getString(R.string.cancel), null);
 		builder.setPositiveButton(getString(R.string.accept),
-				new DialogInterface.OnClickListener() {
-					@Override
-					public void onClick(DialogInterface dialog, int which) {
-						mAccount.getAxolotlService().wipeOtherPepDevices();
-					}
-				});
+				(dialog, which) -> mAccount.getAxolotlService().wipeOtherPepDevices());
 		builder.create().show();
 	}
 
@@ -1196,112 +1151,80 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
 
 	@Override
 	public void onCaptchaRequested(final Account account, final String id, final Data data, final Bitmap captcha) {
-		runOnUiThread(new Runnable() {
-			@Override
-			public void run() {
-				if ((mCaptchaDialog != null) && mCaptchaDialog.isShowing()) {
-					mCaptchaDialog.dismiss();
-				}
-				final AlertDialog.Builder builder = new AlertDialog.Builder(EditAccountActivity.this);
-				final View view = getLayoutInflater().inflate(R.layout.captcha, null);
-				final ImageView imageView = view.findViewById(R.id.captcha);
-				final EditText input = view.findViewById(R.id.input);
-				imageView.setImageBitmap(captcha);
-
-				builder.setTitle(getString(R.string.captcha_required));
-				builder.setView(view);
-
-				builder.setPositiveButton(getString(R.string.ok),
-						new DialogInterface.OnClickListener() {
-							@Override
-							public void onClick(DialogInterface dialog, int which) {
-								String rc = input.getText().toString();
-								data.put("username", account.getUsername());
-								data.put("password", account.getPassword());
-								data.put("ocr", rc);
-								data.submit();
-
-								if (xmppConnectionServiceBound) {
-									xmppConnectionService.sendCreateAccountWithCaptchaPacket(
-											account, id, data);
-								}
-							}
-						});
-				builder.setNegativeButton(getString(R.string.cancel), new DialogInterface.OnClickListener() {
-					@Override
-					public void onClick(DialogInterface dialog, int which) {
-						if (xmppConnectionService != null) {
-							xmppConnectionService.sendCreateAccountWithCaptchaPacket(account, null, null);
+		runOnUiThread(() -> {
+			if (mCaptchaDialog != null && mCaptchaDialog.isShowing()) {
+				mCaptchaDialog.dismiss();
+			}
+			final Builder builder = new Builder(EditAccountActivity.this);
+			final View view = getLayoutInflater().inflate(R.layout.captcha, null);
+			final ImageView imageView = view.findViewById(R.id.captcha);
+			final EditText input = view.findViewById(R.id.input);
+			imageView.setImageBitmap(captcha);
+
+			builder.setTitle(getString(R.string.captcha_required));
+			builder.setView(view);
+
+			builder.setPositiveButton(getString(R.string.ok),
+					(dialog, which) -> {
+						String rc = input.getText().toString();
+						data.put("username", account.getUsername());
+						data.put("password", account.getPassword());
+						data.put("ocr", rc);
+						data.submit();
+
+						if (xmppConnectionServiceBound) {
+							xmppConnectionService.sendCreateAccountWithCaptchaPacket(account, id, data);
 						}
-					}
-				});
+					});
+			builder.setNegativeButton(getString(R.string.cancel), (dialog, which) -> {
+				if (xmppConnectionService != null) {
+					xmppConnectionService.sendCreateAccountWithCaptchaPacket(account, null, null);
+				}
+			});
 
-				builder.setOnCancelListener(new DialogInterface.OnCancelListener() {
-					@Override
-					public void onCancel(DialogInterface dialog) {
-						if (xmppConnectionService != null) {
-							xmppConnectionService.sendCreateAccountWithCaptchaPacket(account, null, null);
-						}
-					}
-				});
-				mCaptchaDialog = builder.create();
-				mCaptchaDialog.show();
-				input.requestFocus();
-			}
+			builder.setOnCancelListener(dialog -> {
+				if (xmppConnectionService != null) {
+					xmppConnectionService.sendCreateAccountWithCaptchaPacket(account, null, null);
+				}
+			});
+			mCaptchaDialog = builder.create();
+			mCaptchaDialog.show();
+			input.requestFocus();
 		});
 	}
 
 	public void onShowErrorToast(final int resId) {
-		runOnUiThread(new Runnable() {
-			@Override
-			public void run() {
-				Toast.makeText(EditAccountActivity.this, resId, Toast.LENGTH_SHORT).show();
-			}
-		});
+		runOnUiThread(() -> Toast.makeText(EditAccountActivity.this, resId, Toast.LENGTH_SHORT).show());
 	}
 
 	@Override
 	public void onPreferencesFetched(final Element prefs) {
-		runOnUiThread(new Runnable() {
-			@Override
-			public void run() {
-				if (mFetchingMamPrefsToast != null) {
-					mFetchingMamPrefsToast.cancel();
-				}
-				AlertDialog.Builder builder = new Builder(EditAccountActivity.this);
-				builder.setTitle(R.string.server_side_mam_prefs);
-				String defaultAttr = prefs.getAttribute("default");
-				final List<String> defaults = Arrays.asList("never", "roster", "always");
-				final AtomicInteger choice = new AtomicInteger(Math.max(0,defaults.indexOf(defaultAttr)));
-				builder.setSingleChoiceItems(R.array.mam_prefs, choice.get(), new DialogInterface.OnClickListener() {
-					@Override
-					public void onClick(DialogInterface dialog, int which) {
-						choice.set(which);
-					}
-				});
-				builder.setNegativeButton(R.string.cancel, null);
-				builder.setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() {
-					@Override
-					public void onClick(DialogInterface dialog, int which) {
-						prefs.setAttribute("default",defaults.get(choice.get()));
-						xmppConnectionService.pushMamPreferences(mAccount, prefs);
-					}
-				});
-				builder.create().show();
+		runOnUiThread(() -> {
+			if (mFetchingMamPrefsToast != null) {
+				mFetchingMamPrefsToast.cancel();
 			}
+			Builder builder = new Builder(EditAccountActivity.this);
+			builder.setTitle(R.string.server_side_mam_prefs);
+			String defaultAttr = prefs.getAttribute("default");
+			final List<String> defaults = Arrays.asList("never", "roster", "always");
+			final AtomicInteger choice = new AtomicInteger(Math.max(0, defaults.indexOf(defaultAttr)));
+			builder.setSingleChoiceItems(R.array.mam_prefs, choice.get(), (dialog, which) -> choice.set(which));
+			builder.setNegativeButton(R.string.cancel, null);
+			builder.setPositiveButton(R.string.ok, (dialog, which) -> {
+				prefs.setAttribute("default", defaults.get(choice.get()));
+				xmppConnectionService.pushMamPreferences(mAccount, prefs);
+			});
+			builder.create().show();
 		});
 	}
 
 	@Override
 	public void onPreferencesFetchFailed() {
-		runOnUiThread(new Runnable() {
-			@Override
-			public void run() {
-				if (mFetchingMamPrefsToast != null) {
-					mFetchingMamPrefsToast.cancel();
-				}
-				Toast.makeText(EditAccountActivity.this,R.string.unable_to_fetch_mam_prefs,Toast.LENGTH_LONG).show();
+		runOnUiThread(() -> {
+			if (mFetchingMamPrefsToast != null) {
+				mFetchingMamPrefsToast.cancel();
 			}
+			Toast.makeText(EditAccountActivity.this, R.string.unable_to_fetch_mam_prefs, Toast.LENGTH_LONG).show();
 		});
 	}
 

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

@@ -1,707 +1,725 @@
 <?xml version="1.0" encoding="utf-8"?>
-<RelativeLayout 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"
-    android:layout_width="match_parent"
-    android:layout_height="match_parent"
-    android:background="?attr/color_background_secondary">
-
-    <ScrollView
-        android:layout_width="fill_parent"
-        android:layout_height="wrap_content"
-        android:layout_above="@+id/button_bar"
-        android:layout_alignParentTop="true">
+<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/account_main_layout"
-            android:layout_width="match_parent"
+    <RelativeLayout
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
+        android:background="?attr/color_background_secondary">
+
+        <ScrollView
+            android:layout_width="fill_parent"
             android:layout_height="wrap_content"
-            android:orientation="vertical">
+            android:layout_above="@+id/button_bar"
+            android:layout_alignParentTop="true">
 
-            <RelativeLayout
-                android:id="@+id/editor"
-                android:layout_width="fill_parent"
+            <LinearLayout
+                android:id="@+id/account_main_layout"
+                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:background="?attr/infocard_border"
-                android:orientation="vertical"
-                android:padding="@dimen/infocard_padding">
-
-                <com.makeramen.roundedimageview.RoundedImageView
-                    android:id="@+id/avater"
-                    android:layout_width="72dp"
-                    android:layout_height="72dp"
-                    android:layout_alignParentTop="true"
-                    android:layout_marginRight="16dp"
-                    android:contentDescription="@string/account_image_description"
-                    app:riv_corner_radius="2dp" />
-
-                <LinearLayout
-                    android:layout_width="fill_parent"
-                    android:layout_height="wrap_content"
-                    android:layout_toRightOf="@+id/avater"
-                    android:orientation="vertical">
+                android:orientation="vertical">
 
-                    <android.support.design.widget.TextInputLayout
-                        android:id="@+id/account_jid_layout"
-                        android:layout_width="match_parent"
-                        android:layout_height="wrap_content"
-                        android:hint="@string/account_settings_jabber_id">
-
-                        <AutoCompleteTextView
-                            android:id="@+id/account_jid"
-                            android:layout_width="match_parent"
-                            android:layout_height="wrap_content"
-                            android:imeOptions="actionNext"
-                            android:inputType="textEmailAddress"
-                            android:textColor="?attr/color_text_primary"
-                            android:textColorHint="?attr/color_text_secondary"
-                            android:textSize="?attr/TextSizeBody" />
-                    </android.support.design.widget.TextInputLayout>
 
+                <android.support.v7.widget.CardView
+                    android:id="@+id/editor"
+                    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.support.design.widget.TextInputLayout
-                        android:id="@+id/account_password_layout"
+                    <RelativeLayout
                         android:layout_width="match_parent"
                         android:layout_height="wrap_content"
-                        app:passwordToggleDrawable="@drawable/visibility_toggle_drawable"
-                        app:passwordToggleEnabled="true"
-                        app:passwordToggleTint="?attr/color_text_secondary">
+                        android:padding="@dimen/infocard_padding">
 
-                        <android.support.design.widget.TextInputEditText
-                            android:id="@+id/account_password"
-                            android:layout_width="match_parent"
-                            android:layout_height="wrap_content"
+                        <com.makeramen.roundedimageview.RoundedImageView
+                            android:id="@+id/avater"
+                            android:layout_width="72dp"
+                            android:layout_height="72dp"
                             android:layout_alignParentTop="true"
-                            android:hint="@string/password"
-                            android:inputType="textPassword"
-                            android:textColor="?attr/color_text_primary"
-                            android:textColorHint="?attr/color_text_secondary"
-                            android:textSize="?attr/TextSizeBody" />
-                    </android.support.design.widget.TextInputLayout>
-
-                    <LinearLayout
-                        android:id="@+id/name_port"
-                        android:layout_width="fill_parent"
-                        android:layout_height="wrap_content"
-                        android:layout_marginTop="8dp"
-                        android:orientation="horizontal"
-                        android:weightSum="1">
+                            android:layout_marginRight="16dp"
+                            android:contentDescription="@string/account_image_description"
+                            app:riv_corner_radius="2dp"/>
 
                         <LinearLayout
-                            android:layout_width="0dp"
-                            android:layout_height="match_parent"
-                            android:layout_weight="0.8"
+                            android:layout_width="fill_parent"
+                            android:layout_height="wrap_content"
+                            android:layout_toRightOf="@+id/avater"
                             android:orientation="vertical">
 
                             <android.support.design.widget.TextInputLayout
+                                android:id="@+id/account_jid_layout"
                                 android:layout_width="match_parent"
                                 android:layout_height="wrap_content"
-                                android:id="@+id/hostname_layout"
-                                android:hint="@string/account_settings_hostname">
+                                android:hint="@string/account_settings_jabber_id">
 
-                                <EditText
-                                    android:id="@+id/hostname"
-                                    android:layout_width="fill_parent"
+                                <AutoCompleteTextView
+                                    android:id="@+id/account_jid"
+                                    android:layout_width="match_parent"
                                     android:layout_height="wrap_content"
-                                    android:inputType="textNoSuggestions"
+                                    android:imeOptions="actionNext"
+                                    android:inputType="textEmailAddress"
                                     android:textColor="?attr/color_text_primary"
                                     android:textColorHint="?attr/color_text_secondary"
-                                    android:textSize="?attr/TextSizeBody" />
+                                    android:textSize="?attr/TextSizeBody"/>
                             </android.support.design.widget.TextInputLayout>
-                        </LinearLayout>
 
-                        <LinearLayout
-                            android:layout_width="0dp"
-                            android:layout_height="match_parent"
-                            android:layout_weight="0.2"
-                            android:orientation="vertical">
 
                             <android.support.design.widget.TextInputLayout
+                                android:id="@+id/account_password_layout"
                                 android:layout_width="match_parent"
                                 android:layout_height="wrap_content"
-                                android:id="@+id/port_layout"
-                                android:hint="@string/account_settings_port">
+                                app:passwordToggleDrawable="@drawable/visibility_toggle_drawable"
+                                app:passwordToggleEnabled="true"
+                                app:passwordToggleTint="?attr/color_text_secondary">
 
-                                <EditText
-                                    android:id="@+id/port"
+                                <android.support.design.widget.TextInputEditText
+                                    android:id="@+id/account_password"
                                     android:layout_width="match_parent"
-                                    android:layout_height="match_parent"
-                                    android:inputType="number"
-                                    android:maxLength="5"
+                                    android:layout_height="wrap_content"
+                                    android:layout_alignParentTop="true"
+                                    android:hint="@string/password"
+                                    android:inputType="textPassword"
                                     android:textColor="?attr/color_text_primary"
                                     android:textColorHint="?attr/color_text_secondary"
-                                    android:textSize="?attr/TextSizeBody" />
+                                    android:textSize="?attr/TextSizeBody"/>
                             </android.support.design.widget.TextInputLayout>
-                        </LinearLayout>
-                    </LinearLayout>
 
-                    <CheckBox
-                        android:id="@+id/account_register_new"
-                        android:layout_width="wrap_content"
-                        android:layout_height="wrap_content"
-                        android:layout_marginTop="8dp"
-                        android:text="@string/register_account"
-                        android:textColor="?attr/color_text_primary"
-                        android:textSize="?attr/TextSizeBody" />
-                </LinearLayout>
-            </RelativeLayout>
-
-            <RelativeLayout
-                android:id="@+id/os_optimization"
-                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:background="?attr/infocard_border"
-                android:orientation="vertical"
-                android:padding="@dimen/infocard_padding"
-                android:visibility="gone">
-
-                <TextView
-                    android:id="@+id/os_optimization_headline"
-                    android:layout_width="wrap_content"
-                    android:layout_height="wrap_content"
-                    android:text="@string/battery_optimizations_enabled"
-                    android:textColor="?attr/color_text_primary"
-                    android:textSize="?attr/TextSizeHeadline"
-                    android:textStyle="bold" />
-
-                <TextView
-                    android:id="@+id/os_optimization_body"
-                    android:layout_width="wrap_content"
-                    android:layout_height="wrap_content"
-                    android:layout_below="@+id/os_optimization_headline"
-                    android:layout_marginBottom="8dp"
-                    android:layout_marginTop="8dp"
-                    android:text="@string/battery_optimizations_enabled_explained"
-                    android:textColor="?attr/color_text_primary"
-                    android:textSize="?attr/TextSizeBody" />
-
-                <Button
-                    android:id="@+id/os_optimization_disable"
-                    style="?android:attr/borderlessButtonStyle"
-                    android:layout_width="wrap_content"
-                    android:layout_height="wrap_content"
-                    android:layout_alignParentBottom="true"
-                    android:layout_alignParentEnd="true"
-                    android:layout_alignParentRight="true"
-                    android:layout_below="@+id/os_optimization_body"
-                    android:layout_marginRight="-8dp"
-                    android:text="@string/disable"
-                    android:textColor="@color/accent" />
-            </RelativeLayout>
+                            <LinearLayout
+                                android:id="@+id/name_port"
+                                android:layout_width="fill_parent"
+                                android:layout_height="wrap_content"
+                                android:layout_marginTop="8dp"
+                                android:orientation="horizontal"
+                                android:weightSum="1">
 
+                                <LinearLayout
+                                    android:layout_width="0dp"
+                                    android:layout_height="match_parent"
+                                    android:layout_weight="0.8"
+                                    android:orientation="vertical">
+
+                                    <android.support.design.widget.TextInputLayout
+                                        android:id="@+id/hostname_layout"
+                                        android:layout_width="match_parent"
+                                        android:layout_height="wrap_content"
+                                        android:hint="@string/account_settings_hostname">
+
+                                        <EditText
+                                            android:id="@+id/hostname"
+                                            android:layout_width="fill_parent"
+                                            android:layout_height="wrap_content"
+                                            android:inputType="textNoSuggestions"
+                                            android:textColor="?attr/color_text_primary"
+                                            android:textColorHint="?attr/color_text_secondary"
+                                            android:textSize="?attr/TextSizeBody"/>
+                                    </android.support.design.widget.TextInputLayout>
+                                </LinearLayout>
+
+                                <LinearLayout
+                                    android:layout_width="0dp"
+                                    android:layout_height="match_parent"
+                                    android:layout_weight="0.2"
+                                    android:orientation="vertical">
+
+                                    <android.support.design.widget.TextInputLayout
+                                        android:id="@+id/port_layout"
+                                        android:layout_width="match_parent"
+                                        android:layout_height="wrap_content"
+                                        android:hint="@string/account_settings_port">
+
+                                        <EditText
+                                            android:id="@+id/port"
+                                            android:layout_width="match_parent"
+                                            android:layout_height="match_parent"
+                                            android:inputType="number"
+                                            android:maxLength="5"
+                                            android:textColor="?attr/color_text_primary"
+                                            android:textColorHint="?attr/color_text_secondary"
+                                            android:textSize="?attr/TextSizeBody"/>
+                                    </android.support.design.widget.TextInputLayout>
+                                </LinearLayout>
+                            </LinearLayout>
+
+                            <CheckBox
+                                android:id="@+id/account_register_new"
+                                android:layout_width="wrap_content"
+                                android:layout_height="wrap_content"
+                                android:layout_marginTop="8dp"
+                                android:text="@string/register_account"
+                                android:textColor="?attr/color_text_primary"
+                                android:textSize="?attr/TextSizeBody"/>
+                        </LinearLayout>
+                    </RelativeLayout>
+                </android.support.v7.widget.CardView>
 
-            <LinearLayout
-                android:id="@+id/stats"
-                android:layout_width="fill_parent"
-                android:layout_height="fill_parent"
-                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:background="?attr/infocard_border"
-                android:orientation="vertical"
-                android:padding="@dimen/infocard_padding"
-                android:visibility="gone">
-
-                <TableLayout
-                    android:layout_width="match_parent"
+                <android.support.v7.widget.CardView
+                    android:id="@+id/os_optimization"
+                    android:layout_width="fill_parent"
                     android:layout_height="wrap_content"
-                    android:shrinkColumns="0"
-                    android:stretchColumns="1">
+                    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:visibility="gone">
 
-                    <TableRow
-                        android:layout_width="fill_parent"
+                    <RelativeLayout
+                        android:layout_width="match_parent"
                         android:layout_height="wrap_content"
-                        tools:ignore="UselessParent">
+                        android:padding="@dimen/infocard_padding">
 
                         <TextView
+                            android:id="@+id/os_optimization_headline"
                             android:layout_width="wrap_content"
                             android:layout_height="wrap_content"
-                            android:ellipsize="end"
-                            android:singleLine="true"
-                            android:text="@string/server_info_session_established"
+                            android:text="@string/battery_optimizations_enabled"
                             android:textColor="?attr/color_text_primary"
-                            android:textSize="?attr/TextSizeBody" />
+                            android:textSize="?attr/TextSizeHeadline"
+                            android:textStyle="bold"/>
 
                         <TextView
-                            android:id="@+id/session_est"
+                            android:id="@+id/os_optimization_body"
                             android:layout_width="wrap_content"
                             android:layout_height="wrap_content"
-                            android:layout_gravity="right"
-                            android:paddingLeft="4dp"
+                            android:layout_below="@+id/os_optimization_headline"
+                            android:layout_marginBottom="8dp"
+                            android:layout_marginTop="8dp"
+                            android:text="@string/battery_optimizations_enabled_explained"
                             android:textColor="?attr/color_text_primary"
-                            android:textSize="?attr/TextSizeBody"
-                            tools:ignore="RtlHardcoded" />
-                    </TableRow>
+                            android:textSize="?attr/TextSizeBody"/>
 
-                </TableLayout>
-
-                <TableLayout
-                    android:id="@+id/server_info_more"
-                    android:layout_width="match_parent"
-                    android:layout_height="wrap_content"
-                    android:shrinkColumns="0"
-                    android:stretchColumns="1"
+                        <Button
+                            android:id="@+id/os_optimization_disable"
+                            style="?android:attr/borderlessButtonStyle"
+                            android:layout_width="wrap_content"
+                            android:layout_height="wrap_content"
+                            android:layout_alignParentBottom="true"
+                            android:layout_alignParentEnd="true"
+                            android:layout_alignParentRight="true"
+                            android:layout_below="@+id/os_optimization_body"
+                            android:layout_marginRight="-8dp"
+                            android:text="@string/disable"
+                            android:textColor="@color/accent"/>
+                    </RelativeLayout>
+                </android.support.v7.widget.CardView>
+
+
+                <android.support.v7.widget.CardView
+                    android:id="@+id/stats"
+                    android:layout_width="fill_parent"
+                    android:layout_height="fill_parent"
+                    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:visibility="gone">
 
-                    <TableRow
-                        android:layout_width="fill_parent"
-                        android:layout_height="wrap_content">
+                    <LinearLayout
+                        android:layout_width="match_parent"
+                        android:layout_height="wrap_content"
+                        android:orientation="vertical"
+                        android:padding="@dimen/infocard_padding">
 
-                        <TextView
-                            android:layout_width="wrap_content"
+                        <TableLayout
+                            android:layout_width="match_parent"
                             android:layout_height="wrap_content"
-                            android:ellipsize="end"
-                            android:singleLine="true"
-                            android:text="@string/server_info_pep"
-                            android:textColor="?attr/color_text_primary"
-                            android:textSize="?attr/TextSizeBody" />
+                            android:shrinkColumns="0"
+                            android:stretchColumns="1">
 
-                        <TextView
-                            android:id="@+id/server_info_pep"
-                            android:layout_width="wrap_content"
-                            android:layout_height="wrap_content"
-                            android:layout_gravity="right"
-                            android:paddingLeft="4dp"
-                            android:textColor="?attr/color_text_primary"
-                            android:textSize="?attr/TextSizeBody"
-                            tools:ignore="RtlHardcoded" />
-                    </TableRow>
+                            <TableRow
+                                android:layout_width="fill_parent"
+                                android:layout_height="wrap_content"
+                                tools:ignore="UselessParent">
 
-                    <TableRow
-                        android:layout_width="fill_parent"
-                        android:layout_height="wrap_content">
+                                <TextView
+                                    android:layout_width="wrap_content"
+                                    android:layout_height="wrap_content"
+                                    android:ellipsize="end"
+                                    android:singleLine="true"
+                                    android:text="@string/server_info_session_established"
+                                    android:textColor="?attr/color_text_primary"
+                                    android:textSize="?attr/TextSizeBody"/>
 
-                        <TextView
-                            android:layout_width="wrap_content"
-                            android:layout_height="wrap_content"
-                            android:ellipsize="end"
-                            android:singleLine="true"
-                            android:text="@string/server_info_blocking"
-                            android:textColor="?attr/color_text_primary"
-                            android:textSize="?attr/TextSizeBody" />
+                                <TextView
+                                    android:id="@+id/session_est"
+                                    android:layout_width="wrap_content"
+                                    android:layout_height="wrap_content"
+                                    android:layout_gravity="right"
+                                    android:paddingLeft="4dp"
+                                    android:textColor="?attr/color_text_primary"
+                                    android:textSize="?attr/TextSizeBody"
+                                    tools:ignore="RtlHardcoded"/>
+                            </TableRow>
 
-                        <TextView
-                            android:id="@+id/server_info_blocking"
-                            android:layout_width="wrap_content"
+                        </TableLayout>
+
+                        <TableLayout
+                            android:id="@+id/server_info_more"
+                            android:layout_width="match_parent"
                             android:layout_height="wrap_content"
-                            android:layout_gravity="right"
-                            android:paddingLeft="4dp"
-                            android:textColor="?attr/color_text_primary"
-                            android:textSize="?attr/TextSizeBody"
-                            tools:ignore="RtlHardcoded" />
-                    </TableRow>
+                            android:shrinkColumns="0"
+                            android:stretchColumns="1"
+                            android:visibility="gone">
 
-                    <TableRow
-                        android:layout_width="fill_parent"
-                        android:layout_height="wrap_content">
+                            <TableRow
+                                android:layout_width="fill_parent"
+                                android:layout_height="wrap_content">
 
-                        <TextView
-                            android:layout_width="wrap_content"
-                            android:layout_height="wrap_content"
-                            android:ellipsize="end"
-                            android:singleLine="true"
-                            android:text="@string/server_info_stream_management"
-                            android:textColor="?attr/color_text_primary"
-                            android:textSize="?attr/TextSizeBody" />
+                                <TextView
+                                    android:layout_width="wrap_content"
+                                    android:layout_height="wrap_content"
+                                    android:ellipsize="end"
+                                    android:singleLine="true"
+                                    android:text="@string/server_info_pep"
+                                    android:textColor="?attr/color_text_primary"
+                                    android:textSize="?attr/TextSizeBody"/>
 
-                        <TextView
-                            android:id="@+id/server_info_sm"
-                            android:layout_width="wrap_content"
-                            android:layout_height="wrap_content"
-                            android:layout_gravity="right"
-                            android:paddingLeft="4dp"
-                            android:textColor="?attr/color_text_primary"
-                            android:textSize="?attr/TextSizeBody"
-                            tools:ignore="RtlHardcoded" />
-                    </TableRow>
+                                <TextView
+                                    android:id="@+id/server_info_pep"
+                                    android:layout_width="wrap_content"
+                                    android:layout_height="wrap_content"
+                                    android:layout_gravity="right"
+                                    android:paddingLeft="4dp"
+                                    android:textColor="?attr/color_text_primary"
+                                    android:textSize="?attr/TextSizeBody"
+                                    tools:ignore="RtlHardcoded"/>
+                            </TableRow>
 
-                    <TableRow
-                        android:layout_width="fill_parent"
-                        android:layout_height="wrap_content">
+                            <TableRow
+                                android:layout_width="fill_parent"
+                                android:layout_height="wrap_content">
 
-                        <TextView
-                            android:layout_width="wrap_content"
-                            android:layout_height="wrap_content"
-                            android:ellipsize="end"
-                            android:singleLine="true"
-                            android:text="@string/server_info_roster_version"
-                            android:textColor="?attr/color_text_primary"
-                            android:textSize="?attr/TextSizeBody" />
+                                <TextView
+                                    android:layout_width="wrap_content"
+                                    android:layout_height="wrap_content"
+                                    android:ellipsize="end"
+                                    android:singleLine="true"
+                                    android:text="@string/server_info_blocking"
+                                    android:textColor="?attr/color_text_primary"
+                                    android:textSize="?attr/TextSizeBody"/>
 
-                        <TextView
-                            android:id="@+id/server_info_roster_version"
-                            android:layout_width="wrap_content"
-                            android:layout_height="wrap_content"
-                            android:layout_gravity="right"
-                            android:paddingLeft="4dp"
-                            android:textColor="?attr/color_text_primary"
-                            android:textSize="?attr/TextSizeBody"
-                            tools:ignore="RtlHardcoded" />
-                    </TableRow>
+                                <TextView
+                                    android:id="@+id/server_info_blocking"
+                                    android:layout_width="wrap_content"
+                                    android:layout_height="wrap_content"
+                                    android:layout_gravity="right"
+                                    android:paddingLeft="4dp"
+                                    android:textColor="?attr/color_text_primary"
+                                    android:textSize="?attr/TextSizeBody"
+                                    tools:ignore="RtlHardcoded"/>
+                            </TableRow>
 
-                    <TableRow
-                        android:layout_width="fill_parent"
-                        android:layout_height="wrap_content">
+                            <TableRow
+                                android:layout_width="fill_parent"
+                                android:layout_height="wrap_content">
 
-                        <TextView
-                            android:layout_width="wrap_content"
-                            android:layout_height="wrap_content"
-                            android:ellipsize="end"
-                            android:singleLine="true"
-                            android:text="@string/server_info_carbon_messages"
-                            android:textColor="?attr/color_text_primary"
-                            android:textSize="?attr/TextSizeBody" />
+                                <TextView
+                                    android:layout_width="wrap_content"
+                                    android:layout_height="wrap_content"
+                                    android:ellipsize="end"
+                                    android:singleLine="true"
+                                    android:text="@string/server_info_stream_management"
+                                    android:textColor="?attr/color_text_primary"
+                                    android:textSize="?attr/TextSizeBody"/>
 
-                        <TextView
-                            android:id="@+id/server_info_carbons"
-                            android:layout_width="wrap_content"
-                            android:layout_height="wrap_content"
-                            android:layout_gravity="right"
-                            android:paddingLeft="4dp"
-                            android:textColor="?attr/color_text_primary"
-                            android:textSize="?attr/TextSizeBody"
-                            tools:ignore="RtlHardcoded" />
-                    </TableRow>
+                                <TextView
+                                    android:id="@+id/server_info_sm"
+                                    android:layout_width="wrap_content"
+                                    android:layout_height="wrap_content"
+                                    android:layout_gravity="right"
+                                    android:paddingLeft="4dp"
+                                    android:textColor="?attr/color_text_primary"
+                                    android:textSize="?attr/TextSizeBody"
+                                    tools:ignore="RtlHardcoded"/>
+                            </TableRow>
 
-                    <TableRow
-                        android:layout_width="fill_parent"
-                        android:layout_height="wrap_content">
+                            <TableRow
+                                android:layout_width="fill_parent"
+                                android:layout_height="wrap_content">
 
-                        <TextView
-                            android:layout_width="wrap_content"
-                            android:layout_height="wrap_content"
-                            android:ellipsize="end"
-                            android:singleLine="true"
-                            android:text="@string/server_info_mam"
-                            android:textColor="?attr/color_text_primary"
-                            android:textSize="?attr/TextSizeBody" />
+                                <TextView
+                                    android:layout_width="wrap_content"
+                                    android:layout_height="wrap_content"
+                                    android:ellipsize="end"
+                                    android:singleLine="true"
+                                    android:text="@string/server_info_roster_version"
+                                    android:textColor="?attr/color_text_primary"
+                                    android:textSize="?attr/TextSizeBody"/>
 
-                        <TextView
-                            android:id="@+id/server_info_mam"
-                            android:layout_width="wrap_content"
-                            android:layout_height="wrap_content"
-                            android:layout_gravity="right"
-                            android:paddingLeft="4dp"
-                            android:textColor="?attr/color_text_primary"
-                            android:textSize="?attr/TextSizeBody"
-                            tools:ignore="RtlHardcoded" />
-                    </TableRow>
+                                <TextView
+                                    android:id="@+id/server_info_roster_version"
+                                    android:layout_width="wrap_content"
+                                    android:layout_height="wrap_content"
+                                    android:layout_gravity="right"
+                                    android:paddingLeft="4dp"
+                                    android:textColor="?attr/color_text_primary"
+                                    android:textSize="?attr/TextSizeBody"
+                                    tools:ignore="RtlHardcoded"/>
+                            </TableRow>
 
-                    <TableRow
-                        android:layout_width="fill_parent"
-                        android:layout_height="wrap_content">
+                            <TableRow
+                                android:layout_width="fill_parent"
+                                android:layout_height="wrap_content">
 
-                        <TextView
-                            android:layout_width="wrap_content"
-                            android:layout_height="wrap_content"
-                            android:ellipsize="end"
-                            android:singleLine="true"
-                            android:text="@string/server_info_csi"
-                            android:textColor="?attr/color_text_primary"
-                            android:textSize="?attr/TextSizeBody" />
+                                <TextView
+                                    android:layout_width="wrap_content"
+                                    android:layout_height="wrap_content"
+                                    android:ellipsize="end"
+                                    android:singleLine="true"
+                                    android:text="@string/server_info_carbon_messages"
+                                    android:textColor="?attr/color_text_primary"
+                                    android:textSize="?attr/TextSizeBody"/>
 
-                        <TextView
-                            android:id="@+id/server_info_csi"
-                            android:layout_width="wrap_content"
-                            android:layout_height="wrap_content"
-                            android:layout_gravity="right"
-                            android:paddingLeft="4dp"
-                            android:textColor="?attr/color_text_primary"
-                            android:textSize="?attr/TextSizeBody"
-                            tools:ignore="RtlHardcoded" />
-                    </TableRow>
+                                <TextView
+                                    android:id="@+id/server_info_carbons"
+                                    android:layout_width="wrap_content"
+                                    android:layout_height="wrap_content"
+                                    android:layout_gravity="right"
+                                    android:paddingLeft="4dp"
+                                    android:textColor="?attr/color_text_primary"
+                                    android:textSize="?attr/TextSizeBody"
+                                    tools:ignore="RtlHardcoded"/>
+                            </TableRow>
 
-                    <TableRow
-                        android:id="@+id/push_row"
-                        android:layout_width="fill_parent"
-                        android:layout_height="wrap_content">
+                            <TableRow
+                                android:layout_width="fill_parent"
+                                android:layout_height="wrap_content">
 
-                        <TextView
-                            android:layout_width="wrap_content"
-                            android:layout_height="wrap_content"
-                            android:ellipsize="end"
-                            android:singleLine="true"
-                            android:text="@string/server_info_push"
-                            android:textColor="?attr/color_text_primary"
-                            android:textSize="?attr/TextSizeBody" />
+                                <TextView
+                                    android:layout_width="wrap_content"
+                                    android:layout_height="wrap_content"
+                                    android:ellipsize="end"
+                                    android:singleLine="true"
+                                    android:text="@string/server_info_mam"
+                                    android:textColor="?attr/color_text_primary"
+                                    android:textSize="?attr/TextSizeBody"/>
 
-                        <TextView
-                            android:id="@+id/server_info_push"
-                            android:layout_width="wrap_content"
-                            android:layout_height="wrap_content"
-                            android:layout_gravity="right"
-                            android:paddingLeft="4dp"
-                            android:textColor="?attr/color_text_primary"
-                            android:textSize="?attr/TextSizeBody" />
-                    </TableRow>
+                                <TextView
+                                    android:id="@+id/server_info_mam"
+                                    android:layout_width="wrap_content"
+                                    android:layout_height="wrap_content"
+                                    android:layout_gravity="right"
+                                    android:paddingLeft="4dp"
+                                    android:textColor="?attr/color_text_primary"
+                                    android:textSize="?attr/TextSizeBody"
+                                    tools:ignore="RtlHardcoded"/>
+                            </TableRow>
 
-                    <TableRow
-                        android:layout_width="fill_parent"
-                        android:layout_height="wrap_content">
+                            <TableRow
+                                android:layout_width="fill_parent"
+                                android:layout_height="wrap_content">
 
-                        <TextView
-                            android:layout_width="wrap_content"
-                            android:layout_height="wrap_content"
-                            android:ellipsize="end"
-                            android:singleLine="true"
-                            android:text="@string/server_info_http_upload"
-                            android:textColor="?attr/color_text_primary"
-                            android:textSize="?attr/TextSizeBody" />
+                                <TextView
+                                    android:layout_width="wrap_content"
+                                    android:layout_height="wrap_content"
+                                    android:ellipsize="end"
+                                    android:singleLine="true"
+                                    android:text="@string/server_info_csi"
+                                    android:textColor="?attr/color_text_primary"
+                                    android:textSize="?attr/TextSizeBody"/>
 
-                        <TextView
-                            android:id="@+id/server_info_http_upload"
-                            android:layout_width="wrap_content"
-                            android:layout_height="wrap_content"
-                            android:layout_gravity="right"
-                            android:paddingLeft="4dp"
-                            android:textColor="?attr/color_text_primary"
-                            android:textSize="?attr/TextSizeBody" />
-                    </TableRow>
-                </TableLayout>
+                                <TextView
+                                    android:id="@+id/server_info_csi"
+                                    android:layout_width="wrap_content"
+                                    android:layout_height="wrap_content"
+                                    android:layout_gravity="right"
+                                    android:paddingLeft="4dp"
+                                    android:textColor="?attr/color_text_primary"
+                                    android:textSize="?attr/TextSizeBody"
+                                    tools:ignore="RtlHardcoded"/>
+                            </TableRow>
 
-                <RelativeLayout
-                    android:id="@+id/pgp_fingerprint_box"
-                    android:layout_width="wrap_content"
-                    android:layout_height="match_parent"
-                    android:layout_marginTop="32dp">
+                            <TableRow
+                                android:id="@+id/push_row"
+                                android:layout_width="fill_parent"
+                                android:layout_height="wrap_content">
 
-                    <LinearLayout
-                        android:layout_width="wrap_content"
-                        android:layout_height="wrap_content"
-                        android:layout_alignParentLeft="true"
-                        android:layout_centerVertical="true"
-                        android:layout_toLeftOf="@+id/action_delete_pgp"
-                        android:orientation="vertical">
+                                <TextView
+                                    android:layout_width="wrap_content"
+                                    android:layout_height="wrap_content"
+                                    android:ellipsize="end"
+                                    android:singleLine="true"
+                                    android:text="@string/server_info_push"
+                                    android:textColor="?attr/color_text_primary"
+                                    android:textSize="?attr/TextSizeBody"/>
 
-                        <TextView
-                            android:id="@+id/pgp_fingerprint"
-                            android:layout_width="wrap_content"
-                            android:layout_height="wrap_content"
-                            android:fontFamily="monospace"
-                            android:textColor="?attr/color_text_primary"
-                            android:textSize="?attr/TextSizeBody"
-                            android:typeface="monospace" />
+                                <TextView
+                                    android:id="@+id/server_info_push"
+                                    android:layout_width="wrap_content"
+                                    android:layout_height="wrap_content"
+                                    android:layout_gravity="right"
+                                    android:paddingLeft="4dp"
+                                    android:textColor="?attr/color_text_primary"
+                                    android:textSize="?attr/TextSizeBody"/>
+                            </TableRow>
 
-                        <TextView
-                            android:id="@+id/pgp_fingerprint_desc"
-                            android:layout_width="wrap_content"
-                            android:layout_height="wrap_content"
-                            android:text="@string/openpgp_key_id"
-                            android:textColor="?attr/color_text_secondary"
-                            android:textSize="?attr/TextSizeInfo" />
-                    </LinearLayout>
+                            <TableRow
+                                android:layout_width="fill_parent"
+                                android:layout_height="wrap_content">
 
-                    <ImageButton
-                        android:id="@+id/action_delete_pgp"
-                        android:layout_width="wrap_content"
-                        android:layout_height="wrap_content"
-                        android:layout_alignParentRight="true"
-                        android:layout_centerVertical="true"
-                        android:alpha="?attr/icon_alpha"
-                        android:background="?attr/selectableItemBackgroundBorderless"
-                        android:padding="@dimen/image_button_padding"
-                        android:src="?attr/icon_remove"
-                        android:visibility="visible" />
-                </RelativeLayout>
-
-                <RelativeLayout
-                    android:id="@+id/otr_fingerprint_box"
-                    android:layout_width="wrap_content"
-                    android:layout_height="match_parent"
-                    android:layout_marginTop="24dp">
+                                <TextView
+                                    android:layout_width="wrap_content"
+                                    android:layout_height="wrap_content"
+                                    android:ellipsize="end"
+                                    android:singleLine="true"
+                                    android:text="@string/server_info_http_upload"
+                                    android:textColor="?attr/color_text_primary"
+                                    android:textSize="?attr/TextSizeBody"/>
 
-                    <LinearLayout
-                        android:layout_width="wrap_content"
-                        android:layout_height="wrap_content"
-                        android:layout_alignParentLeft="true"
-                        android:layout_centerVertical="true"
-                        android:layout_toLeftOf="@+id/action_copy_to_clipboard"
-                        android:orientation="vertical">
+                                <TextView
+                                    android:id="@+id/server_info_http_upload"
+                                    android:layout_width="wrap_content"
+                                    android:layout_height="wrap_content"
+                                    android:layout_gravity="right"
+                                    android:paddingLeft="4dp"
+                                    android:textColor="?attr/color_text_primary"
+                                    android:textSize="?attr/TextSizeBody"/>
+                            </TableRow>
+                        </TableLayout>
 
-                        <TextView
-                            android:id="@+id/otr_fingerprint"
+                        <RelativeLayout
+                            android:id="@+id/pgp_fingerprint_box"
                             android:layout_width="wrap_content"
-                            android:layout_height="wrap_content"
-                            android:fontFamily="monospace"
-                            android:textColor="?attr/color_text_primary"
-                            android:textSize="?attr/TextSizeBody"
-                            android:typeface="monospace" />
+                            android:layout_height="match_parent"
+                            android:layout_marginTop="32dp">
 
-                        <TextView
-                            android:id="@+id/otr_fingerprint_desc"
+                            <LinearLayout
+                                android:layout_width="wrap_content"
+                                android:layout_height="wrap_content"
+                                android:layout_alignParentLeft="true"
+                                android:layout_centerVertical="true"
+                                android:layout_toLeftOf="@+id/action_delete_pgp"
+                                android:orientation="vertical">
+
+                                <TextView
+                                    android:id="@+id/pgp_fingerprint"
+                                    android:layout_width="wrap_content"
+                                    android:layout_height="wrap_content"
+                                    android:fontFamily="monospace"
+                                    android:textColor="?attr/color_text_primary"
+                                    android:textSize="?attr/TextSizeBody"
+                                    android:typeface="monospace"/>
+
+                                <TextView
+                                    android:id="@+id/pgp_fingerprint_desc"
+                                    android:layout_width="wrap_content"
+                                    android:layout_height="wrap_content"
+                                    android:text="@string/openpgp_key_id"
+                                    android:textColor="?attr/color_text_secondary"
+                                    android:textSize="?attr/TextSizeInfo"/>
+                            </LinearLayout>
+
+                            <ImageButton
+                                android:id="@+id/action_delete_pgp"
+                                android:layout_width="wrap_content"
+                                android:layout_height="wrap_content"
+                                android:layout_alignParentRight="true"
+                                android:layout_centerVertical="true"
+                                android:alpha="?attr/icon_alpha"
+                                android:background="?attr/selectableItemBackgroundBorderless"
+                                android:padding="@dimen/image_button_padding"
+                                android:src="?attr/icon_remove"
+                                android:visibility="visible"/>
+                        </RelativeLayout>
+
+                        <RelativeLayout
+                            android:id="@+id/otr_fingerprint_box"
                             android:layout_width="wrap_content"
-                            android:layout_height="wrap_content"
-                            android:text="@string/otr_fingerprint"
-                            android:textColor="?attr/color_text_secondary"
-                            android:textSize="?attr/TextSizeInfo" />
+                            android:layout_height="match_parent"
+                            android:layout_marginTop="24dp">
+
+                            <LinearLayout
+                                android:layout_width="wrap_content"
+                                android:layout_height="wrap_content"
+                                android:layout_alignParentLeft="true"
+                                android:layout_centerVertical="true"
+                                android:layout_toLeftOf="@+id/action_copy_to_clipboard"
+                                android:orientation="vertical">
+
+                                <TextView
+                                    android:id="@+id/otr_fingerprint"
+                                    android:layout_width="wrap_content"
+                                    android:layout_height="wrap_content"
+                                    android:fontFamily="monospace"
+                                    android:textColor="?attr/color_text_primary"
+                                    android:textSize="?attr/TextSizeBody"
+                                    android:typeface="monospace"/>
+
+                                <TextView
+                                    android:id="@+id/otr_fingerprint_desc"
+                                    android:layout_width="wrap_content"
+                                    android:layout_height="wrap_content"
+                                    android:text="@string/otr_fingerprint"
+                                    android:textColor="?attr/color_text_secondary"
+                                    android:textSize="?attr/TextSizeInfo"/>
+                            </LinearLayout>
+
+                            <ImageButton
+                                android:id="@+id/action_copy_to_clipboard"
+                                android:layout_width="wrap_content"
+                                android:layout_height="wrap_content"
+                                android:layout_alignParentRight="true"
+                                android:layout_centerVertical="true"
+                                android:alpha="?attr/icon_alpha"
+                                android:background="?attr/selectableItemBackgroundBorderless"
+                                android:contentDescription="@string/copy_otr_clipboard_description"
+                                android:padding="@dimen/image_button_padding"
+                                android:src="?attr/icon_copy"
+                                android:visibility="visible"/>
+                        </RelativeLayout>
+
+                        <RelativeLayout
+                            android:id="@+id/axolotl_fingerprint_box"
+                            android:layout_width="wrap_content"
+                            android:layout_height="match_parent"
+                            android:layout_marginTop="24dp">
+
+                            <LinearLayout
+                                android:layout_width="wrap_content"
+                                android:layout_height="wrap_content"
+                                android:layout_alignParentLeft="true"
+                                android:layout_centerVertical="true"
+                                android:layout_toLeftOf="@+id/axolotl_actions"
+                                android:orientation="vertical">
+
+                                <TextView
+                                    android:id="@+id/axolotl_fingerprint"
+                                    android:layout_width="wrap_content"
+                                    android:layout_height="wrap_content"
+                                    android:fontFamily="monospace"
+                                    android:textColor="?attr/color_text_primary"
+                                    android:textSize="?attr/TextSizeBody"
+                                    android:typeface="monospace"/>
+
+                                <TextView
+                                    android:id="@+id/own_fingerprint_desc"
+                                    android:layout_width="wrap_content"
+                                    android:layout_height="wrap_content"
+                                    android:text="@string/omemo_fingerprint"
+                                    android:textColor="?attr/color_text_secondary"
+                                    android:textSize="?attr/TextSizeInfo"/>
+                            </LinearLayout>
+
+                            <LinearLayout
+                                android:id="@+id/axolotl_actions"
+                                android:layout_width="wrap_content"
+                                android:layout_height="wrap_content"
+                                android:layout_alignParentRight="true"
+                                android:layout_centerVertical="true"
+                                android:orientation="vertical">
+
+                                <ImageButton
+                                    android:id="@+id/action_copy_axolotl_to_clipboard"
+                                    android:layout_width="wrap_content"
+                                    android:layout_height="wrap_content"
+                                    android:alpha="?attr/icon_alpha"
+                                    android:background="?attr/selectableItemBackgroundBorderless"
+                                    android:contentDescription="@string/copy_omemo_clipboard_description"
+                                    android:padding="@dimen/image_button_padding"
+                                    android:src="?attr/icon_copy"
+                                    android:visibility="visible"/>
+
+                                <ImageButton
+                                    android:id="@+id/action_regenerate_axolotl_key"
+                                    android:layout_width="wrap_content"
+                                    android:layout_height="wrap_content"
+                                    android:alpha="?attr/icon_alpha"
+                                    android:background="?attr/selectableItemBackgroundBorderless"
+                                    android:contentDescription="@string/regenerate_omemo_key"
+                                    android:padding="@dimen/image_button_padding"
+                                    android:src="?attr/icon_refresh"
+                                    android:visibility="gone"/>
+
+                            </LinearLayout>
+                        </RelativeLayout>
                     </LinearLayout>
+                </android.support.v7.widget.CardView>
 
-                    <ImageButton
-                        android:id="@+id/action_copy_to_clipboard"
-                        android:layout_width="wrap_content"
-                        android:layout_height="wrap_content"
-                        android:layout_alignParentRight="true"
-                        android:layout_centerVertical="true"
-                        android:alpha="?attr/icon_alpha"
-                        android:background="?attr/selectableItemBackgroundBorderless"
-                        android:contentDescription="@string/copy_otr_clipboard_description"
-                        android:padding="@dimen/image_button_padding"
-                        android:src="?attr/icon_copy"
-                        android:visibility="visible" />
-                </RelativeLayout>
-
-                <RelativeLayout
-                    android:id="@+id/axolotl_fingerprint_box"
-                    android:layout_width="wrap_content"
-                    android:layout_height="match_parent"
-                    android:layout_marginTop="24dp">
+                <android.support.v7.widget.CardView
+                    android:id="@+id/other_device_keys_card"
+                    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:visibility="gone">
 
                     <LinearLayout
-                        android:layout_width="wrap_content"
+                        android:layout_width="match_parent"
                         android:layout_height="wrap_content"
-                        android:layout_alignParentLeft="true"
-                        android:layout_centerVertical="true"
-                        android:layout_toLeftOf="@+id/axolotl_actions"
-                        android:orientation="vertical">
+                        android:orientation="vertical"
+                        android:padding="@dimen/infocard_padding">
 
                         <TextView
-                            android:id="@+id/axolotl_fingerprint"
+                            android:id="@+id/other_device_keys_title"
                             android:layout_width="wrap_content"
                             android:layout_height="wrap_content"
-                            android:fontFamily="monospace"
+                            android:text="@string/other_devices"
                             android:textColor="?attr/color_text_primary"
-                            android:textSize="?attr/TextSizeBody"
-                            android:typeface="monospace" />
+                            android:textSize="?attr/TextSizeHeadline"
+                            android:textStyle="bold"/>
 
-                        <TextView
-                            android:id="@+id/own_fingerprint_desc"
-                            android:layout_width="wrap_content"
+                        <LinearLayout
+                            android:id="@+id/other_device_keys"
+                            android:layout_width="fill_parent"
                             android:layout_height="wrap_content"
-                            android:text="@string/omemo_fingerprint"
-                            android:textColor="?attr/color_text_secondary"
-                            android:textSize="?attr/TextSizeInfo" />
-                    </LinearLayout>
+                            android:divider="?android:dividerHorizontal"
+                            android:orientation="vertical"
+                            android:showDividers="middle"></LinearLayout>
 
-                    <LinearLayout
-                        android:id="@+id/axolotl_actions"
-                        android:layout_width="wrap_content"
-                        android:layout_height="wrap_content"
-                        android:layout_alignParentRight="true"
-                        android:layout_centerVertical="true"
-                        android:orientation="vertical">
-
-                        <ImageButton
-                            android:id="@+id/action_copy_axolotl_to_clipboard"
+                        <Button
+                            android:id="@+id/clear_devices"
+                            style="?android:attr/borderlessButtonStyle"
                             android:layout_width="wrap_content"
                             android:layout_height="wrap_content"
-                            android:alpha="?attr/icon_alpha"
-                            android:background="?attr/selectableItemBackgroundBorderless"
-                            android:contentDescription="@string/copy_omemo_clipboard_description"
-                            android:padding="@dimen/image_button_padding"
-                            android:src="?attr/icon_copy"
-                            android:visibility="visible" />
-
-                        <ImageButton
-                            android:id="@+id/action_regenerate_axolotl_key"
-                            android:layout_width="wrap_content"
-                            android:layout_height="wrap_content"
-                            android:alpha="?attr/icon_alpha"
-                            android:background="?attr/selectableItemBackgroundBorderless"
-                            android:contentDescription="@string/regenerate_omemo_key"
-                            android:padding="@dimen/image_button_padding"
-                            android:src="?attr/icon_refresh"
-                            android:visibility="gone" />
-
+                            android:layout_gravity="center_horizontal"
+                            android:text="@string/clear_other_devices"
+                            android:textColor="@color/accent"/>
                     </LinearLayout>
-                </RelativeLayout>
+                </android.support.v7.widget.CardView>
             </LinearLayout>
+        </ScrollView>
 
-            <LinearLayout
-                android:id="@+id/other_device_keys_card"
-                android:layout_width="fill_parent"
+        <LinearLayout
+            android:id="@+id/button_bar"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_alignParentBottom="true"
+            android:layout_alignParentEnd="true"
+            android:layout_alignParentLeft="true"
+            android:layout_alignParentRight="true"
+            android:layout_alignParentStart="true">
+
+            <Button
+                android:id="@+id/cancel_button"
+                style="?android:attr/borderlessButtonStyle"
+                android:layout_width="0dp"
                 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:background="?attr/infocard_border"
-                android:orientation="vertical"
-                android:padding="@dimen/infocard_padding"
-                android:visibility="gone">
-
-                <TextView
-                    android:id="@+id/other_device_keys_title"
-                    android:layout_width="wrap_content"
-                    android:layout_height="wrap_content"
-                    android:text="@string/other_devices"
-                    android:textColor="?attr/color_text_primary"
-                    android:textSize="?attr/TextSizeHeadline"
-                    android:textStyle="bold" />
+                android:layout_weight="1"
+                android:text="@string/cancel"
+                android:textColor="?attr/color_text_primary"/>
 
-                <LinearLayout
-                    android:id="@+id/other_device_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/clear_devices"
-                    style="?android:attr/borderlessButtonStyle"
-                    android:layout_width="wrap_content"
-                    android:layout_height="wrap_content"
-                    android:layout_gravity="center_horizontal"
-                    android:text="@string/clear_other_devices"
-                    android:textColor="@color/accent" />
-            </LinearLayout>
+            <View
+                android:layout_width="1dp"
+                android:layout_height="fill_parent"
+                android:layout_marginBottom="7dp"
+                android:layout_marginTop="7dp"
+                android:background="?attr/divider"/>
+
+            <Button
+                android:id="@+id/save_button"
+                style="?android:attr/borderlessButtonStyle"
+                android:layout_width="0dp"
+                android:layout_height="wrap_content"
+                android:layout_weight="1"
+                android:enabled="false"
+                android:text="@string/save"
+                android:textColor="?attr/color_text_secondary"/>
         </LinearLayout>
-    </ScrollView>
-
-    <LinearLayout
-        android:id="@+id/button_bar"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:layout_alignParentBottom="true"
-        android:layout_alignParentEnd="true"
-        android:layout_alignParentLeft="true"
-        android:layout_alignParentRight="true"
-        android:layout_alignParentStart="true">
-
-        <Button
-            android:id="@+id/cancel_button"
-            style="?android:attr/borderlessButtonStyle"
-            android:layout_width="0dp"
-            android:layout_height="wrap_content"
-            android:layout_weight="1"
-            android:text="@string/cancel"
-            android:textColor="?attr/color_text_primary" />
-
-        <View
-            android:layout_width="1dp"
-            android:layout_height="fill_parent"
-            android:layout_marginBottom="7dp"
-            android:layout_marginTop="7dp"
-            android:background="?attr/divider" />
-
-        <Button
-            android:id="@+id/save_button"
-            style="?android:attr/borderlessButtonStyle"
-            android:layout_width="0dp"
-            android:layout_height="wrap_content"
-            android:layout_weight="1"
-            android:enabled="false"
-            android:text="@string/save"
-            android:textColor="?attr/color_text_secondary" />
-    </LinearLayout>
 
-</RelativeLayout>
+    </RelativeLayout>
+</layout>