blob: 448eba52794ea9938f0acf0d11f9c4680df12f17 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
package se.leap.bitmaskclient;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.design.widget.TextInputEditText;
import android.support.design.widget.TextInputLayout;
import android.text.Editable;
import android.text.TextWatcher;
import butterknife.InjectView;
import butterknife.OnClick;
/**
* Create an account with a provider
*/
public class SignupActivity extends ProviderCredentialsBaseActivity {
@InjectView(R.id.provider_credentials_password_verification)
TextInputEditText providerCredentialsPasswordVerification;
@InjectView(R.id.provider_credentials_password_verification_layout)
TextInputLayout providerCredentialsPasswordVerificationLayout;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.a_signup);
setProviderHeaderLogo(R.drawable.mask);
setProviderHeaderText(R.string.create_profile);
setProgressbarText(R.string.signing_up);
setButtonText(R.string.signup_button);
providerCredentialsPasswordVerification.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
}
@Override
public void afterTextChanged(Editable s) {
if(getPassword().equals(getPasswordVerification())) {
providerCredentialsPasswordVerificationLayout.setError(null);
} else {
providerCredentialsPasswordVerificationLayout.setError(getString(R.string.password_mismatch));
}
}
});
}
@Override
@OnClick(R.id.button)
void handleButton() {
if (getPassword().equals(getPasswordVerification())) {
signUp(getUsername(), getPassword());
}
}
private String getPasswordVerification() {
return providerCredentialsPasswordVerification.getText().toString();
}
}
|