diff options
Diffstat (limited to 'OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain')
11 files changed, 82 insertions, 79 deletions
diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/helper/Preferences.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/helper/Preferences.java index a9b773371..13b1df4d4 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/helper/Preferences.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/helper/Preferences.java @@ -30,7 +30,7 @@ import java.util.Vector; * Singleton Implementation of a Preference Helper */ public class Preferences { - private static Preferences mPreferences; + private static Preferences sPreferences; private SharedPreferences mSharedPreferences; public static synchronized Preferences getPreferences(Context context) { @@ -38,10 +38,10 @@ public class Preferences { } public static synchronized Preferences getPreferences(Context context, boolean forceNew) { - if (mPreferences == null || forceNew) { - mPreferences = new Preferences(context); + if (sPreferences == null || forceNew) { + sPreferences = new Preferences(context); } - return mPreferences; + return sPreferences; } private Preferences(Context context) { diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/pgp/exception/PgpGeneralMsgIdException.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/pgp/exception/PgpGeneralMsgIdException.java index 3df85cfc8..caa7842db 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/pgp/exception/PgpGeneralMsgIdException.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/pgp/exception/PgpGeneralMsgIdException.java @@ -22,14 +22,14 @@ import android.content.Context; public class PgpGeneralMsgIdException extends Exception { static final long serialVersionUID = 0xf812773343L; - private final int msgId; + private final int mMessageId; - public PgpGeneralMsgIdException(int msgId) { - super("msg[" + msgId + "]"); - this.msgId = msgId; + public PgpGeneralMsgIdException(int messageId) { + super("msg[" + messageId + "]"); + mMessageId = messageId; } public PgpGeneralException getContextualized(Context context) { - return new PgpGeneralException(context.getString(msgId), this); + return new PgpGeneralException(context.getString(mMessageId), this); } } diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptAsymmetricFragment.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptAsymmetricFragment.java index 5b7f9e4cc..4387f3d53 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptAsymmetricFragment.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptAsymmetricFragment.java @@ -264,8 +264,8 @@ public class EncryptAsymmetricFragment extends Fragment { case RESULT_CODE_SECRET_KEYS: { if (resultCode == Activity.RESULT_OK) { - Uri uri_master_key = data.getData(); - setSignatureKeyId(Long.valueOf(uri_master_key.getLastPathSegment())); + Uri uriMasterKey = data.getData(); + setSignatureKeyId(Long.valueOf(uriMasterKey.getLastPathSegment())); } else { setSignatureKeyId(Id.key.none); } diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/PreferencesActivity.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/PreferencesActivity.java index 04179cb80..c541e8a23 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/PreferencesActivity.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/PreferencesActivity.java @@ -38,11 +38,11 @@ public class PreferencesActivity extends PreferenceActivity { public static final String ACTION_PREFS_ADV = "org.sufficientlysecure.keychain.ui.PREFS_ADV"; private PreferenceScreen mKeyServerPreference = null; - private static Preferences mPreferences; + private static Preferences sPreferences; @Override protected void onCreate(Bundle savedInstanceState) { - mPreferences = Preferences.getPreferences(this); + sPreferences = Preferences.getPreferences(this); super.onCreate(savedInstanceState); // final ActionBar actionBar = getSupportActionBar(); @@ -59,7 +59,7 @@ public class PreferencesActivity extends PreferenceActivity { (IntegerListPreference) findPreference(Constants.Pref.PASS_PHRASE_CACHE_TTL)); mKeyServerPreference = (PreferenceScreen) findPreference(Constants.Pref.KEY_SERVERS); - String servers[] = mPreferences.getKeyServers(); + String servers[] = sPreferences.getKeyServers(); mKeyServerPreference.setSummary(getResources().getQuantityString(R.plurals.n_key_servers, servers.length, servers.length)); mKeyServerPreference @@ -68,7 +68,7 @@ public class PreferencesActivity extends PreferenceActivity { Intent intent = new Intent(PreferencesActivity.this, PreferencesKeyServerActivity.class); intent.putExtra(PreferencesKeyServerActivity.EXTRA_KEY_SERVERS, - mPreferences.getKeyServers()); + sPreferences.getKeyServers()); startActivityForResult(intent, Id.request.key_server_preference); return false; } @@ -125,7 +125,7 @@ public class PreferencesActivity extends PreferenceActivity { } String servers[] = data .getStringArrayExtra(PreferencesKeyServerActivity.EXTRA_KEY_SERVERS); - mPreferences.setKeyServers(servers); + sPreferences.setKeyServers(servers); mKeyServerPreference.setSummary(getResources().getQuantityString( R.plurals.n_key_servers, servers.length, servers.length)); break; @@ -163,7 +163,7 @@ public class PreferencesActivity extends PreferenceActivity { (IntegerListPreference) findPreference(Constants.Pref.PASS_PHRASE_CACHE_TTL)); mKeyServerPreference = (PreferenceScreen) findPreference(Constants.Pref.KEY_SERVERS); - String servers[] = mPreferences.getKeyServers(); + String servers[] = sPreferences.getKeyServers(); mKeyServerPreference.setSummary(getResources().getQuantityString(R.plurals.n_key_servers, servers.length, servers.length)); mKeyServerPreference @@ -172,7 +172,7 @@ public class PreferencesActivity extends PreferenceActivity { Intent intent = new Intent(getActivity(), PreferencesKeyServerActivity.class); intent.putExtra(PreferencesKeyServerActivity.EXTRA_KEY_SERVERS, - mPreferences.getKeyServers()); + sPreferences.getKeyServers()); startActivityForResult(intent, Id.request.key_server_preference); return false; } @@ -188,7 +188,7 @@ public class PreferencesActivity extends PreferenceActivity { } String servers[] = data .getStringArrayExtra(PreferencesKeyServerActivity.EXTRA_KEY_SERVERS); - mPreferences.setKeyServers(servers); + sPreferences.setKeyServers(servers); mKeyServerPreference.setSummary(getResources().getQuantityString( R.plurals.n_key_servers, servers.length, servers.length)); break; @@ -256,14 +256,14 @@ public class PreferencesActivity extends PreferenceActivity { } private static void initializePassPassPhraceCacheTtl(final IntegerListPreference mPassphraseCacheTtl) { - mPassphraseCacheTtl.setValue("" + mPreferences.getPassPhraseCacheTtl()); + mPassphraseCacheTtl.setValue("" + sPreferences.getPassPhraseCacheTtl()); mPassphraseCacheTtl.setSummary(mPassphraseCacheTtl.getEntry()); mPassphraseCacheTtl .setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() { public boolean onPreferenceChange(Preference preference, Object newValue) { mPassphraseCacheTtl.setValue(newValue.toString()); mPassphraseCacheTtl.setSummary(mPassphraseCacheTtl.getEntry()); - mPreferences.setPassPhraseCacheTtl(Integer.parseInt(newValue.toString())); + sPreferences.setPassPhraseCacheTtl(Integer.parseInt(newValue.toString())); return false; } }); @@ -282,14 +282,14 @@ public class PreferencesActivity extends PreferenceActivity { } mEncryptionAlgorithm.setEntries(entries); mEncryptionAlgorithm.setEntryValues(values); - mEncryptionAlgorithm.setValue("" + mPreferences.getDefaultEncryptionAlgorithm()); + mEncryptionAlgorithm.setValue("" + sPreferences.getDefaultEncryptionAlgorithm()); mEncryptionAlgorithm.setSummary(mEncryptionAlgorithm.getEntry()); mEncryptionAlgorithm .setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() { public boolean onPreferenceChange(Preference preference, Object newValue) { mEncryptionAlgorithm.setValue(newValue.toString()); mEncryptionAlgorithm.setSummary(mEncryptionAlgorithm.getEntry()); - mPreferences.setDefaultEncryptionAlgorithm(Integer.parseInt(newValue + sPreferences.setDefaultEncryptionAlgorithm(Integer.parseInt(newValue .toString())); return false; } @@ -309,13 +309,13 @@ public class PreferencesActivity extends PreferenceActivity { } mHashAlgorithm.setEntries(entries); mHashAlgorithm.setEntryValues(values); - mHashAlgorithm.setValue("" + mPreferences.getDefaultHashAlgorithm()); + mHashAlgorithm.setValue("" + sPreferences.getDefaultHashAlgorithm()); mHashAlgorithm.setSummary(mHashAlgorithm.getEntry()); mHashAlgorithm.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() { public boolean onPreferenceChange(Preference preference, Object newValue) { mHashAlgorithm.setValue(newValue.toString()); mHashAlgorithm.setSummary(mHashAlgorithm.getEntry()); - mPreferences.setDefaultHashAlgorithm(Integer.parseInt(newValue.toString())); + sPreferences.setDefaultHashAlgorithm(Integer.parseInt(newValue.toString())); return false; } }); @@ -326,14 +326,14 @@ public class PreferencesActivity extends PreferenceActivity { int[] valueIds, String[] entries, String[] values) { mMessageCompression.setEntries(entries); mMessageCompression.setEntryValues(values); - mMessageCompression.setValue("" + mPreferences.getDefaultMessageCompression()); + mMessageCompression.setValue("" + sPreferences.getDefaultMessageCompression()); mMessageCompression.setSummary(mMessageCompression.getEntry()); mMessageCompression .setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() { public boolean onPreferenceChange(Preference preference, Object newValue) { mMessageCompression.setValue(newValue.toString()); mMessageCompression.setSummary(mMessageCompression.getEntry()); - mPreferences.setDefaultMessageCompression(Integer.parseInt(newValue + sPreferences.setDefaultMessageCompression(Integer.parseInt(newValue .toString())); return false; } @@ -344,36 +344,36 @@ public class PreferencesActivity extends PreferenceActivity { (final IntegerListPreference mFileCompression, String[] entries, String[] values) { mFileCompression.setEntries(entries); mFileCompression.setEntryValues(values); - mFileCompression.setValue("" + mPreferences.getDefaultFileCompression()); + mFileCompression.setValue("" + sPreferences.getDefaultFileCompression()); mFileCompression.setSummary(mFileCompression.getEntry()); mFileCompression.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() { public boolean onPreferenceChange(Preference preference, Object newValue) { mFileCompression.setValue(newValue.toString()); mFileCompression.setSummary(mFileCompression.getEntry()); - mPreferences.setDefaultFileCompression(Integer.parseInt(newValue.toString())); + sPreferences.setDefaultFileCompression(Integer.parseInt(newValue.toString())); return false; } }); } private static void initializeAsciiArmour(final CheckBoxPreference mAsciiArmour) { - mAsciiArmour.setChecked(mPreferences.getDefaultAsciiArmour()); + mAsciiArmour.setChecked(sPreferences.getDefaultAsciiArmour()); mAsciiArmour.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() { public boolean onPreferenceChange(Preference preference, Object newValue) { mAsciiArmour.setChecked((Boolean) newValue); - mPreferences.setDefaultAsciiArmour((Boolean) newValue); + sPreferences.setDefaultAsciiArmour((Boolean) newValue); return false; } }); } private static void initializeForceV3Signatures(final CheckBoxPreference mForceV3Signatures) { - mForceV3Signatures.setChecked(mPreferences.getForceV3Signatures()); + mForceV3Signatures.setChecked(sPreferences.getForceV3Signatures()); mForceV3Signatures .setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() { public boolean onPreferenceChange(Preference preference, Object newValue) { mForceV3Signatures.setChecked((Boolean) newValue); - mPreferences.setForceV3Signatures((Boolean) newValue); + sPreferences.setForceV3Signatures((Boolean) newValue); return false; } }); diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/ImportKeysAdapter.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/ImportKeysAdapter.java index 8cb321109..f322ea980 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/ImportKeysAdapter.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/ImportKeysAdapter.java @@ -44,12 +44,12 @@ public class ImportKeysAdapter extends ArrayAdapter<ImportKeysListEntry> { protected List<ImportKeysListEntry> mData; static class ViewHolder { - private TextView mainUserId; - private TextView mainUserIdRest; - private TextView keyId; - private TextView fingerprint; - private TextView algorithm; - private TextView status; + public TextView mainUserId; + public TextView mainUserIdRest; + public TextView keyId; + public TextView fingerprint; + public TextView algorithm; + public TextView status; } public ImportKeysAdapter(Activity activity) { diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/ImportKeysListEntry.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/ImportKeysListEntry.java index 9b20effc2..4fccadf30 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/ImportKeysListEntry.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/ImportKeysListEntry.java @@ -249,7 +249,7 @@ public class ImportKeysListEntry implements Serializable, Parcelable { /** * Based on <a href="http://tools.ietf.org/html/rfc2440#section-9.1">OpenPGP Message Format</a> */ - private final static SparseArray<String> ALGORITHM_IDS = new SparseArray<String>() {{ + private static final SparseArray<String> ALGORITHM_IDS = new SparseArray<String>() {{ put(-1, "unknown"); // TODO: with resources put(0, "unencrypted"); put(PGPPublicKey.RSA_GENERAL, "RSA"); diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/PagerTabStripAdapter.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/PagerTabStripAdapter.java index 4a3796f01..fd864eb09 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/PagerTabStripAdapter.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/PagerTabStripAdapter.java @@ -30,9 +30,9 @@ public class PagerTabStripAdapter extends FragmentPagerAdapter { private final ArrayList<TabInfo> mTabs = new ArrayList<TabInfo>(); static final class TabInfo { - private final Class<?> clss; - private final Bundle args; - private final String title; + public final Class<?> clss; + public final Bundle args; + public final String title; TabInfo(Class<?> clss, Bundle args, String title) { this.clss = clss; diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/TabsAdapter.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/TabsAdapter.java index 6dbea61dc..9ddfa90be 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/TabsAdapter.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/TabsAdapter.java @@ -36,8 +36,8 @@ public class TabsAdapter extends FragmentStatePagerAdapter implements ActionBar. private final ArrayList<TabInfo> mTabs = new ArrayList<TabInfo>(); static final class TabInfo { - private final Class<?> clss; - private final Bundle args; + public final Class<?> clss; + public final Bundle args; TabInfo(Class<?> clss, Bundle args) { this.clss = clss; diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/ViewKeyUserIdsAdapter.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/ViewKeyUserIdsAdapter.java index 21a150606..fcaa6a940 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/ViewKeyUserIdsAdapter.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/ViewKeyUserIdsAdapter.java @@ -37,7 +37,7 @@ public class ViewKeyUserIdsAdapter extends CursorAdapter { private int mIndexUserId, mIndexRank; - final private ArrayList<Boolean> mCheckStates; + private final ArrayList<Boolean> mCheckStates; public ViewKeyUserIdsAdapter(Context context, Cursor c, int flags, boolean showCheckBoxes) { super(context, c, flags); diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/dialog/DeleteKeyDialogFragment.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/dialog/DeleteKeyDialogFragment.java index 60dea2a41..02ebde1c8 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/dialog/DeleteKeyDialogFragment.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/dialog/DeleteKeyDialogFragment.java @@ -51,12 +51,12 @@ public class DeleteKeyDialogFragment extends DialogFragment { public static final int MESSAGE_OKAY = 1; public static final int MESSAGE_ERROR = 0; - private boolean isSingleSelection = false; + private boolean mIsSingleSelection = false; - private TextView mainMessage; - private CheckBox checkDeleteSecret; - private LinearLayout deleteSecretKeyView; - private View inflateView; + private TextView mMainMessage; + private CheckBox mCheckDeleteSecret; + private LinearLayout mDeleteSecretKeyView; + private View mInflateView; private Messenger mMessenger; @@ -90,12 +90,12 @@ public class DeleteKeyDialogFragment extends DialogFragment { //Setup custom View to display in AlertDialog LayoutInflater inflater = activity.getLayoutInflater(); - inflateView = inflater.inflate(R.layout.view_key_delete_fragment, null); - builder.setView(inflateView); + mInflateView = inflater.inflate(R.layout.view_key_delete_fragment, null); + builder.setView(mInflateView); - deleteSecretKeyView = (LinearLayout) inflateView.findViewById(R.id.deleteSecretKeyView); - mainMessage = (TextView) inflateView.findViewById(R.id.mainMessage); - checkDeleteSecret = (CheckBox) inflateView.findViewById(R.id.checkDeleteSecret); + mDeleteSecretKeyView = (LinearLayout) mInflateView.findViewById(R.id.deleteSecretKeyView); + mMainMessage = (TextView) mInflateView.findViewById(R.id.mainMessage); + mCheckDeleteSecret = (CheckBox) mInflateView.findViewById(R.id.checkDeleteSecret); builder.setTitle(R.string.warning); @@ -103,7 +103,7 @@ public class DeleteKeyDialogFragment extends DialogFragment { if (keyRingRowIds.length == 1) { Uri dataUri; ArrayList<Long> publicKeyRings; //Any one will do - isSingleSelection = true; + mIsSingleSelection = true; long selectedRow = keyRingRowIds[0]; long keyType; @@ -119,16 +119,16 @@ public class DeleteKeyDialogFragment extends DialogFragment { } String userId = ProviderHelper.getUserId(activity, dataUri); - //Hide the Checkbox and TextView since this is a single selection,user will be notified thru message - deleteSecretKeyView.setVisibility(View.GONE); - //Set message depending on which key it is. - mainMessage.setText(getString(keyType == Id.type.secret_key ? R.string.secret_key_deletion_confirmation - : R.string.public_key_deletetion_confirmation, userId)); - - + // Hide the Checkbox and TextView since this is a single selection, + // user will be notified thru message + mDeleteSecretKeyView.setVisibility(View.GONE); + // Set message depending on which key it is. + mMainMessage.setText(getString(keyType == Id.type.secret_key ? + R.string.secret_key_deletion_confirmation : + R.string.public_key_deletetion_confirmation, userId)); } else { - deleteSecretKeyView.setVisibility(View.VISIBLE); - mainMessage.setText(R.string.key_deletion_confirmation_multi); + mDeleteSecretKeyView.setVisibility(View.VISIBLE); + mMainMessage.setText(R.string.key_deletion_confirmation_multi); } @@ -171,8 +171,9 @@ public class DeleteKeyDialogFragment extends DialogFragment { if (keyType == KeychainContract.KeyTypes.SECRET) { - if (checkDeleteSecret.isChecked() || isSingleSelection) { - ProviderHelper.deleteUnifiedKeyRing(activity, String.valueOf(masterKeyId), true); + if (mCheckDeleteSecret.isChecked() || mIsSingleSelection) { + ProviderHelper.deleteUnifiedKeyRing(activity, + String.valueOf(masterKeyId), true); } } else { ProviderHelper.deleteUnifiedKeyRing(activity, String.valueOf(masterKeyId), false); @@ -180,8 +181,10 @@ public class DeleteKeyDialogFragment extends DialogFragment { } //Check if the selected rows have actually been deleted - cursor = activity.getContentResolver().query(queryUri, projection, selection, null, null); - if (cursor == null || cursor.getCount() == 0 || !checkDeleteSecret.isChecked()) { + cursor = activity.getContentResolver().query( + queryUri, projection, selection, null, null); + if (cursor == null || cursor.getCount() == 0 || + !mCheckDeleteSecret.isChecked()) { isSuccessfullyDeleted = true; } } finally { 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 272f43915..150f6e221 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 @@ -61,7 +61,7 @@ public class SectionView extends LinearLayout implements OnClickListener, Editor private Choice mNewKeyAlgorithmChoice; private int mNewKeySize; - private boolean oldItemDeleted = false; + private boolean mOldItemDeleted = false; private ArrayList<String> mDeletedIDs = new ArrayList<String>(); private ArrayList<PGPSecretKey> mDeletedKeys = new ArrayList<PGPSecretKey>(); private boolean mCanEdit = true; @@ -138,13 +138,13 @@ public class SectionView extends LinearLayout implements OnClickListener, Editor * {@inheritDoc} */ public void onDeleted(Editor editor, boolean wasNewItem) { - oldItemDeleted |= !wasNewItem; - if (oldItemDeleted) { - if (mType == Id.type.user_id) - mDeletedIDs.add(((UserIdEditor)editor).getOriginalID()); - else if (mType == Id.type.key) - mDeletedKeys.add(((KeyEditor)editor).getValue()); - + mOldItemDeleted |= !wasNewItem; + if (mOldItemDeleted) { + if (mType == Id.type.user_id) { + mDeletedIDs.add(((UserIdEditor) editor).getOriginalID()); + } else if (mType == Id.type.key) { + mDeletedKeys.add(((KeyEditor) editor).getValue()); + } } this.updateEditorsVisible(); if (mEditorListener != null) { @@ -167,7 +167,7 @@ public class SectionView extends LinearLayout implements OnClickListener, Editor public boolean needsSaving() { //check each view for needs saving, take account of deleted items - boolean ret = oldItemDeleted; + boolean ret = mOldItemDeleted; for (int i = 0; i < mEditors.getChildCount(); ++i) { Editor editor = (Editor) mEditors.getChildAt(i); ret |= editor.needsSaving(); |