mirror of
https://github.com/etesync/android
synced 2024-12-24 15:38:09 +00:00
Don't require URI in login credentials constructor.
This commit is contained in:
parent
d62d7049f2
commit
1363865660
@ -12,7 +12,10 @@ import android.os.Parcel;
|
|||||||
import android.os.Parcelable;
|
import android.os.Parcelable;
|
||||||
|
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
|
import java.net.URISyntaxException;
|
||||||
|
|
||||||
|
import at.bitfire.davdroid.App;
|
||||||
|
import at.bitfire.davdroid.Constants;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
|
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
@ -20,6 +23,19 @@ public class LoginCredentials implements Parcelable {
|
|||||||
public final URI uri;
|
public final URI uri;
|
||||||
public final String userName, password;
|
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
|
@Override
|
||||||
public int describeContents() {
|
public int describeContents() {
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -78,13 +78,6 @@ public class LoginCredentialsFragment extends Fragment {
|
|||||||
protected LoginCredentials validateLoginData() {
|
protected LoginCredentials validateLoginData() {
|
||||||
boolean valid = true;
|
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();
|
String userName = editUserName.getText().toString();
|
||||||
if (userName.isEmpty()) {
|
if (userName.isEmpty()) {
|
||||||
editUserName.setError(getString(R.string.login_user_name_required));
|
editUserName.setError(getString(R.string.login_user_name_required));
|
||||||
@ -97,7 +90,7 @@ public class LoginCredentialsFragment extends Fragment {
|
|||||||
valid = false;
|
valid = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return valid ? new LoginCredentials(uri, userName, password) : null;
|
return valid ? new LoginCredentials(userName, password) : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user