Better check of empty address field instead of try catch
This commit is contained in:
parent
f4274ed03e
commit
3bd4f3fe3a
1 changed files with 24 additions and 26 deletions
|
|
@ -102,7 +102,11 @@ public class LoginActivity extends AbsBaseActivity implements View.OnClickListen
|
||||||
credentialProvider = new AndroidCredentialProvider(jsonSerializer, this, logger);
|
credentialProvider = new AndroidCredentialProvider(jsonSerializer, this, logger);
|
||||||
ConnectionManager connectionManager = App.getConnectionManager(context, jsonSerializer, logger, httpClient);
|
ConnectionManager connectionManager = App.getConnectionManager(context, jsonSerializer, logger, httpClient);
|
||||||
|
|
||||||
try {
|
if (server.getText().toString().trim().length() == 0) {
|
||||||
|
Toast.makeText(context, context.getResources().getString(R.string.error_login_empty_addr), Toast.LENGTH_SHORT).show();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
connectionManager.Connect(server.getText().toString(), new Response<ConnectionResult>() {
|
connectionManager.Connect(server.getText().toString(), new Response<ConnectionResult>() {
|
||||||
@Override
|
@Override
|
||||||
public void onResponse(ConnectionResult result) {
|
public void onResponse(ConnectionResult result) {
|
||||||
|
|
@ -124,13 +128,7 @@ public class LoginActivity extends AbsBaseActivity implements View.OnClickListen
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} catch (IllegalArgumentException e) {
|
|
||||||
if (e.getMessage().equals("address")) {
|
|
||||||
Toast.makeText(context, context.getResources().getString(R.string.error_login_empty_addr), Toast.LENGTH_SHORT).show();
|
|
||||||
} else {
|
|
||||||
Toast.makeText(context, context.getResources().getString(R.string.error_unexpected), Toast.LENGTH_SHORT).show();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue