new Ids need to be saved

This commit is contained in:
Ashley Hughes 2014-02-06 09:00:36 +00:00
parent 83514b82c0
commit 603665976a
2 changed files with 6 additions and 5 deletions

View File

@ -166,9 +166,7 @@ public class SectionView extends LinearLayout implements OnClickListener, Editor
UserIdEditor view = (UserIdEditor) mInflater.inflate( UserIdEditor view = (UserIdEditor) mInflater.inflate(
R.layout.edit_key_user_id_item, mEditors, false); R.layout.edit_key_user_id_item, mEditors, false);
view.setEditorListener(this); view.setEditorListener(this);
if (mEditors.getChildCount() == 0) { view.setValue("", mEditors.getChildCount() == 0, true);
view.setIsMainUserId(true);
}
mEditors.addView(view); mEditors.addView(view);
break; break;
} }
@ -273,7 +271,7 @@ public class SectionView extends LinearLayout implements OnClickListener, Editor
UserIdEditor view = (UserIdEditor) mInflater.inflate(R.layout.edit_key_user_id_item, UserIdEditor view = (UserIdEditor) mInflater.inflate(R.layout.edit_key_user_id_item,
mEditors, false); mEditors, false);
view.setEditorListener(this); view.setEditorListener(this);
view.setValue(userId, mEditors.getChildCount() == 0); view.setValue(userId, mEditors.getChildCount() == 0, false);
view.setCanEdit(canEdit); view.setCanEdit(canEdit);
mEditors.addView(view); mEditors.addView(view);
} }

View File

@ -46,6 +46,7 @@ public class UserIdEditor extends LinearLayout implements Editor, OnClickListene
private EditText mComment; private EditText mComment;
private String mOriginalComment; private String mOriginalComment;
private boolean mOriginallyMainUserID; private boolean mOriginallyMainUserID;
private boolean mIsNewId;
// see http://www.regular-expressions.info/email.html // see http://www.regular-expressions.info/email.html
// RFC 2822 if we omit the syntax using double quotes and square brackets // RFC 2822 if we omit the syntax using double quotes and square brackets
@ -131,10 +132,11 @@ public class UserIdEditor extends LinearLayout implements Editor, OnClickListene
super.onFinishInflate(); super.onFinishInflate();
} }
public void setValue(String userId, boolean isMainID) { public void setValue(String userId, boolean isMainID, boolean isNewId) {
mName.setText(""); mName.setText("");
mComment.setText(""); mComment.setText("");
mEmail.setText(""); mEmail.setText("");
mIsNewId = isNewId;
//TODO: update this file for blank email/name? //TODO: update this file for blank email/name?
@ -247,6 +249,7 @@ public class UserIdEditor extends LinearLayout implements Editor, OnClickListene
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;
return retval; return retval;
} }
} }