Fix displayedName not cleared.

Cleared in onTextChanged
This commit is contained in:
Guillaume Beraudo 2011-03-11 15:54:56 +01:00
parent ebd65a01b7
commit 44ed6687dc
3 changed files with 11 additions and 4 deletions

View file

@ -41,11 +41,20 @@ public class AddressText extends EditText implements AddressType {
} }
public void setContactAddress(String uri, String displayedName) { public void setContactAddress(String uri, String displayedName) {
this.displayedName = displayedName;
setText(uri); setText(uri);
this.displayedName = displayedName;
} }
public void setDisplayedName(String displayedName) { public void setDisplayedName(String displayedName) {
this.displayedName = displayedName; this.displayedName = displayedName;
} }
@Override
protected void onTextChanged(CharSequence text, int start, int before,
int after) {
clearDisplayedName();
super.onTextChanged(text, start, before, after);
}
} }

View file

@ -87,12 +87,11 @@ public class Digit extends Button implements AddressAware {
} else if (mAddress != null) { } else if (mAddress != null) {
int lBegin = mAddress.getSelectionStart(); int lBegin = mAddress.getSelectionStart();
if (lBegin == -1) { if (lBegin == -1) {
lBegin = mAddress.getEditableText().length(); lBegin = mAddress.length();
} }
if (lBegin >=0) { if (lBegin >=0) {
mAddress.getEditableText().insert(lBegin,mKeyCode); mAddress.getEditableText().insert(lBegin,mKeyCode);
} }
mAddress.clearDisplayedName();
} }
} }

View file

@ -36,7 +36,6 @@ public class EraseButton extends Button implements OnClickListener, OnLongClickL
} }
public void onClick(View v) { public void onClick(View v) {
address.clearDisplayedName();
if (address.getText().length() >0) { if (address.getText().length() >0) {
int lBegin = address.getSelectionStart(); int lBegin = address.getSelectionStart();
if (lBegin == -1) { if (lBegin == -1) {