blob: f6344065f236ac5085e871c3b89477ceaac1869e (
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
|
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);
setProviderHeaderText("providerNAME");
setProviderHeaderLogo(R.drawable.mask);
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();
}
}
|