|
10 | 10 | import android.os.Message;
|
11 | 11 | import android.support.v7.app.ActionBarActivity;
|
12 | 12 | import android.text.ClipboardManager;
|
| 13 | +import android.text.Editable; |
| 14 | +import android.text.TextWatcher; |
13 | 15 | import android.util.Log;
|
14 | 16 | import android.view.*;
|
15 | 17 | import android.widget.*;
|
@@ -73,14 +75,14 @@ protected void onCreate(Bundle savedInstanceState) {
|
73 | 75 |
|
74 | 76 | AutoCompleteTextView inputText = (AutoCompleteTextView) findViewById(R.id.txtInput);
|
75 | 77 | if (inputText != null) {
|
76 |
| - inputText.setOnKeyListener(mUpdatePasswordKeyListener); |
| 78 | + inputText.addTextChangedListener(createUpdatePasswordKeyListener()); |
77 | 79 | inputText.setOnFocusChangeListener(mUpdatePasswordFocusListener);
|
78 | 80 | inputText.setAdapter(favoritesAdapter);
|
79 | 81 | inputText.setThreshold(1);
|
80 | 82 | }
|
81 | 83 | TextView text = (TextView) findViewById(R.id.txtMasterPass);
|
82 | 84 | if (text != null)
|
83 |
| - text.setOnKeyListener(mUpdatePasswordKeyListener); |
| 85 | + text.addTextChangedListener(createUpdatePasswordKeyListener()); |
84 | 86 | if (text != null)
|
85 | 87 | text.setOnFocusChangeListener(mUpdatePasswordFocusListener);
|
86 | 88 | Button button = (Button) findViewById(R.id.btnCopy);
|
@@ -395,12 +397,14 @@ public void onClick(DialogInterface dialog, int which) {
|
395 | 397 | alert.show();
|
396 | 398 | }
|
397 | 399 |
|
398 |
| - private View.OnKeyListener mUpdatePasswordKeyListener = new View.OnKeyListener() { |
399 |
| - public boolean onKey(View v, int keyCode, KeyEvent event) { |
400 |
| - updatePassword(true); |
401 |
| - return false; |
402 |
| - } |
403 |
| - }; |
| 400 | + private TextWatcher createUpdatePasswordKeyListener() { |
| 401 | + return new TextWatcherAdapter() { |
| 402 | + @Override |
| 403 | + public void afterTextChanged(Editable s) { |
| 404 | + updatePassword(true); |
| 405 | + } |
| 406 | + }; |
| 407 | + } |
404 | 408 |
|
405 | 409 | private View.OnClickListener mCopyButtonClick = new View.OnClickListener() {
|
406 | 410 |
|
|
0 commit comments