clean up for release, AsciiArmour was a Button instead of CheckBox... fixed

This commit is contained in:
Thialfihar 2010-04-24 02:16:45 +00:00
parent fbd8f61aab
commit 2c093b3e0d
4 changed files with 9 additions and 11 deletions

View File

@ -30,7 +30,6 @@ import java.security.SignatureException;
import java.util.Collections; import java.util.Collections;
import java.util.Vector; import java.util.Vector;
import org.bouncycastle2.bcpg.HashAlgorithmTags;
import org.bouncycastle2.openpgp.PGPEncryptedData; import org.bouncycastle2.openpgp.PGPEncryptedData;
import org.bouncycastle2.openpgp.PGPException; import org.bouncycastle2.openpgp.PGPException;
import org.bouncycastle2.openpgp.PGPPublicKeyRing; import org.bouncycastle2.openpgp.PGPPublicKeyRing;
@ -75,7 +74,7 @@ public class EncryptFileActivity extends BaseActivity {
private Spinner mAlgorithm = null; private Spinner mAlgorithm = null;
private EditText mPassPhrase = null; private EditText mPassPhrase = null;
private EditText mPassPhraseAgain = null; private EditText mPassPhraseAgain = null;
private Button mAsciiArmour = null; private CheckBox mAsciiArmour = null;
private Button mEncryptButton = null; private Button mEncryptButton = null;
private long mEncryptionKeyIds[] = null; private long mEncryptionKeyIds[] = null;
@ -237,7 +236,8 @@ public class EncryptFileActivity extends BaseActivity {
if (mInputFilename == null || !mInputFilename.equals(currentFilename)) { if (mInputFilename == null || !mInputFilename.equals(currentFilename)) {
mInputFilename = mFilename.getText().toString(); mInputFilename = mFilename.getText().toString();
File file = new File(mInputFilename); File file = new File(mInputFilename);
mOutputFilename = Constants.path.app_dir + "/" + file.getName() + ".gpg"; String ending = (mAsciiArmour.isChecked() ? ".asc" : ".gpg");
mOutputFilename = Constants.path.app_dir + "/" + file.getName() + ending;
} }
if (mInputFilename.equals("")) { if (mInputFilename.equals("")) {
@ -262,8 +262,9 @@ public class EncryptFileActivity extends BaseActivity {
} }
boolean encryptIt = mEncryptionKeyIds != null && mEncryptionKeyIds.length > 0; boolean encryptIt = mEncryptionKeyIds != null && mEncryptionKeyIds.length > 0;
if (getSecretKeyId() == 0 && !encryptIt) { // for now only support encryption
Toast.makeText(this, "Select a signature key or encryption keys.", if (!encryptIt) {
Toast.makeText(this, "Select at least one encryption key.",
Toast.LENGTH_SHORT).show(); Toast.LENGTH_SHORT).show();
return; return;
} }
@ -328,13 +329,13 @@ public class EncryptFileActivity extends BaseActivity {
boolean encryptIt = mEncryptionKeyIds != null && mEncryptionKeyIds.length > 0; boolean encryptIt = mEncryptionKeyIds != null && mEncryptionKeyIds.length > 0;
if (encryptIt) { if (encryptIt) {
Apg.encrypt(in, out, mAsciiArmour.isSelected(), Apg.encrypt(in, out, mAsciiArmour.isChecked(),
mEncryptionKeyIds, getSecretKeyId(), mEncryptionKeyIds, getSecretKeyId(),
Apg.getPassPhrase(), this, Apg.getPassPhrase(), this,
PGPEncryptedData.AES_256, null); PGPEncryptedData.AES_256, null);
} }
} else { } else {
Apg.encrypt(in, out, mAsciiArmour.isSelected(), Apg.encrypt(in, out, mAsciiArmour.isChecked(),
null, 0, null, this, null, 0, null, this,
((Choice) mAlgorithm.getSelectedItem()).getId(), ((Choice) mAlgorithm.getSelectedItem()).getId(),
mPassPhrase.getText().toString()); mPassPhrase.getText().toString());

View File

@ -18,7 +18,6 @@ package org.thialfihar.android.apg;
import org.thialfihar.android.apg.provider.Accounts; import org.thialfihar.android.apg.provider.Accounts;
import android.app.Activity;
import android.app.AlertDialog; import android.app.AlertDialog;
import android.app.Dialog; import android.app.Dialog;
import android.content.ContentValues; import android.content.ContentValues;
@ -223,7 +222,7 @@ public class MainActivity extends BaseActivity {
SpannableString info = SpannableString info =
new SpannableString("Read the warnings!\n\n" + new SpannableString("Read the warnings!\n\n" +
"Changes:\n" + "Changes:\n" +
" * OI File Manager support\n" + " * OI File Manager support (install from Market)\n" +
" * file encryption/decryption\n" + " * file encryption/decryption\n" +
"\n" + "\n" +
"WARNING: be careful editing your existing keys, as they " + "WARNING: be careful editing your existing keys, as they " +

View File

@ -22,7 +22,6 @@ import java.util.Vector;
import org.bouncycastle2.openpgp.PGPPublicKey; import org.bouncycastle2.openpgp.PGPPublicKey;
import org.bouncycastle2.openpgp.PGPPublicKeyRing; import org.bouncycastle2.openpgp.PGPPublicKeyRing;
import android.app.Activity;
import android.content.Intent; import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
import android.view.View; import android.view.View;

View File

@ -25,7 +25,6 @@ import org.bouncycastle2.openpgp.PGPSecretKey;
import org.bouncycastle2.openpgp.PGPSecretKeyRing; import org.bouncycastle2.openpgp.PGPSecretKeyRing;
import org.thialfihar.android.apg.utils.IterableIterator; import org.thialfihar.android.apg.utils.IterableIterator;
import android.app.Activity;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;