aboutsummaryrefslogtreecommitdiffstats
path: root/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/SectionView.java
diff options
context:
space:
mode:
Diffstat (limited to 'OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/SectionView.java')
-rw-r--r--OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/SectionView.java30
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;
}