From 603665976a3a75918fb9838361b7194c5def6968 Mon Sep 17 00:00:00 2001 From: Ashley Hughes Date: Thu, 6 Feb 2014 09:00:36 +0000 Subject: new Ids need to be saved --- .../java/org/sufficientlysecure/keychain/ui/widget/SectionView.java | 6 ++---- .../org/sufficientlysecure/keychain/ui/widget/UserIdEditor.java | 5 ++++- 2 files changed, 6 insertions(+), 5 deletions(-) (limited to 'OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain') diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/SectionView.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/SectionView.java index bf8a3f96b..e0d31fa3f 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/SectionView.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/SectionView.java @@ -166,9 +166,7 @@ public class SectionView extends LinearLayout implements OnClickListener, Editor UserIdEditor view = (UserIdEditor) mInflater.inflate( R.layout.edit_key_user_id_item, mEditors, false); view.setEditorListener(this); - if (mEditors.getChildCount() == 0) { - view.setIsMainUserId(true); - } + view.setValue("", mEditors.getChildCount() == 0, true); mEditors.addView(view); 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, mEditors, false); view.setEditorListener(this); - view.setValue(userId, mEditors.getChildCount() == 0); + view.setValue(userId, mEditors.getChildCount() == 0, false); view.setCanEdit(canEdit); mEditors.addView(view); } diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/UserIdEditor.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/UserIdEditor.java index 4b550c580..0509e69f2 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/UserIdEditor.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/UserIdEditor.java @@ -46,6 +46,7 @@ public class UserIdEditor extends LinearLayout implements Editor, OnClickListene private EditText mComment; private String mOriginalComment; private boolean mOriginallyMainUserID; + private boolean mIsNewId; // see http://www.regular-expressions.info/email.html // 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(); } - public void setValue(String userId, boolean isMainID) { + public void setValue(String userId, boolean isMainID, boolean isNewId) { mName.setText(""); mComment.setText(""); mEmail.setText(""); + mIsNewId = isNewId; //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 |= (mOriginalEmail.equals( ("" + mEmail.getText()).trim() ) ); retval |= (mOriginalComment.equals( ("" + mComment.getText()).trim() ) ); + retval |= mIsNewId; return retval; } } -- cgit v1.2.3