some fixes

This commit is contained in:
Ashley Hughes 2014-02-06 14:25:09 +00:00
parent e7ebbc5ef6
commit d6726fe9d6

View File

@ -83,18 +83,7 @@ public class UserIdEditor extends LinearLayout implements Editor, OnClickListene
super(context, attrs);
}
@Override
protected void onFinishInflate() {
setDrawingCacheEnabled(true);
setAlwaysDrawnWithCacheEnabled(true);
mDeleteButton = (BootstrapButton) findViewById(R.id.delete);
mDeleteButton.setOnClickListener(this);
mIsMainUserId = (RadioButton) findViewById(R.id.isMainUserId);
mIsMainUserId.setOnClickListener(this);
mName = (EditText) findViewById(R.id.name);
mName.addTextChangedListener(new TextWatcher() {
TextWatcher mTextWatcher = new TextWatcher() {
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
}
@ -110,9 +99,24 @@ public class UserIdEditor extends LinearLayout implements Editor, OnClickListene
mEditorListener.onEdited();
}
}
});
};
@Override
protected void onFinishInflate() {
setDrawingCacheEnabled(true);
setAlwaysDrawnWithCacheEnabled(true);
mDeleteButton = (BootstrapButton) findViewById(R.id.delete);
mDeleteButton.setOnClickListener(this);
mIsMainUserId = (RadioButton) findViewById(R.id.isMainUserId);
mIsMainUserId.setOnClickListener(this);
mName = (EditText) findViewById(R.id.name);
mName.addTextChangedListener(mTextWatcher);
mEmail = (EditText) findViewById(R.id.email);
mEmail.addTextChangedListener(mTextWatcher);
mComment = (EditText) findViewById(R.id.comment);
mComment.addTextChangedListener(mTextWatcher);
super.onFinishInflate();
}
@ -120,8 +124,11 @@ public class UserIdEditor extends LinearLayout implements Editor, OnClickListene
public void setValue(String userId, boolean isMainID, boolean isNewId) {
mName.setText("");
mOriginalName = "";
mComment.setText("");
mOriginalComment = "";
mEmail.setText("");
mOriginalEmail = "";
mIsNewId = isNewId;
String[] result = PgpKeyHelper.splitUserId(userId);
@ -213,9 +220,9 @@ public class UserIdEditor extends LinearLayout implements Editor, OnClickListene
@Override
public boolean needsSaving() {
boolean retval = (mOriginallyMainUserID != isMainUserId());
retval |= (mOriginalName.equals( ("" + mName.getText()).trim() ) );
retval |= (mOriginalEmail.equals( ("" + mEmail.getText()).trim() ) );
retval |= (mOriginalComment.equals( ("" + mComment.getText()).trim() ) );
retval |= !(mOriginalName.equals( ("" + mName.getText()).trim() ) );
retval |= !(mOriginalEmail.equals( ("" + mEmail.getText()).trim() ) );
retval |= !(mOriginalComment.equals( ("" + mComment.getText()).trim() ) );
retval |= mIsNewId;
return retval;
}