1
0
mirror of https://github.com/etesync/android synced 2024-12-23 15:18:14 +00:00

Don't require URI in login credentials constructor.

This commit is contained in:
Tom Hacohen 2017-02-08 11:46:17 +00:00
parent d62d7049f2
commit 1363865660
2 changed files with 17 additions and 8 deletions

View File

@ -12,7 +12,10 @@ import android.os.Parcel;
import android.os.Parcelable;
import java.net.URI;
import java.net.URISyntaxException;
import at.bitfire.davdroid.App;
import at.bitfire.davdroid.Constants;
import lombok.RequiredArgsConstructor;
@RequiredArgsConstructor
@ -20,6 +23,19 @@ public class LoginCredentials implements Parcelable {
public final URI uri;
public final String userName, password;
public LoginCredentials(String userName, String password) {
this.userName = userName;
this.password = password;
URI uri = null;
try {
uri = new URI(Constants.serviceUrl.toString());
} catch (URISyntaxException e) {
App.log.severe("Should never happen, it's a constant");
}
this.uri = uri;
}
@Override
public int describeContents() {
return 0;

View File

@ -78,13 +78,6 @@ public class LoginCredentialsFragment extends Fragment {
protected LoginCredentials validateLoginData() {
boolean valid = true;
URI uri = null;
try {
uri = new URI(Constants.serviceUrl.toString());
} catch (URISyntaxException e) {
App.log.severe("Should never happen, it's a constant");
}
String userName = editUserName.getText().toString();
if (userName.isEmpty()) {
editUserName.setError(getString(R.string.login_user_name_required));
@ -97,7 +90,7 @@ public class LoginCredentialsFragment extends Fragment {
valid = false;
}
return valid ? new LoginCredentials(uri, userName, password) : null;
return valid ? new LoginCredentials(userName, password) : null;
}
}