1 package org.fedorahosted.freeotp;
3 import android.app.AlertDialog;
4 import android.text.Editable;
5 import android.text.TextWatcher;
6 import android.widget.Button;
7 import android.widget.EditText;
9 public class AddTokenTextWatcher implements TextWatcher {
10 private final AlertDialog dialog;
12 public AddTokenTextWatcher(AlertDialog dialog) {
17 public void beforeTextChanged(CharSequence s, int start, int count, int after) {
22 public void onTextChanged(CharSequence s, int start, int before, int count) {
23 Button b = dialog.getButton(AlertDialog.BUTTON_POSITIVE);
27 if (((EditText) dialog.findViewById(R.id.issuer)).getText().length() == 0)
30 if (((EditText) dialog.findViewById(R.id.id)).getText().length() == 0)
33 if (((EditText) dialog.findViewById(R.id.secret)).getText().length() == 0 ||
34 ((EditText) dialog.findViewById(R.id.secret)).getText().length() % 8 != 0)
37 if (((EditText) dialog.findViewById(R.id.interval)).getText().length() == 0)
44 public void afterTextChanged(Editable s) {