Removing remaining uses of Id, closing one of the oldest bugs #9
This commit is contained in:
@@ -33,9 +33,7 @@ import android.widget.EditText;
|
||||
import com.beardedhen.androidbootstrap.BootstrapButton;
|
||||
import com.devspark.appmsg.AppMsg;
|
||||
|
||||
import org.openintents.openpgp.OpenPgpSignatureResult;
|
||||
import org.sufficientlysecure.keychain.Constants;
|
||||
import org.sufficientlysecure.keychain.Id;
|
||||
import org.sufficientlysecure.keychain.R;
|
||||
import org.sufficientlysecure.keychain.helper.FileHelper;
|
||||
import org.sufficientlysecure.keychain.pgp.PgpDecryptVerifyResult;
|
||||
@@ -202,7 +200,7 @@ public class DecryptFileFragment extends DecryptFragment {
|
||||
showPassphraseDialog(decryptVerifyResult.getKeyIdPassphraseNeeded());
|
||||
} else if (PgpDecryptVerifyResult.SYMMETRIC_PASSHRASE_NEEDED ==
|
||||
decryptVerifyResult.getStatus()) {
|
||||
showPassphraseDialog(Id.key.symmetric);
|
||||
showPassphraseDialog(Constants.key.symmetric);
|
||||
} else {
|
||||
// display signature result in activity
|
||||
onResult(decryptVerifyResult);
|
||||
|
||||
@@ -31,9 +31,7 @@ import android.widget.EditText;
|
||||
import com.beardedhen.androidbootstrap.BootstrapButton;
|
||||
import com.devspark.appmsg.AppMsg;
|
||||
|
||||
import org.openintents.openpgp.OpenPgpSignatureResult;
|
||||
import org.sufficientlysecure.keychain.Constants;
|
||||
import org.sufficientlysecure.keychain.Id;
|
||||
import org.sufficientlysecure.keychain.R;
|
||||
import org.sufficientlysecure.keychain.compatibility.ClipboardReflection;
|
||||
import org.sufficientlysecure.keychain.pgp.PgpDecryptVerifyResult;
|
||||
@@ -156,7 +154,7 @@ public class DecryptMessageFragment extends DecryptFragment {
|
||||
showPassphraseDialog(decryptVerifyResult.getKeyIdPassphraseNeeded());
|
||||
} else if (PgpDecryptVerifyResult.SYMMETRIC_PASSHRASE_NEEDED ==
|
||||
decryptVerifyResult.getStatus()) {
|
||||
showPassphraseDialog(Id.key.symmetric);
|
||||
showPassphraseDialog(Constants.key.symmetric);
|
||||
} else {
|
||||
byte[] decryptedMessage = returnData
|
||||
.getByteArray(KeychainIntentService.RESULT_DECRYPTED_BYTES);
|
||||
|
||||
@@ -44,11 +44,9 @@ import android.widget.Toast;
|
||||
import com.beardedhen.androidbootstrap.BootstrapButton;
|
||||
import com.devspark.appmsg.AppMsg;
|
||||
|
||||
import org.spongycastle.openpgp.PGPException;
|
||||
import org.spongycastle.openpgp.PGPSecretKey;
|
||||
import org.spongycastle.openpgp.PGPSecretKeyRing;
|
||||
import org.sufficientlysecure.keychain.Constants;
|
||||
import org.sufficientlysecure.keychain.Id;
|
||||
import org.sufficientlysecure.keychain.R;
|
||||
import org.sufficientlysecure.keychain.helper.ActionBarHelper;
|
||||
import org.sufficientlysecure.keychain.helper.ExportHelper;
|
||||
@@ -73,7 +71,6 @@ import org.sufficientlysecure.keychain.util.Log;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.GregorianCalendar;
|
||||
import java.util.List;
|
||||
import java.util.Vector;
|
||||
|
||||
@@ -391,13 +388,13 @@ public class EditKeyActivity extends ActionBarActivity implements EditorListener
|
||||
mChangePassphrase.setText(getString(R.string.btn_change_passphrase));
|
||||
}
|
||||
mUserIdsView = (SectionView) inflater.inflate(R.layout.edit_key_section, container, false);
|
||||
mUserIdsView.setType(Id.type.user_id);
|
||||
mUserIdsView.setType(SectionView.TYPE_USER_ID);
|
||||
mUserIdsView.setCanBeEdited(mMasterCanSign);
|
||||
mUserIdsView.setUserIds(mUserIds);
|
||||
mUserIdsView.setEditorListener(this);
|
||||
container.addView(mUserIdsView);
|
||||
mKeysView = (SectionView) inflater.inflate(R.layout.edit_key_section, container, false);
|
||||
mKeysView.setType(Id.type.key);
|
||||
mKeysView.setType(SectionView.TYPE_KEY);
|
||||
mKeysView.setCanBeEdited(mMasterCanSign);
|
||||
mKeysView.setKeys(mKeys, mKeysUsages, newKeys);
|
||||
mKeysView.setEditorListener(this);
|
||||
|
||||
@@ -26,7 +26,6 @@ import android.support.v4.view.ViewPager;
|
||||
import android.widget.Toast;
|
||||
|
||||
import org.sufficientlysecure.keychain.Constants;
|
||||
import org.sufficientlysecure.keychain.Id;
|
||||
import org.sufficientlysecure.keychain.R;
|
||||
import org.sufficientlysecure.keychain.helper.ActionBarHelper;
|
||||
import org.sufficientlysecure.keychain.helper.FileHelper;
|
||||
@@ -74,7 +73,7 @@ public class EncryptActivity extends DrawerActivity implements
|
||||
|
||||
// model useb by message and file fragment
|
||||
private long mEncryptionKeyIds[] = null;
|
||||
private long mSigningKeyId = Id.key.none;
|
||||
private long mSigningKeyId = Constants.key.none;
|
||||
private String mPassphrase;
|
||||
private String mPassphraseAgain;
|
||||
|
||||
|
||||
@@ -33,7 +33,6 @@ import com.beardedhen.androidbootstrap.BootstrapButton;
|
||||
import org.spongycastle.openpgp.PGPSecretKey;
|
||||
import org.spongycastle.openpgp.PGPSecretKeyRing;
|
||||
import org.sufficientlysecure.keychain.Constants;
|
||||
import org.sufficientlysecure.keychain.Id;
|
||||
import org.sufficientlysecure.keychain.R;
|
||||
import org.sufficientlysecure.keychain.pgp.PgpKeyHelper;
|
||||
import org.sufficientlysecure.keychain.provider.KeychainContract.KeyRings;
|
||||
@@ -60,7 +59,7 @@ public class EncryptAsymmetricFragment extends Fragment {
|
||||
private TextView mMainUserIdRest;
|
||||
|
||||
// model
|
||||
private long mSecretKeyId = Id.key.none;
|
||||
private long mSecretKeyId = Constants.key.none;
|
||||
private long mEncryptionKeyIds[] = null;
|
||||
|
||||
// Container Activity must implement this interface
|
||||
@@ -116,7 +115,7 @@ public class EncryptAsymmetricFragment extends Fragment {
|
||||
if (checkBox.isChecked()) {
|
||||
selectSecretKey();
|
||||
} else {
|
||||
setSignatureKeyId(Id.key.none);
|
||||
setSignatureKeyId(Constants.key.none);
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -196,7 +195,7 @@ public class EncryptAsymmetricFragment extends Fragment {
|
||||
mEncryptionKeyIds.length));
|
||||
}
|
||||
|
||||
if (mSecretKeyId == Id.key.none) {
|
||||
if (mSecretKeyId == Constants.key.none) {
|
||||
mSign.setChecked(false);
|
||||
mMainUserId.setText("");
|
||||
mMainUserIdRest.setText("");
|
||||
@@ -263,7 +262,7 @@ public class EncryptAsymmetricFragment extends Fragment {
|
||||
Uri uriMasterKey = data.getData();
|
||||
setSignatureKeyId(Long.valueOf(uriMasterKey.getLastPathSegment()));
|
||||
} else {
|
||||
setSignatureKeyId(Id.key.none);
|
||||
setSignatureKeyId(Constants.key.none);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -38,7 +38,6 @@ import com.beardedhen.androidbootstrap.BootstrapButton;
|
||||
import com.devspark.appmsg.AppMsg;
|
||||
|
||||
import org.sufficientlysecure.keychain.Constants;
|
||||
import org.sufficientlysecure.keychain.Id;
|
||||
import org.sufficientlysecure.keychain.R;
|
||||
import org.sufficientlysecure.keychain.helper.FileHelper;
|
||||
import org.sufficientlysecure.keychain.helper.Preferences;
|
||||
@@ -112,13 +111,13 @@ public class EncryptFileFragment extends Fragment {
|
||||
|
||||
mFileCompression = (Spinner) view.findViewById(R.id.fileCompression);
|
||||
Choice[] choices = new Choice[]{
|
||||
new Choice(Id.choice.compression.none, getString(R.string.choice_none) + " ("
|
||||
new Choice(Constants.choice.compression.none, getString(R.string.choice_none) + " ("
|
||||
+ getString(R.string.compression_fast) + ")"),
|
||||
new Choice(Id.choice.compression.zip, "ZIP ("
|
||||
new Choice(Constants.choice.compression.zip, "ZIP ("
|
||||
+ getString(R.string.compression_fast) + ")"),
|
||||
new Choice(Id.choice.compression.zlib, "ZLIB ("
|
||||
new Choice(Constants.choice.compression.zlib, "ZLIB ("
|
||||
+ getString(R.string.compression_fast) + ")"),
|
||||
new Choice(Id.choice.compression.bzip2, "BZIP2 ("
|
||||
new Choice(Constants.choice.compression.bzip2, "BZIP2 ("
|
||||
+ getString(R.string.compression_very_slow) + ")"),
|
||||
};
|
||||
ArrayAdapter<Choice> adapter = new ArrayAdapter<Choice>(getActivity(),
|
||||
|
||||
@@ -28,7 +28,6 @@ import android.view.ViewGroup;
|
||||
import com.beardedhen.androidbootstrap.BootstrapButton;
|
||||
|
||||
import org.sufficientlysecure.keychain.Constants;
|
||||
import org.sufficientlysecure.keychain.Id;
|
||||
import org.sufficientlysecure.keychain.R;
|
||||
import org.sufficientlysecure.keychain.helper.FileHelper;
|
||||
|
||||
|
||||
@@ -55,7 +55,6 @@ import android.widget.ListView;
|
||||
import android.widget.TextView;
|
||||
import com.beardedhen.androidbootstrap.BootstrapButton;
|
||||
import org.sufficientlysecure.keychain.Constants;
|
||||
import org.sufficientlysecure.keychain.Id;
|
||||
import org.sufficientlysecure.keychain.R;
|
||||
import org.sufficientlysecure.keychain.helper.ExportHelper;
|
||||
import org.sufficientlysecure.keychain.pgp.PgpKeyHelper;
|
||||
@@ -238,7 +237,7 @@ public class KeyListFragment extends Fragment
|
||||
setListShown(false);
|
||||
|
||||
// Create an empty adapter we will use to display the loaded data.
|
||||
mAdapter = new KeyListAdapter(getActivity(), null, Id.type.public_key);
|
||||
mAdapter = new KeyListAdapter(getActivity(), null, 0);
|
||||
mStickyList.setAdapter(mAdapter);
|
||||
|
||||
// Prepare the loader. Either re-connect with an existing one,
|
||||
|
||||
@@ -31,7 +31,6 @@ import org.spongycastle.bcpg.HashAlgorithmTags;
|
||||
import org.spongycastle.openpgp.PGPEncryptedData;
|
||||
|
||||
import org.sufficientlysecure.keychain.Constants;
|
||||
import org.sufficientlysecure.keychain.Id;
|
||||
import org.sufficientlysecure.keychain.R;
|
||||
import org.sufficientlysecure.keychain.helper.Preferences;
|
||||
import org.sufficientlysecure.keychain.ui.widget.IntegerListPreference;
|
||||
@@ -89,8 +88,12 @@ public class PreferencesActivity extends PreferenceActivity {
|
||||
initializeEncryptionAlgorithm(
|
||||
(IntegerListPreference) findPreference(Constants.Pref.DEFAULT_ENCRYPTION_ALGORITHM));
|
||||
|
||||
int[] valueIds = new int[]{Id.choice.compression.none, Id.choice.compression.zip,
|
||||
Id.choice.compression.zlib, Id.choice.compression.bzip2,};
|
||||
int[] valueIds = new int[]{
|
||||
Constants.choice.compression.none,
|
||||
Constants.choice.compression.zip,
|
||||
Constants.choice.compression.zlib,
|
||||
Constants.choice.compression.bzip2,
|
||||
};
|
||||
String[] entries = new String[]{
|
||||
getString(R.string.choice_none) + " (" + getString(R.string.compression_fast) + ")",
|
||||
"ZIP (" + getString(R.string.compression_fast) + ")",
|
||||
@@ -226,13 +229,20 @@ public class PreferencesActivity extends PreferenceActivity {
|
||||
initializeEncryptionAlgorithm(
|
||||
(IntegerListPreference) findPreference(Constants.Pref.DEFAULT_ENCRYPTION_ALGORITHM));
|
||||
|
||||
int[] valueIds = new int[]{Id.choice.compression.none, Id.choice.compression.zip,
|
||||
Id.choice.compression.zlib, Id.choice.compression.bzip2,};
|
||||
int[] valueIds = new int[]{
|
||||
Constants.choice.compression.none,
|
||||
Constants.choice.compression.zip,
|
||||
Constants.choice.compression.zlib,
|
||||
Constants.choice.compression.bzip2,
|
||||
};
|
||||
|
||||
String[] entries = new String[]{
|
||||
getString(R.string.choice_none) + " (" + getString(R.string.compression_fast) + ")",
|
||||
"ZIP (" + getString(R.string.compression_fast) + ")",
|
||||
"ZLIB (" + getString(R.string.compression_fast) + ")",
|
||||
"BZIP2 (" + getString(R.string.compression_very_slow) + ")",};
|
||||
"BZIP2 (" + getString(R.string.compression_very_slow) + ")",
|
||||
};
|
||||
|
||||
String[] values = new String[valueIds.length];
|
||||
for (int i = 0; i < values.length; ++i) {
|
||||
values[i] = "" + valueIds[i];
|
||||
|
||||
@@ -34,7 +34,8 @@ import android.widget.ArrayAdapter;
|
||||
import android.widget.EditText;
|
||||
import android.widget.Spinner;
|
||||
import android.widget.TextView;
|
||||
import org.sufficientlysecure.keychain.Id;
|
||||
|
||||
import org.sufficientlysecure.keychain.Constants;
|
||||
import org.sufficientlysecure.keychain.R;
|
||||
import org.sufficientlysecure.keychain.util.Choice;
|
||||
|
||||
@@ -91,14 +92,14 @@ public class CreateKeyDialogFragment extends DialogFragment {
|
||||
|
||||
mAlgorithmSpinner = (Spinner) view.findViewById(R.id.create_key_algorithm);
|
||||
ArrayList<Choice> choices = new ArrayList<Choice>();
|
||||
choices.add(new Choice(Id.choice.algorithm.dsa, getResources().getString(
|
||||
choices.add(new Choice(Constants.choice.algorithm.dsa, getResources().getString(
|
||||
R.string.dsa)));
|
||||
if (!wouldBeMasterKey) {
|
||||
choices.add(new Choice(Id.choice.algorithm.elgamal, getResources().getString(
|
||||
choices.add(new Choice(Constants.choice.algorithm.elgamal, getResources().getString(
|
||||
R.string.elgamal)));
|
||||
}
|
||||
|
||||
choices.add(new Choice(Id.choice.algorithm.rsa, getResources().getString(
|
||||
choices.add(new Choice(Constants.choice.algorithm.rsa, getResources().getString(
|
||||
R.string.rsa)));
|
||||
|
||||
ArrayAdapter<Choice> adapter = new ArrayAdapter<Choice>(context,
|
||||
@@ -107,7 +108,7 @@ public class CreateKeyDialogFragment extends DialogFragment {
|
||||
mAlgorithmSpinner.setAdapter(adapter);
|
||||
// make RSA the default
|
||||
for (int i = 0; i < choices.size(); ++i) {
|
||||
if (choices.get(i).getId() == Id.choice.algorithm.rsa) {
|
||||
if (choices.get(i).getId() == Constants.choice.algorithm.rsa) {
|
||||
mAlgorithmSpinner.setSelection(i);
|
||||
break;
|
||||
}
|
||||
@@ -224,12 +225,12 @@ public class CreateKeyDialogFragment extends DialogFragment {
|
||||
final int[] elGamalSupportedLengths = {1536, 2048, 3072, 4096, 8192};
|
||||
int properKeyLength = -1;
|
||||
switch (algorithmId) {
|
||||
case Id.choice.algorithm.rsa:
|
||||
case Constants.choice.algorithm.rsa:
|
||||
if (currentKeyLength > 1024 && currentKeyLength <= 8192) {
|
||||
properKeyLength = currentKeyLength + ((8 - (currentKeyLength % 8)) % 8);
|
||||
}
|
||||
break;
|
||||
case Id.choice.algorithm.elgamal:
|
||||
case Constants.choice.algorithm.elgamal:
|
||||
int[] elGammalKeyDiff = new int[elGamalSupportedLengths.length];
|
||||
for (int i = 0; i < elGamalSupportedLengths.length; i++) {
|
||||
elGammalKeyDiff[i] = Math.abs(elGamalSupportedLengths[i] - currentKeyLength);
|
||||
@@ -244,7 +245,7 @@ public class CreateKeyDialogFragment extends DialogFragment {
|
||||
}
|
||||
properKeyLength = elGamalSupportedLengths[minimalIndex];
|
||||
break;
|
||||
case Id.choice.algorithm.dsa:
|
||||
case Constants.choice.algorithm.dsa:
|
||||
if (currentKeyLength >= 512 && currentKeyLength <= 1024) {
|
||||
properKeyLength = currentKeyLength + ((64 - (currentKeyLength % 64)) % 64);
|
||||
}
|
||||
@@ -283,15 +284,15 @@ public class CreateKeyDialogFragment extends DialogFragment {
|
||||
final Object selectedItem = mKeySizeSpinner.getSelectedItem();
|
||||
keySizeAdapter.clear();
|
||||
switch (algorithmId) {
|
||||
case Id.choice.algorithm.rsa:
|
||||
case Constants.choice.algorithm.rsa:
|
||||
replaceArrayAdapterContent(keySizeAdapter, R.array.rsa_key_size_spinner_values);
|
||||
mCustomKeyInfoTextView.setText(getResources().getString(R.string.key_size_custom_info_rsa));
|
||||
break;
|
||||
case Id.choice.algorithm.elgamal:
|
||||
case Constants.choice.algorithm.elgamal:
|
||||
replaceArrayAdapterContent(keySizeAdapter, R.array.elgamal_key_size_spinner_values);
|
||||
mCustomKeyInfoTextView.setText(""); // ElGamal does not support custom key length
|
||||
break;
|
||||
case Id.choice.algorithm.dsa:
|
||||
case Constants.choice.algorithm.dsa:
|
||||
replaceArrayAdapterContent(keySizeAdapter, R.array.dsa_key_size_spinner_values);
|
||||
mCustomKeyInfoTextView.setText(getResources().getString(R.string.key_size_custom_info_dsa));
|
||||
break;
|
||||
|
||||
@@ -46,7 +46,6 @@ import org.spongycastle.openpgp.PGPSecretKey;
|
||||
import org.spongycastle.openpgp.operator.PBESecretKeyDecryptor;
|
||||
import org.spongycastle.openpgp.operator.jcajce.JcePBESecretKeyDecryptorBuilder;
|
||||
import org.sufficientlysecure.keychain.Constants;
|
||||
import org.sufficientlysecure.keychain.Id;
|
||||
import org.sufficientlysecure.keychain.R;
|
||||
import org.sufficientlysecure.keychain.pgp.PgpKeyHelper;
|
||||
import org.sufficientlysecure.keychain.pgp.exception.PgpGeneralException;
|
||||
@@ -99,7 +98,7 @@ public class PassphraseDialogFragment extends DialogFragment implements OnEditor
|
||||
public static PassphraseDialogFragment newInstance(Context context, Messenger messenger,
|
||||
long secretKeyId) throws PgpGeneralException {
|
||||
// check if secret key has a passphrase
|
||||
if (!(secretKeyId == Id.key.symmetric || secretKeyId == Id.key.none)) {
|
||||
if (!(secretKeyId == Constants.key.symmetric || secretKeyId == Constants.key.none)) {
|
||||
if (!PassphraseCacheService.hasPassphrase(context, secretKeyId)) {
|
||||
throw new PgpGeneralException("No passphrase! No passphrase dialog needed!");
|
||||
}
|
||||
@@ -135,7 +134,7 @@ public class PassphraseDialogFragment extends DialogFragment implements OnEditor
|
||||
|
||||
final PGPSecretKey secretKey;
|
||||
|
||||
if (secretKeyId == Id.key.symmetric || secretKeyId == Id.key.none) {
|
||||
if (secretKeyId == Constants.key.symmetric || secretKeyId == Constants.key.none) {
|
||||
secretKey = null;
|
||||
alert.setMessage(R.string.passphrase_for_symmetric_encryption);
|
||||
} else {
|
||||
@@ -225,7 +224,7 @@ public class PassphraseDialogFragment extends DialogFragment implements OnEditor
|
||||
}
|
||||
keyId = secretKey.getKeyID();
|
||||
} else {
|
||||
keyId = Id.key.symmetric;
|
||||
keyId = Constants.key.symmetric;
|
||||
}
|
||||
|
||||
// cache the new passphrase
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user