mirror of
https://github.com/moparisthebest/open-keychain
synced 2024-11-24 09:42:16 -05:00
some fixes
This commit is contained in:
parent
e7ebbc5ef6
commit
d6726fe9d6
@ -83,6 +83,24 @@ public class UserIdEditor extends LinearLayout implements Editor, OnClickListene
|
|||||||
super(context, attrs);
|
super(context, attrs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TextWatcher mTextWatcher = new TextWatcher() {
|
||||||
|
@Override
|
||||||
|
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void afterTextChanged(Editable s)
|
||||||
|
{
|
||||||
|
if (mEditorListener != null) {
|
||||||
|
mEditorListener.onEdited();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onFinishInflate() {
|
protected void onFinishInflate() {
|
||||||
setDrawingCacheEnabled(true);
|
setDrawingCacheEnabled(true);
|
||||||
@ -94,25 +112,11 @@ public class UserIdEditor extends LinearLayout implements Editor, OnClickListene
|
|||||||
mIsMainUserId.setOnClickListener(this);
|
mIsMainUserId.setOnClickListener(this);
|
||||||
|
|
||||||
mName = (EditText) findViewById(R.id.name);
|
mName = (EditText) findViewById(R.id.name);
|
||||||
mName.addTextChangedListener(new TextWatcher() {
|
mName.addTextChangedListener(mTextWatcher);
|
||||||
@Override
|
|
||||||
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void afterTextChanged(Editable s)
|
|
||||||
{
|
|
||||||
if (mEditorListener != null) {
|
|
||||||
mEditorListener.onEdited();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
mEmail = (EditText) findViewById(R.id.email);
|
mEmail = (EditText) findViewById(R.id.email);
|
||||||
|
mEmail.addTextChangedListener(mTextWatcher);
|
||||||
mComment = (EditText) findViewById(R.id.comment);
|
mComment = (EditText) findViewById(R.id.comment);
|
||||||
|
mComment.addTextChangedListener(mTextWatcher);
|
||||||
|
|
||||||
super.onFinishInflate();
|
super.onFinishInflate();
|
||||||
}
|
}
|
||||||
@ -120,8 +124,11 @@ public class UserIdEditor extends LinearLayout implements Editor, OnClickListene
|
|||||||
public void setValue(String userId, boolean isMainID, boolean isNewId) {
|
public void setValue(String userId, boolean isMainID, boolean isNewId) {
|
||||||
|
|
||||||
mName.setText("");
|
mName.setText("");
|
||||||
|
mOriginalName = "";
|
||||||
mComment.setText("");
|
mComment.setText("");
|
||||||
|
mOriginalComment = "";
|
||||||
mEmail.setText("");
|
mEmail.setText("");
|
||||||
|
mOriginalEmail = "";
|
||||||
mIsNewId = isNewId;
|
mIsNewId = isNewId;
|
||||||
|
|
||||||
String[] result = PgpKeyHelper.splitUserId(userId);
|
String[] result = PgpKeyHelper.splitUserId(userId);
|
||||||
@ -213,9 +220,9 @@ public class UserIdEditor extends LinearLayout implements Editor, OnClickListene
|
|||||||
@Override
|
@Override
|
||||||
public boolean needsSaving() {
|
public boolean needsSaving() {
|
||||||
boolean retval = (mOriginallyMainUserID != isMainUserId());
|
boolean retval = (mOriginallyMainUserID != isMainUserId());
|
||||||
retval |= (mOriginalName.equals( ("" + mName.getText()).trim() ) );
|
retval |= !(mOriginalName.equals( ("" + mName.getText()).trim() ) );
|
||||||
retval |= (mOriginalEmail.equals( ("" + mEmail.getText()).trim() ) );
|
retval |= !(mOriginalEmail.equals( ("" + mEmail.getText()).trim() ) );
|
||||||
retval |= (mOriginalComment.equals( ("" + mComment.getText()).trim() ) );
|
retval |= !(mOriginalComment.equals( ("" + mComment.getText()).trim() ) );
|
||||||
retval |= mIsNewId;
|
retval |= mIsNewId;
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user