@Override refactoring, some explicit casting added

This commit is contained in:
Oliver Runge 2011-09-17 23:44:06 +02:00
parent 50036a4642
commit 3ec27e07ae
24 changed files with 27 additions and 101 deletions

View File

@ -372,10 +372,10 @@ public class Apg {
new SecureRandom(), new BouncyCastleProvider().getName()); new SecureRandom(), new BouncyCastleProvider().getName());
ringGen.addSubKey(keyPair); ringGen.addSubKey(keyPair);
PGPSecretKeyRing secKeyRing = ringGen.generateSecretKeyRing(); PGPSecretKeyRing secKeyRing = ringGen.generateSecretKeyRing();
Iterator it = secKeyRing.getSecretKeys(); Iterator<PGPSecretKey> it = secKeyRing.getSecretKeys();
// first one is the master key // first one is the master key
it.next(); it.next();
secretKey = (PGPSecretKey) it.next(); secretKey = it.next();
} }
return secretKey; return secretKey;
@ -1048,7 +1048,7 @@ public class Apg {
} else if (i != 0 && i % 2 == 0) { } else if (i != 0 && i % 2 == 0) {
fingerPrint += " "; fingerPrint += " ";
} }
String chunk = Integer.toHexString((((int)fp[i]) + 256) % 256).toUpperCase(); String chunk = Integer.toHexString((fp[i] + 256) % 256).toUpperCase();
while (chunk.length() < 2) { while (chunk.length() < 2) {
chunk = "0" + chunk; chunk = "0" + chunk;
} }
@ -1597,7 +1597,7 @@ public class Apg {
// TODO: currently we always only look at the first known key // TODO: currently we always only look at the first known key
// find the secret key // find the secret key
PGPSecretKey secretKey = null; PGPSecretKey secretKey = null;
Iterator it = enc.getEncryptedDataObjects(); Iterator<?> it = enc.getEncryptedDataObjects();
boolean gotAsymmetricEncryption = false; boolean gotAsymmetricEncryption = false;
while (it.hasNext()) { while (it.hasNext()) {
Object obj = it.next(); Object obj = it.next();
@ -1640,7 +1640,7 @@ public class Apg {
throw new GeneralException(context.getString(R.string.error_invalidData)); throw new GeneralException(context.getString(R.string.error_invalidData));
} }
Iterator it = enc.getEncryptedDataObjects(); Iterator<?> it = enc.getEncryptedDataObjects();
while (it.hasNext()) { while (it.hasNext()) {
Object obj = it.next(); Object obj = it.next();
if (obj instanceof PGPPBEEncryptedData) { if (obj instanceof PGPPBEEncryptedData) {
@ -1688,7 +1688,7 @@ public class Apg {
// there might be more... // there might be more...
if (assumeSymmetric) { if (assumeSymmetric) {
PGPPBEEncryptedData pbe = null; PGPPBEEncryptedData pbe = null;
Iterator it = enc.getEncryptedDataObjects(); Iterator<?> it = enc.getEncryptedDataObjects();
// find secret key // find secret key
while (it.hasNext()) { while (it.hasNext()) {
Object obj = it.next(); Object obj = it.next();
@ -1710,7 +1710,7 @@ public class Apg {
progress.setProgress(R.string.progress_findingKey, currentProgress, 100); progress.setProgress(R.string.progress_findingKey, currentProgress, 100);
PGPPublicKeyEncryptedData pbe = null; PGPPublicKeyEncryptedData pbe = null;
PGPSecretKey secretKey = null; PGPSecretKey secretKey = null;
Iterator it = enc.getEncryptedDataObjects(); Iterator<?> it = enc.getEncryptedDataObjects();
// find secret key // find secret key
while (it.hasNext()) { while (it.hasNext()) {
Object obj = it.next(); Object obj = it.next();
@ -1842,7 +1842,7 @@ public class Apg {
if (signature != null) { if (signature != null) {
progress.setProgress(R.string.progress_verifyingSignature, 90, 100); progress.setProgress(R.string.progress_verifyingSignature, 90, 100);
PGPSignatureList signatureList = (PGPSignatureList) plainFact.nextObject(); PGPSignatureList signatureList = (PGPSignatureList) plainFact.nextObject();
PGPSignature messageSignature = (PGPSignature) signatureList.get(signatureIndex); PGPSignature messageSignature = signatureList.get(signatureIndex);
if (signature.verify(messageSignature)) { if (signature.verify(messageSignature)) {
returnData.putBoolean(EXTRA_SIGNATURE_SUCCESS, true); returnData.putBoolean(EXTRA_SIGNATURE_SUCCESS, true);
} else { } else {
@ -2195,13 +2195,13 @@ public class Apg {
random.nextBytes(bytes); random.nextBytes(bytes);
String result = ""; String result = "";
for (int i = 0; i < length; ++i) { for (int i = 0; i < length; ++i) {
int v = ((int)bytes[i] + 256) % 64; int v = (bytes[i] + 256) % 64;
if (v < 10) { if (v < 10) {
result += (char)((int)'0' + v); result += (char)('0' + v);
} else if (v < 36) { } else if (v < 36) {
result += (char)((int)'A' + v - 10); result += (char)('A' + v - 10);
} else if (v < 62) { } else if (v < 62) {
result += (char)((int)'a' + v - 36); result += (char)('a' + v - 36);
} else if (v == 62) { } else if (v == 62) {
result += '_'; result += '_';
} else if (v == 63) { } else if (v == 63) {

View File

@ -20,8 +20,6 @@ import org.bouncycastle2.jce.provider.BouncyCastleProvider;
import org.bouncycastle2.openpgp.PGPException; import org.bouncycastle2.openpgp.PGPException;
import org.bouncycastle2.openpgp.PGPPrivateKey; import org.bouncycastle2.openpgp.PGPPrivateKey;
import org.bouncycastle2.openpgp.PGPSecretKey; import org.bouncycastle2.openpgp.PGPSecretKey;
import org.thialfihar.android.apg.Apg.GeneralException;
import android.app.Activity; import android.app.Activity;
import android.app.AlertDialog; import android.app.AlertDialog;
import android.app.Dialog; import android.app.Dialog;
@ -56,7 +54,6 @@ public class AskForSecretKeyPassPhrase {
alert.setTitle(R.string.title_keyNotFound); alert.setTitle(R.string.title_keyNotFound);
alert.setMessage(context.getString(R.string.keyNotFound, secretKeyId)); alert.setMessage(context.getString(R.string.keyNotFound, secretKeyId));
alert.setPositiveButton(android.R.string.ok, new OnClickListener() { alert.setPositiveButton(android.R.string.ok, new OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) { public void onClick(DialogInterface dialog, int which) {
activity.removeDialog(Id.dialog.pass_phrase); activity.removeDialog(Id.dialog.pass_phrase);
} }

View File

@ -253,7 +253,6 @@ public class BaseActivity extends Activity
final File file = new File(getDeleteFile()); final File file = new File(getDeleteFile());
showDialog(Id.dialog.deleting); showDialog(Id.dialog.deleting);
mDeletingThread = new Thread(new Runnable() { mDeletingThread = new Thread(new Runnable() {
@Override
public void run() { public void run() {
Bundle data = new Bundle(); Bundle data = new Bundle();
data.putInt(Constants.extras.status, Id.message.delete_done); data.putInt(Constants.extras.status, Id.message.delete_done);

View File

@ -10,13 +10,15 @@ public class CachedPassPhrase {
this.passPhrase = passPhrase; this.passPhrase = passPhrase;
} }
public int hashCode() { @Override
public int hashCode() {
int hc1 = (int)(this.timestamp & 0xffffffff); int hc1 = (int)(this.timestamp & 0xffffffff);
int hc2 = (this.passPhrase == null ? 0 : this.passPhrase.hashCode()); int hc2 = (this.passPhrase == null ? 0 : this.passPhrase.hashCode());
return (hc1 + hc2) * hc2 + hc1; return (hc1 + hc2) * hc2 + hc1;
} }
public boolean equals(Object other) { @Override
public boolean equals(Object other) {
if (!(other instanceof CachedPassPhrase)) { if (!(other instanceof CachedPassPhrase)) {
return false; return false;
} }
@ -39,7 +41,8 @@ public class CachedPassPhrase {
return true; return true;
} }
public String toString() { @Override
public String toString() {
return "(" + timestamp + ", *******)"; return "(" + timestamp + ", *******)";
} }
} }

View File

@ -108,7 +108,6 @@ public class DecryptActivity extends BaseActivity {
mSourcePrevious.setClickable(true); mSourcePrevious.setClickable(true);
mSourcePrevious.setOnClickListener(new OnClickListener() { mSourcePrevious.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) { public void onClick(View v) {
mSource.setInAnimation(AnimationUtils.loadAnimation(DecryptActivity.this, mSource.setInAnimation(AnimationUtils.loadAnimation(DecryptActivity.this,
R.anim.push_right_in)); R.anim.push_right_in));
@ -121,7 +120,6 @@ public class DecryptActivity extends BaseActivity {
mSourceNext.setClickable(true); mSourceNext.setClickable(true);
OnClickListener nextSourceClickListener = new OnClickListener() { OnClickListener nextSourceClickListener = new OnClickListener() {
@Override
public void onClick(View v) { public void onClick(View v) {
mSource.setInAnimation(AnimationUtils.loadAnimation(DecryptActivity.this, mSource.setInAnimation(AnimationUtils.loadAnimation(DecryptActivity.this,
R.anim.push_left_in)); R.anim.push_left_in));
@ -154,7 +152,6 @@ public class DecryptActivity extends BaseActivity {
mFilename = (EditText) findViewById(R.id.filename); mFilename = (EditText) findViewById(R.id.filename);
mBrowse = (ImageButton) findViewById(R.id.btn_browse); mBrowse = (ImageButton) findViewById(R.id.btn_browse);
mBrowse.setOnClickListener(new View.OnClickListener() { mBrowse.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) { public void onClick(View v) {
openFile(); openFile();
} }
@ -282,7 +279,6 @@ public class DecryptActivity extends BaseActivity {
mSignatureLayout.setVisibility(View.GONE); mSignatureLayout.setVisibility(View.GONE);
mSignatureLayout.setOnClickListener(new OnClickListener() { mSignatureLayout.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) { public void onClick(View v) {
if (mSignatureKeyId == 0) { if (mSignatureKeyId == 0) {
return; return;
@ -298,14 +294,12 @@ public class DecryptActivity extends BaseActivity {
}); });
mDecryptButton.setOnClickListener(new OnClickListener() { mDecryptButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) { public void onClick(View v) {
decryptClicked(); decryptClicked();
} }
}); });
mReplyButton.setOnClickListener(new OnClickListener() { mReplyButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) { public void onClick(View v) {
replyClicked(); replyClicked();
} }
@ -704,14 +698,12 @@ public class DecryptActivity extends BaseActivity {
getString(R.string.specifyFileToDecryptTo), getString(R.string.specifyFileToDecryptTo),
mOutputFilename, mOutputFilename,
new FileDialog.OnClickListener() { new FileDialog.OnClickListener() {
@Override
public void onOkClick(String filename, boolean checked) { public void onOkClick(String filename, boolean checked) {
removeDialog(Id.dialog.output_filename); removeDialog(Id.dialog.output_filename);
mOutputFilename = filename; mOutputFilename = filename;
decryptStart(); decryptStart();
} }
@Override
public void onCancelClick() { public void onCancelClick() {
removeDialog(Id.dialog.output_filename); removeDialog(Id.dialog.output_filename);
} }

View File

@ -93,7 +93,6 @@ public class EditKeyActivity extends BaseActivity implements OnClickListener {
mChangePassPhrase = (Button) findViewById(R.id.btn_change_pass_phrase); mChangePassPhrase = (Button) findViewById(R.id.btn_change_pass_phrase);
mChangePassPhrase.setOnClickListener(new OnClickListener() { mChangePassPhrase.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) { public void onClick(View v) {
showDialog(Id.dialog.new_pass_phrase); showDialog(Id.dialog.new_pass_phrase);
} }
@ -209,7 +208,6 @@ public class EditKeyActivity extends BaseActivity implements OnClickListener {
} }
} }
@Override
public void onClick(View v) { public void onClick(View v) {
if (v == mSaveButton) { if (v == mSaveButton) {
// TODO: some warning // TODO: some warning

View File

@ -119,7 +119,6 @@ public class EncryptActivity extends BaseActivity {
mSourcePrevious.setClickable(true); mSourcePrevious.setClickable(true);
mSourcePrevious.setOnClickListener(new OnClickListener() { mSourcePrevious.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) { public void onClick(View v) {
mSource.setInAnimation(AnimationUtils.loadAnimation(EncryptActivity.this, mSource.setInAnimation(AnimationUtils.loadAnimation(EncryptActivity.this,
R.anim.push_right_in)); R.anim.push_right_in));
@ -132,7 +131,6 @@ public class EncryptActivity extends BaseActivity {
mSourceNext.setClickable(true); mSourceNext.setClickable(true);
OnClickListener nextSourceClickListener = new OnClickListener() { OnClickListener nextSourceClickListener = new OnClickListener() {
@Override
public void onClick(View v) { public void onClick(View v) {
mSource.setInAnimation(AnimationUtils.loadAnimation(EncryptActivity.this, mSource.setInAnimation(AnimationUtils.loadAnimation(EncryptActivity.this,
R.anim.push_left_in)); R.anim.push_left_in));
@ -154,7 +152,6 @@ public class EncryptActivity extends BaseActivity {
mModePrevious.setClickable(true); mModePrevious.setClickable(true);
mModePrevious.setOnClickListener(new OnClickListener() { mModePrevious.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) { public void onClick(View v) {
mMode.setInAnimation(AnimationUtils.loadAnimation(EncryptActivity.this, mMode.setInAnimation(AnimationUtils.loadAnimation(EncryptActivity.this,
R.anim.push_right_in)); R.anim.push_right_in));
@ -166,7 +163,6 @@ public class EncryptActivity extends BaseActivity {
}); });
OnClickListener nextModeClickListener = new OnClickListener() { OnClickListener nextModeClickListener = new OnClickListener() {
@Override
public void onClick(View v) { public void onClick(View v) {
mMode.setInAnimation(AnimationUtils.loadAnimation(EncryptActivity.this, mMode.setInAnimation(AnimationUtils.loadAnimation(EncryptActivity.this,
R.anim.push_left_in)); R.anim.push_left_in));
@ -202,7 +198,6 @@ public class EncryptActivity extends BaseActivity {
mFilename = (EditText) findViewById(R.id.filename); mFilename = (EditText) findViewById(R.id.filename);
mBrowse = (ImageButton) findViewById(R.id.btn_browse); mBrowse = (ImageButton) findViewById(R.id.btn_browse);
mBrowse.setOnClickListener(new View.OnClickListener() { mBrowse.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) { public void onClick(View v) {
openFile(); openFile();
} }
@ -234,35 +229,30 @@ public class EncryptActivity extends BaseActivity {
mAsciiArmour = (CheckBox) findViewById(R.id.asciiArmour); mAsciiArmour = (CheckBox) findViewById(R.id.asciiArmour);
mAsciiArmour.setChecked(mPreferences.getDefaultAsciiArmour()); mAsciiArmour.setChecked(mPreferences.getDefaultAsciiArmour());
mAsciiArmour.setOnClickListener(new OnClickListener() { mAsciiArmour.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View view) { public void onClick(View view) {
guessOutputFilename(); guessOutputFilename();
} }
}); });
mEncryptToClipboardButton.setOnClickListener(new OnClickListener() { mEncryptToClipboardButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) { public void onClick(View v) {
encryptToClipboardClicked(); encryptToClipboardClicked();
} }
}); });
mEncryptButton.setOnClickListener(new OnClickListener() { mEncryptButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) { public void onClick(View v) {
encryptClicked(); encryptClicked();
} }
}); });
mSelectKeysButton.setOnClickListener(new OnClickListener() { mSelectKeysButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) { public void onClick(View v) {
selectPublicKeys(); selectPublicKeys();
} }
}); });
mSign.setOnClickListener(new OnClickListener() { mSign.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) { public void onClick(View v) {
CheckBox checkBox = (CheckBox) v; CheckBox checkBox = (CheckBox) v;
if (checkBox.isChecked()) { if (checkBox.isChecked()) {
@ -949,14 +939,12 @@ public class EncryptActivity extends BaseActivity {
getString(R.string.specifyFileToEncryptTo), getString(R.string.specifyFileToEncryptTo),
mOutputFilename, mOutputFilename,
new FileDialog.OnClickListener() { new FileDialog.OnClickListener() {
@Override
public void onOkClick(String filename, boolean checked) { public void onOkClick(String filename, boolean checked) {
removeDialog(Id.dialog.output_filename); removeDialog(Id.dialog.output_filename);
mOutputFilename = filename; mOutputFilename = filename;
encryptStart(); encryptStart();
} }
@Override
public void onCancelClick() { public void onCancelClick() {
removeDialog(Id.dialog.output_filename); removeDialog(Id.dialog.output_filename);
} }

View File

@ -58,14 +58,13 @@ public class FileDialog {
alert.setTitle(title); alert.setTitle(title);
alert.setMessage(message); alert.setMessage(message);
View view = (View) inflater.inflate(R.layout.file_dialog, null); View view = inflater.inflate(R.layout.file_dialog, null);
mActivity = activity; mActivity = activity;
mFilename = (EditText) view.findViewById(R.id.input); mFilename = (EditText) view.findViewById(R.id.input);
mFilename.setText(defaultFile); mFilename.setText(defaultFile);
mBrowse = (ImageButton) view.findViewById(R.id.btn_browse); mBrowse = (ImageButton) view.findViewById(R.id.btn_browse);
mBrowse.setOnClickListener(new View.OnClickListener() { mBrowse.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) { public void onClick(View v) {
openFile(); openFile();
} }

View File

@ -94,7 +94,6 @@ public class GeneralActivity extends BaseActivity {
mList.setAdapter(mAdapter); mList.setAdapter(mAdapter);
mList.setOnItemClickListener(new OnItemClickListener() { mList.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) { public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) {
clicked(mAdapter.getItem(arg2).getId()); clicked(mAdapter.getItem(arg2).getId());
} }
@ -102,8 +101,6 @@ public class GeneralActivity extends BaseActivity {
mCancelButton = (Button) findViewById(R.id.btn_cancel); mCancelButton = (Button) findViewById(R.id.btn_cancel);
mCancelButton.setOnClickListener(new OnClickListener() { mCancelButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) { public void onClick(View v) {
GeneralActivity.this.finish(); GeneralActivity.this.finish();
} }

View File

@ -86,12 +86,11 @@ public class KeyListActivity extends BaseActivity {
mList = (ExpandableListView) findViewById(R.id.list); mList = (ExpandableListView) findViewById(R.id.list);
registerForContextMenu(mList); registerForContextMenu(mList);
mFilterLayout = (View) findViewById(R.id.layout_filter); mFilterLayout = findViewById(R.id.layout_filter);
mFilterInfo = (TextView) mFilterLayout.findViewById(R.id.filterInfo); mFilterInfo = (TextView) mFilterLayout.findViewById(R.id.filterInfo);
mClearFilterButton = (Button) mFilterLayout.findViewById(R.id.btn_clear); mClearFilterButton = (Button) mFilterLayout.findViewById(R.id.btn_clear);
mClearFilterButton.setOnClickListener(new OnClickListener() { mClearFilterButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) { public void onClick(View v) {
handleIntent(new Intent()); handleIntent(new Intent());
} }
@ -232,8 +231,6 @@ public class KeyListActivity extends BaseActivity {
getString(R.string.specifyFileToImportFrom), getString(R.string.specifyFileToImportFrom),
mImportFilename, mImportFilename,
new FileDialog.OnClickListener() { new FileDialog.OnClickListener() {
@Override
public void onOkClick(String filename, boolean checked) { public void onOkClick(String filename, boolean checked) {
removeDialog(Id.dialog.import_keys); removeDialog(Id.dialog.import_keys);
mDeleteAfterImport = checked; mDeleteAfterImport = checked;
@ -241,7 +238,6 @@ public class KeyListActivity extends BaseActivity {
importKeys(); importKeys();
} }
@Override
public void onCancelClick() { public void onCancelClick() {
removeDialog(Id.dialog.import_keys); removeDialog(Id.dialog.import_keys);
} }
@ -270,14 +266,12 @@ public class KeyListActivity extends BaseActivity {
R.string.specifyFileToExportSecretKeysTo), R.string.specifyFileToExportSecretKeysTo),
mExportFilename, mExportFilename,
new FileDialog.OnClickListener() { new FileDialog.OnClickListener() {
@Override
public void onOkClick(String filename, boolean checked) { public void onOkClick(String filename, boolean checked) {
removeDialog(thisDialogId); removeDialog(thisDialogId);
mExportFilename = filename; mExportFilename = filename;
exportKeys(); exportKeys();
} }
@Override
public void onCancelClick() { public void onCancelClick() {
removeDialog(thisDialogId); removeDialog(thisDialogId);
} }
@ -646,12 +640,10 @@ public class KeyListActivity extends BaseActivity {
return children; return children;
} }
@Override
public boolean hasStableIds() { public boolean hasStableIds() {
return true; return true;
} }
@Override
public boolean isChildSelectable(int groupPosition, int childPosition) { public boolean isChildSelectable(int groupPosition, int childPosition) {
return true; return true;
} }

View File

@ -70,7 +70,6 @@ public class KeyServerPreferenceActivity extends BaseActivity
Button okButton = (Button) findViewById(R.id.btn_ok); Button okButton = (Button) findViewById(R.id.btn_ok);
okButton.setOnClickListener(new OnClickListener() { okButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) { public void onClick(View v) {
okClicked(); okClicked();
} }
@ -78,7 +77,6 @@ public class KeyServerPreferenceActivity extends BaseActivity
Button cancelButton = (Button) findViewById(R.id.btn_cancel); Button cancelButton = (Button) findViewById(R.id.btn_cancel);
cancelButton.setOnClickListener(new OnClickListener() { cancelButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) { public void onClick(View v) {
cancelClicked(); cancelClicked();
} }

View File

@ -71,14 +71,12 @@ public class KeyServerQueryActivity extends BaseActivity {
} }
mList.setOnItemClickListener(new OnItemClickListener() { mList.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> adapter, View view, int position, long keyId) { public void onItemClick(AdapterView<?> adapter, View view, int position, long keyId) {
get(keyId); get(keyId);
} }
}); });
mSearch.setOnClickListener(new OnClickListener() { mSearch.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) { public void onClick(View v) {
String query = mQuery.getText().toString(); String query = mQuery.getText().toString();
search(query); search(query);
@ -112,7 +110,8 @@ public class KeyServerQueryActivity extends BaseActivity {
startThread(); startThread();
} }
protected Dialog onCreateDialog(int id) { @Override
protected Dialog onCreateDialog(int id) {
ProgressDialog progress = (ProgressDialog) super.onCreateDialog(id); ProgressDialog progress = (ProgressDialog) super.onCreateDialog(id);
progress.setMessage(this.getString(R.string.progress_queryingServer, progress.setMessage(this.getString(R.string.progress_queryingServer,
(String)mKeyServer.getSelectedItem())); (String)mKeyServer.getSelectedItem()));
@ -211,22 +210,18 @@ public class KeyServerQueryActivity extends BaseActivity {
return true; return true;
} }
@Override
public int getCount() { public int getCount() {
return mKeys.size(); return mKeys.size();
} }
@Override
public Object getItem(int position) { public Object getItem(int position) {
return mKeys.get(position); return mKeys.get(position);
} }
@Override
public long getItemId(int position) { public long getItemId(int position) {
return mKeys.get(position).keyId; return mKeys.get(position).keyId;
} }
@Override
public View getView(int position, View convertView, ViewGroup parent) { public View getView(int position, View convertView, ViewGroup parent) {
KeyInfo keyInfo = mKeys.get(position); KeyInfo keyInfo = mKeys.get(position);

View File

@ -153,7 +153,6 @@ public class MailListActivity extends ListActivity {
setListAdapter(new MailboxAdapter()); setListAdapter(new MailboxAdapter());
getListView().setOnItemClickListener(new OnItemClickListener() { getListView().setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> arg0, View v, int position, long id) { public void onItemClick(AdapterView<?> arg0, View v, int position, long id) {
Intent intent = new Intent(MailListActivity.this, DecryptActivity.class); Intent intent = new Intent(MailListActivity.this, DecryptActivity.class);
intent.setAction(Apg.Intent.DECRYPT); intent.setAction(Apg.Intent.DECRYPT);
@ -179,22 +178,18 @@ public class MailListActivity extends ListActivity {
return true; return true;
} }
@Override
public int getCount() { public int getCount() {
return mMessages.size(); return mMessages.size();
} }
@Override
public Object getItem(int position) { public Object getItem(int position) {
return mMessages.get(position); return mMessages.get(position);
} }
@Override
public long getItemId(int position) { public long getItemId(int position) {
return mMessages.get(position).id; return mMessages.get(position).id;
} }
@Override
public View getView(int position, View convertView, ViewGroup parent) { public View getView(int position, View convertView, ViewGroup parent) {
View view = mInflater.inflate(R.layout.mailbox_message_item, null); View view = mInflater.inflate(R.layout.mailbox_message_item, null);

View File

@ -67,7 +67,6 @@ public class MainActivity extends BaseActivity {
mAccounts = (ListView) findViewById(R.id.accounts); mAccounts = (ListView) findViewById(R.id.accounts);
encryptMessageButton.setOnClickListener(new OnClickListener() { encryptMessageButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) { public void onClick(View v) {
Intent intent = new Intent(MainActivity.this, EncryptActivity.class); Intent intent = new Intent(MainActivity.this, EncryptActivity.class);
intent.setAction(Apg.Intent.ENCRYPT); intent.setAction(Apg.Intent.ENCRYPT);
@ -76,7 +75,6 @@ public class MainActivity extends BaseActivity {
}); });
decryptMessageButton.setOnClickListener(new OnClickListener() { decryptMessageButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) { public void onClick(View v) {
Intent intent = new Intent(MainActivity.this, DecryptActivity.class); Intent intent = new Intent(MainActivity.this, DecryptActivity.class);
intent.setAction(Apg.Intent.DECRYPT); intent.setAction(Apg.Intent.DECRYPT);
@ -85,7 +83,6 @@ public class MainActivity extends BaseActivity {
}); });
encryptFileButton.setOnClickListener(new OnClickListener() { encryptFileButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) { public void onClick(View v) {
Intent intent = new Intent(MainActivity.this, EncryptActivity.class); Intent intent = new Intent(MainActivity.this, EncryptActivity.class);
intent.setAction(Apg.Intent.ENCRYPT_FILE); intent.setAction(Apg.Intent.ENCRYPT_FILE);
@ -94,7 +91,6 @@ public class MainActivity extends BaseActivity {
}); });
decryptFileButton.setOnClickListener(new OnClickListener() { decryptFileButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) { public void onClick(View v) {
Intent intent = new Intent(MainActivity.this, DecryptActivity.class); Intent intent = new Intent(MainActivity.this, DecryptActivity.class);
intent.setAction(Apg.Intent.DECRYPT_FILE); intent.setAction(Apg.Intent.DECRYPT_FILE);
@ -113,7 +109,6 @@ public class MainActivity extends BaseActivity {
mListAdapter = new AccountListAdapter(this, mAccountCursor); mListAdapter = new AccountListAdapter(this, mAccountCursor);
mAccounts.setAdapter(mListAdapter); mAccounts.setAdapter(mListAdapter);
mAccounts.setOnItemClickListener(new OnItemClickListener() { mAccounts.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> arg0, View view, int index, long id) { public void onItemClick(AdapterView<?> arg0, View view, int index, long id) {
String accountName = (String) mAccounts.getItemAtPosition(index); String accountName = (String) mAccounts.getItemAtPosition(index);
startActivity(new Intent(MainActivity.this, MailListActivity.class) startActivity(new Intent(MainActivity.this, MailListActivity.class)
@ -142,7 +137,7 @@ public class MainActivity extends BaseActivity {
LayoutInflater inflater = LayoutInflater inflater =
(LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE); (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View view = (View) inflater.inflate(R.layout.add_account_dialog, null); View view = inflater.inflate(R.layout.add_account_dialog, null);
final EditText input = (EditText) view.findViewById(R.id.input); final EditText input = (EditText) view.findViewById(R.id.input);
alert.setView(view); alert.setView(view);

View File

@ -106,7 +106,6 @@ public class SecretKeyListActivity extends KeyListActivity implements OnChildCli
} }
} }
@Override
public boolean onChildClick(ExpandableListView parent, View v, int groupPosition, public boolean onChildClick(ExpandableListView parent, View v, int groupPosition,
int childPosition, long id) { int childPosition, long id) {
mSelectedItem = groupPosition; mSelectedItem = groupPosition;

View File

@ -48,7 +48,6 @@ public class SelectPublicKeyListActivity extends BaseActivity {
Button okButton = (Button) findViewById(R.id.btn_ok); Button okButton = (Button) findViewById(R.id.btn_ok);
okButton.setOnClickListener(new OnClickListener() { okButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) { public void onClick(View v) {
okClicked(); okClicked();
} }
@ -56,18 +55,16 @@ public class SelectPublicKeyListActivity extends BaseActivity {
Button cancelButton = (Button) findViewById(R.id.btn_cancel); Button cancelButton = (Button) findViewById(R.id.btn_cancel);
cancelButton.setOnClickListener(new OnClickListener() { cancelButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) { public void onClick(View v) {
cancelClicked(); cancelClicked();
} }
}); });
mFilterLayout = (View) findViewById(R.id.layout_filter); mFilterLayout = findViewById(R.id.layout_filter);
mFilterInfo = (TextView) mFilterLayout.findViewById(R.id.filterInfo); mFilterInfo = (TextView) mFilterLayout.findViewById(R.id.filterInfo);
mClearFilterButton = (Button) mFilterLayout.findViewById(R.id.btn_clear); mClearFilterButton = (Button) mFilterLayout.findViewById(R.id.btn_clear);
mClearFilterButton.setOnClickListener(new OnClickListener() { mClearFilterButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) { public void onClick(View v) {
handleIntent(new Intent()); handleIntent(new Intent());
} }

View File

@ -143,24 +143,20 @@ public class SelectPublicKeyListAdapter extends BaseAdapter {
return true; return true;
} }
@Override
public int getCount() { public int getCount() {
return mCursor.getCount(); return mCursor.getCount();
} }
@Override
public Object getItem(int position) { public Object getItem(int position) {
mCursor.moveToPosition(position); mCursor.moveToPosition(position);
return mCursor.getString(2); // USER_ID return mCursor.getString(2); // USER_ID
} }
@Override
public long getItemId(int position) { public long getItemId(int position) {
mCursor.moveToPosition(position); mCursor.moveToPosition(position);
return mCursor.getLong(1); // MASTER_KEY_ID return mCursor.getLong(1); // MASTER_KEY_ID
} }
@Override
public View getView(int position, View convertView, ViewGroup parent) { public View getView(int position, View convertView, ViewGroup parent) {
mCursor.moveToPosition(position); mCursor.moveToPosition(position);

View File

@ -48,7 +48,6 @@ public class SelectSecretKeyListActivity extends BaseActivity {
mList = (ListView) findViewById(R.id.list); mList = (ListView) findViewById(R.id.list);
mList.setOnItemClickListener(new OnItemClickListener() { mList.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> adapterView, View view, int position, long id) { public void onItemClick(AdapterView<?> adapterView, View view, int position, long id) {
Intent data = new Intent(); Intent data = new Intent();
data.putExtra(Apg.EXTRA_KEY_ID, id); data.putExtra(Apg.EXTRA_KEY_ID, id);
@ -58,12 +57,11 @@ public class SelectSecretKeyListActivity extends BaseActivity {
} }
}); });
mFilterLayout = (View) findViewById(R.id.layout_filter); mFilterLayout = findViewById(R.id.layout_filter);
mFilterInfo = (TextView) mFilterLayout.findViewById(R.id.filterInfo); mFilterInfo = (TextView) mFilterLayout.findViewById(R.id.filterInfo);
mClearFilterButton = (Button) mFilterLayout.findViewById(R.id.btn_clear); mClearFilterButton = (Button) mFilterLayout.findViewById(R.id.btn_clear);
mClearFilterButton.setOnClickListener(new OnClickListener() { mClearFilterButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) { public void onClick(View v) {
handleIntent(new Intent()); handleIntent(new Intent());
} }

View File

@ -102,24 +102,20 @@ public class SelectSecretKeyListAdapter extends BaseAdapter {
return true; return true;
} }
@Override
public int getCount() { public int getCount() {
return mCursor.getCount(); return mCursor.getCount();
} }
@Override
public Object getItem(int position) { public Object getItem(int position) {
mCursor.moveToPosition(position); mCursor.moveToPosition(position);
return mCursor.getString(2); // USER_ID return mCursor.getString(2); // USER_ID
} }
@Override
public long getItemId(int position) { public long getItemId(int position) {
mCursor.moveToPosition(position); mCursor.moveToPosition(position);
return mCursor.getLong(1); // MASTER_KEY_ID return mCursor.getLong(1); // MASTER_KEY_ID
} }
@Override
public View getView(int position, View convertView, ViewGroup parent) { public View getView(int position, View convertView, ViewGroup parent) {
mCursor.moveToPosition(position); mCursor.moveToPosition(position);

View File

@ -105,7 +105,6 @@ public class KeyEditor extends LinearLayout implements Editor, OnClickListener {
setExpiryDate(null); setExpiryDate(null);
mExpiryDateButton.setOnClickListener(new OnClickListener() { mExpiryDateButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) { public void onClick(View v) {
GregorianCalendar date = mExpiryDate; GregorianCalendar date = mExpiryDate;
if (date == null) { if (date == null) {
@ -201,7 +200,6 @@ public class KeyEditor extends LinearLayout implements Editor, OnClickListener {
return mKey; return mKey;
} }
@Override
public void onClick(View v) { public void onClick(View v) {
final ViewGroup parent = (ViewGroup)getParent(); final ViewGroup parent = (ViewGroup)getParent();
if (v == mDeleteButton) { if (v == mDeleteButton) {
@ -212,7 +210,6 @@ public class KeyEditor extends LinearLayout implements Editor, OnClickListener {
} }
} }
@Override
public void setEditorListener(EditorListener listener) { public void setEditorListener(EditorListener listener) {
mEditorListener = listener; mEditorListener = listener;
} }

View File

@ -62,7 +62,6 @@ public class KeyServerEditor extends LinearLayout implements Editor, OnClickList
return mServer.getText().toString().trim(); return mServer.getText().toString().trim();
} }
@Override
public void onClick(View v) { public void onClick(View v) {
final ViewGroup parent = (ViewGroup)getParent(); final ViewGroup parent = (ViewGroup)getParent();
if (v == mDeleteButton) { if (v == mDeleteButton) {
@ -73,7 +72,6 @@ public class KeyServerEditor extends LinearLayout implements Editor, OnClickList
} }
} }
@Override
public void setEditorListener(EditorListener listener) { public void setEditorListener(EditorListener listener) {
mEditorListener = listener; mEditorListener = listener;
} }

View File

@ -212,7 +212,6 @@ public class SectionView extends LinearLayout implements OnClickListener, Editor
dialog.setPositiveButton(android.R.string.ok, dialog.setPositiveButton(android.R.string.ok,
new DialogInterface.OnClickListener() { new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface di, int id) { public void onClick(DialogInterface di, int id) {
di.dismiss(); di.dismiss();
try { try {
@ -229,7 +228,6 @@ public class SectionView extends LinearLayout implements OnClickListener, Editor
dialog.setCancelable(true); dialog.setCancelable(true);
dialog.setNegativeButton(android.R.string.cancel, dialog.setNegativeButton(android.R.string.cancel,
new DialogInterface.OnClickListener() { new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface di, int id) { public void onClick(DialogInterface di, int id) {
di.dismiss(); di.dismiss();
} }

View File

@ -154,7 +154,6 @@ public class UserIdEditor extends LinearLayout implements Editor, OnClickListene
return userId; return userId;
} }
@Override
public void onClick(View v) { public void onClick(View v) {
final ViewGroup parent = (ViewGroup)getParent(); final ViewGroup parent = (ViewGroup)getParent();
if (v == mDeleteButton) { if (v == mDeleteButton) {
@ -187,7 +186,6 @@ public class UserIdEditor extends LinearLayout implements Editor, OnClickListene
return mIsMainUserId.isChecked(); return mIsMainUserId.isChecked();
} }
@Override
public void setEditorListener(EditorListener listener) { public void setEditorListener(EditorListener listener) {
mEditorListener = listener; mEditorListener = listener;
} }

View File

@ -38,7 +38,8 @@ public class Choice {
return mName; return mName;
} }
public String toString() { @Override
public String toString() {
return mName; return mName;
} }
} }