diff options
author | Christian Schneppe <christian@pix-art.de> | 2018-11-23 14:00:56 +0100 |
---|---|---|
committer | Christian Schneppe <christian@pix-art.de> | 2018-11-23 14:00:56 +0100 |
commit | 21b4f2476c8879e7711571a5f1b9bfd0c56fda51 (patch) | |
tree | 7b9bfd6dacb05b0fc9b9eb95c76dd30b42d12a44 /src/main/java/de | |
parent | 06ada3372ea812adb3ea1233bc6e224f7ba3de8b (diff) |
move default port to Resolver.java
Diffstat (limited to '')
-rw-r--r-- | src/main/java/de/pixart/messenger/ui/EditAccountActivity.java | 14 | ||||
-rw-r--r-- | src/main/java/de/pixart/messenger/utils/Resolver.java | 7 |
2 files changed, 10 insertions, 11 deletions
diff --git a/src/main/java/de/pixart/messenger/ui/EditAccountActivity.java b/src/main/java/de/pixart/messenger/ui/EditAccountActivity.java index 2f004a165..113d0ed23 100644 --- a/src/main/java/de/pixart/messenger/ui/EditAccountActivity.java +++ b/src/main/java/de/pixart/messenger/ui/EditAccountActivity.java @@ -67,6 +67,7 @@ import de.pixart.messenger.ui.util.SoftKeyboardUtils; import de.pixart.messenger.utils.CryptoHelper; import de.pixart.messenger.utils.MenuDoubleTabUtil; import de.pixart.messenger.utils.Namespace; +import de.pixart.messenger.utils.Resolver; import de.pixart.messenger.utils.SignupUtils; import de.pixart.messenger.utils.UIHelper; import de.pixart.messenger.utils.XmppUri; @@ -563,20 +564,17 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat this.binding.hostname.addTextChangedListener(mTextWatcher); this.binding.hostname.setOnFocusChangeListener(mEditTextFocusListener); this.binding.clearDevices.setOnClickListener(v -> showWipePepDialog()); - this.binding.port.setText("5222"); + this.binding.port.setText(String.valueOf(Resolver.DEFAULT_PORT_XMPP)); this.binding.port.addTextChangedListener(mTextWatcher); this.binding.saveButton.setOnClickListener(this.mSaveButtonClickListener); this.binding.cancelButton.setOnClickListener(this.mCancelButtonClickListener); if (savedInstanceState != null && savedInstanceState.getBoolean("showMoreTable")) { changeMoreTableVisibility(true); } - final OnCheckedChangeListener OnCheckedShowConfirmPassword = new OnCheckedChangeListener() { - @Override - public void onCheckedChanged(final CompoundButton buttonView, final boolean isChecked) { - updatePortLayout(); - updateSaveButton(); - updateInfoButtons(); - } + final OnCheckedChangeListener OnCheckedShowConfirmPassword = (buttonView, isChecked) -> { + updatePortLayout(); + updateSaveButton(); + updateInfoButtons(); }; this.binding.accountRegisterNew.setOnCheckedChangeListener(OnCheckedShowConfirmPassword); if (Config.DISALLOW_REGISTRATION_IN_UI) { diff --git a/src/main/java/de/pixart/messenger/utils/Resolver.java b/src/main/java/de/pixart/messenger/utils/Resolver.java index f2716a648..2378c429e 100644 --- a/src/main/java/de/pixart/messenger/utils/Resolver.java +++ b/src/main/java/de/pixart/messenger/utils/Resolver.java @@ -37,6 +37,7 @@ import de.pixart.messenger.services.XmppConnectionService; public class Resolver { + public static final int DEFAULT_PORT_XMPP = 5222; private static final String DIRECT_TLS_SERVICE = "_xmpps-client"; private static final String STARTTLS_SERICE = "_xmpp-client"; @@ -150,7 +151,7 @@ public class Resolver { try { Result result = new Result(); result.ip = InetAddress.getByName(domain); - result.port = 5222; + result.port = DEFAULT_PORT_XMPP; return Collections.singletonList(result); } catch (UnknownHostException e) { return Collections.emptyList(); @@ -270,7 +271,7 @@ public class Resolver { public static final String AUTHENTICATED = "authenticated"; private InetAddress ip; private DNSName hostname; - private int port = 5222; + private int port = DEFAULT_PORT_XMPP; private boolean directTls = false; private boolean authenticated = false; private int priority; @@ -286,7 +287,7 @@ public class Resolver { static Result createDefault(DNSName hostname, InetAddress ip) { Result result = new Result(); - result.port = 5222; + result.port = DEFAULT_PORT_XMPP; result.hostname = hostname; result.ip = ip; return result; |