Skip to content

Commit b2a348d

Browse files
author
James Stapleton
committed
Merge branch 'release/v2.0.0'
- generated password now updates on changes for softkeyboards on real devices
2 parents 119a98f + 86741a9 commit b2a348d

File tree

3 files changed

+34
-9
lines changed

3 files changed

+34
-9
lines changed

passwordmaker/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ android {
4242
defaultConfig {
4343
minSdkVersion 15 //2014-06-15: 84.3% of android users are using Sdk Version 15+. So lets shoot for that.
4444
targetSdkVersion 19
45-
versionCode 20000
45+
versionCode 20001
4646
versionName getVersionName()
4747
}
4848

passwordmaker/src/main/java/org/passwordmaker/android/MainActivity.java

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
import android.os.Message;
1111
import android.support.v7.app.ActionBarActivity;
1212
import android.text.ClipboardManager;
13+
import android.text.Editable;
14+
import android.text.TextWatcher;
1315
import android.util.Log;
1416
import android.view.*;
1517
import android.widget.*;
@@ -73,14 +75,14 @@ protected void onCreate(Bundle savedInstanceState) {
7375

7476
AutoCompleteTextView inputText = (AutoCompleteTextView) findViewById(R.id.txtInput);
7577
if (inputText != null) {
76-
inputText.setOnKeyListener(mUpdatePasswordKeyListener);
78+
inputText.addTextChangedListener(createUpdatePasswordKeyListener());
7779
inputText.setOnFocusChangeListener(mUpdatePasswordFocusListener);
7880
inputText.setAdapter(favoritesAdapter);
7981
inputText.setThreshold(1);
8082
}
8183
TextView text = (TextView) findViewById(R.id.txtMasterPass);
8284
if (text != null)
83-
text.setOnKeyListener(mUpdatePasswordKeyListener);
85+
text.addTextChangedListener(createUpdatePasswordKeyListener());
8486
if (text != null)
8587
text.setOnFocusChangeListener(mUpdatePasswordFocusListener);
8688
Button button = (Button) findViewById(R.id.btnCopy);
@@ -395,12 +397,14 @@ public void onClick(DialogInterface dialog, int which) {
395397
alert.show();
396398
}
397399

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+
}
404408

405409
private View.OnClickListener mCopyButtonClick = new View.OnClickListener() {
406410

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package org.passwordmaker.android;
2+
3+
import android.text.Editable;
4+
import android.text.TextWatcher;
5+
6+
public abstract class TextWatcherAdapter implements TextWatcher {
7+
@Override
8+
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
9+
10+
}
11+
12+
@Override
13+
public void onTextChanged(CharSequence s, int start, int before, int count) {
14+
15+
}
16+
17+
@Override
18+
public void afterTextChanged(Editable s) {
19+
20+
}
21+
}

0 commit comments

Comments
 (0)