do not validate port if hostname is empty. closes #3578

This commit is contained in:
Daniel Gultsch 2019-11-03 22:03:46 +01:00
parent f7b7464a65
commit 7f25d91d33
1 changed files with 23 additions and 16 deletions

View File

@ -228,6 +228,7 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
removeErrorsOnAllBut(binding.hostnameLayout); removeErrorsOnAllBut(binding.hostnameLayout);
return; return;
} }
if (!hostname.isEmpty()) {
try { try {
numericPort = Integer.parseInt(port); numericPort = Integer.parseInt(port);
if (numericPort < 0 || numericPort > 65535) { if (numericPort < 0 || numericPort > 65535) {
@ -244,6 +245,7 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
return; return;
} }
} }
}
if (jid.getLocal() == null) { if (jid.getLocal() == null) {
if (mUsernameMode) { if (mUsernameMode) {
@ -477,8 +479,13 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
} }
private void updatePortLayout() { private void updatePortLayout() {
String hostname = this.binding.hostname.getText().toString(); final String hostname = this.binding.hostname.getText().toString();
this.binding.portLayout.setEnabled(!TextUtils.isEmpty(hostname)); if (TextUtils.isEmpty(hostname)) {
this.binding.portLayout.setEnabled(false);
this.binding.portLayout.setError(null);
} else {
this.binding.portLayout.setEnabled(true);
}
} }
protected void updateSaveButton() { protected void updateSaveButton() {
@ -613,7 +620,7 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
} }
private void refreshAvatar() { private void refreshAvatar() {
AvatarWorkerTask.loadAvatar(mAccount,binding.avater,R.dimen.avatar_on_details_screen_size); AvatarWorkerTask.loadAvatar(mAccount, binding.avater, R.dimen.avatar_on_details_screen_size);
} }
@Override @Override
@ -683,9 +690,9 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
} }
boolean init = intent.getBooleanExtra("init", false); boolean init = intent.getBooleanExtra("init", false);
boolean openedFromNotification = intent.getBooleanExtra(EXTRA_OPENED_FROM_NOTIFICATION, false); boolean openedFromNotification = intent.getBooleanExtra(EXTRA_OPENED_FROM_NOTIFICATION, false);
Log.d(Config.LOGTAG,"extras "+intent.getExtras()); Log.d(Config.LOGTAG, "extras " + intent.getExtras());
this.mForceRegister = intent.hasExtra(EXTRA_FORCE_REGISTER) ? intent.getBooleanExtra(EXTRA_FORCE_REGISTER,false) : null; this.mForceRegister = intent.hasExtra(EXTRA_FORCE_REGISTER) ? intent.getBooleanExtra(EXTRA_FORCE_REGISTER, false) : null;
Log.d(Config.LOGTAG,"force register="+mForceRegister); Log.d(Config.LOGTAG, "force register=" + mForceRegister);
this.mInitMode = init || this.jidToEdit == null; this.mInitMode = init || this.jidToEdit == null;
this.messageFingerprint = intent.getStringExtra("fingerprint"); this.messageFingerprint = intent.getStringExtra("fingerprint");
if (!mInitMode) { if (!mInitMode) {
@ -975,7 +982,7 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
if (!mInitMode) { if (!mInitMode) {
this.binding.avater.setVisibility(View.VISIBLE); this.binding.avater.setVisibility(View.VISIBLE);
AvatarWorkerTask.loadAvatar(mAccount,binding.avater,R.dimen.avatar_on_details_screen_size); AvatarWorkerTask.loadAvatar(mAccount, binding.avater, R.dimen.avatar_on_details_screen_size);
} else { } else {
this.binding.avater.setVisibility(View.GONE); this.binding.avater.setVisibility(View.GONE);
} }