diff options
author | Dominik Schürmann <dominik@dominikschuermann.de> | 2014-04-14 13:48:20 +0200 |
---|---|---|
committer | Dominik Schürmann <dominik@dominikschuermann.de> | 2014-04-14 13:48:20 +0200 |
commit | b04e6816f44c29fdbd0d37a8be70d9e15a24b0f4 (patch) | |
tree | 6f8b638f4fb851fc5284115ef234c16e1714ad72 /OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/widget | |
parent | 59220fbe04fcf61daacdeb9e75d00f9fb17fba16 (diff) | |
download | open-keychain-b04e6816f44c29fdbd0d37a8be70d9e15a24b0f4.tar.gz open-keychain-b04e6816f44c29fdbd0d37a8be70d9e15a24b0f4.tar.bz2 open-keychain-b04e6816f44c29fdbd0d37a8be70d9e15a24b0f4.zip |
Removing remaining uses of Id, closing one of the oldest bugs #9
Diffstat (limited to 'OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/widget')
-rw-r--r-- | OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/SectionView.java | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/SectionView.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/SectionView.java index 5532faeaf..c7dd071bd 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/SectionView.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/SectionView.java @@ -38,7 +38,6 @@ import com.beardedhen.androidbootstrap.BootstrapButton; import org.spongycastle.openpgp.PGPKeyFlags; import org.spongycastle.openpgp.PGPSecretKey; -import org.sufficientlysecure.keychain.Id; import org.sufficientlysecure.keychain.R; import org.sufficientlysecure.keychain.pgp.PgpConversionHelper; import org.sufficientlysecure.keychain.service.KeychainIntentService; @@ -72,6 +71,9 @@ public class SectionView extends LinearLayout implements OnClickListener, Editor private ProgressDialogFragment mGeneratingDialog; + public static final int TYPE_USER_ID = 1; + public static final int TYPE_KEY = 2; + public void setEditorListener(EditorListener listener) { mEditorListener = listener; } @@ -93,12 +95,12 @@ public class SectionView extends LinearLayout implements OnClickListener, Editor public void setType(int type) { mType = type; switch (type) { - case Id.type.user_id: { + case TYPE_USER_ID: { mTitle.setText(R.string.section_user_ids); break; } - case Id.type.key: { + case TYPE_KEY: { mTitle.setText(R.string.section_keys); break; } @@ -142,9 +144,9 @@ public class SectionView extends LinearLayout implements OnClickListener, Editor public void onDeleted(Editor editor, boolean wasNewItem) { mOldItemDeleted |= !wasNewItem; if (mOldItemDeleted) { - if (mType == Id.type.user_id) { + if (mType == TYPE_USER_ID) { mDeletedIDs.add(((UserIdEditor) editor).getOriginalID()); - } else if (mType == Id.type.key) { + } else if (mType == TYPE_KEY) { mDeletedKeys.add(((KeyEditor) editor).getValue()); } } @@ -172,7 +174,7 @@ public class SectionView extends LinearLayout implements OnClickListener, Editor for (int i = 0; i < mEditors.getChildCount(); ++i) { Editor editor = (Editor) mEditors.getChildAt(i); ret |= editor.needsSaving(); - if (mType == Id.type.user_id) { + if (mType == TYPE_USER_ID) { ret |= ((UserIdEditor) editor).primarySwapped(); } } @@ -183,7 +185,7 @@ public class SectionView extends LinearLayout implements OnClickListener, Editor boolean ret = false; for (int i = 0; i < mEditors.getChildCount(); ++i) { Editor editor = (Editor) mEditors.getChildAt(i); - if (mType == Id.type.user_id) { + if (mType == TYPE_USER_ID) { ret |= ((UserIdEditor) editor).primarySwapped(); } } @@ -196,7 +198,7 @@ public class SectionView extends LinearLayout implements OnClickListener, Editor // revoked ones make this harder than the simple case we are continuing to assume here for (int i = 0; i < mEditors.getChildCount(); ++i) { Editor editor = (Editor) mEditors.getChildAt(i); - if (mType == Id.type.user_id) { + if (mType == TYPE_USER_ID) { if (((UserIdEditor) editor).getIsOriginallyMainUserID()) { return ((UserIdEditor) editor).getOriginalID(); } @@ -207,7 +209,7 @@ public class SectionView extends LinearLayout implements OnClickListener, Editor public ArrayList<String> getOriginalIDs() { ArrayList<String> orig = new ArrayList<String>(); - if (mType == Id.type.user_id) { + if (mType == TYPE_USER_ID) { for (int i = 0; i < mEditors.getChildCount(); ++i) { UserIdEditor editor = (UserIdEditor) mEditors.getChildAt(i); if (editor.isMainUserId()) { @@ -254,7 +256,7 @@ public class SectionView extends LinearLayout implements OnClickListener, Editor public List<Boolean> getNewKeysArray() { ArrayList<Boolean> mList = new ArrayList<Boolean>(); - if (mType == Id.type.key) { + if (mType == TYPE_KEY) { for (int i = 0; i < mEditors.getChildCount(); ++i) { KeyEditor editor = (KeyEditor) mEditors.getChildAt(i); mList.add(editor.getIsNewKey()); @@ -269,7 +271,7 @@ public class SectionView extends LinearLayout implements OnClickListener, Editor public void onClick(View v) { if (mCanBeEdited) { switch (mType) { - case Id.type.user_id: { + case TYPE_USER_ID: { UserIdEditor view = (UserIdEditor) mInflater.inflate( R.layout.edit_key_user_id_item, mEditors, false); view.setEditorListener(this); @@ -281,7 +283,7 @@ public class SectionView extends LinearLayout implements OnClickListener, Editor break; } - case Id.type.key: { + case TYPE_KEY: { CreateKeyDialogFragment mCreateKeyDialogFragment = CreateKeyDialogFragment.newInstance(mEditors.getChildCount()); mCreateKeyDialogFragment @@ -307,7 +309,7 @@ public class SectionView extends LinearLayout implements OnClickListener, Editor } public void setUserIds(Vector<String> list) { - if (mType != Id.type.user_id) { + if (mType != TYPE_USER_ID) { return; } @@ -325,7 +327,7 @@ public class SectionView extends LinearLayout implements OnClickListener, Editor } public void setKeys(Vector<PGPSecretKey> list, Vector<Integer> usages, boolean newKeys) { - if (mType != Id.type.key) { + if (mType != TYPE_KEY) { return; } |