Trivial spacing changes to conform to style guide

This commit is contained in:
Thialfihar 2014-04-02 01:43:40 +02:00
parent 8e503bd263
commit dd4a1e3f52
29 changed files with 87 additions and 85 deletions

View File

@ -66,13 +66,15 @@ public class PgpConversionHelper {
while ((obj = factory.nextObject()) != null) {
PGPSecretKey secKey = null;
if (obj instanceof PGPSecretKey) {
if ((secKey = (PGPSecretKey)obj ) == null) {
secKey = (PGPSecretKey) obj;
if (secKey == null) {
Log.e(Constants.TAG, "No keys given!");
}
keys.add(secKey);
} else if (obj instanceof PGPSecretKeyRing) { //master keys are sent as keyrings
PGPSecretKeyRing keyRing = null;
if ((keyRing = (PGPSecretKeyRing)obj) == null) {
keyRing = (PGPSecretKeyRing) obj;
if (keyRing == null) {
Log.e(Constants.TAG, "No keys given!");
}
@SuppressWarnings("unchecked")

View File

@ -514,7 +514,8 @@ public class ProviderHelper {
+ " AS sign_keys WHERE sign_keys." + Keys.KEY_RING_ROW_ID + " = "
+ KeychainDatabase.Tables.KEY_RINGS + "." + KeyRings._ID
+ " AND sign_keys." + Keys.CAN_CERTIFY + " = '1' AND " + Keys.IS_MASTER_KEY
+ " = 1) AS sign",};
+ " = 1) AS sign",
};
ContentResolver cr = context.getContentResolver();
Cursor cursor = cr.query(queryUri, projection, null, null, null);

View File

@ -46,8 +46,7 @@ public class SaveKeyringParcel implements Parcelable {
public SaveKeyringParcel() {}
private SaveKeyringParcel(Parcel source)
{
private SaveKeyringParcel(Parcel source) {
userIDs = (ArrayList<String>) source.readSerializable();
originalIDs = (ArrayList<String>) source.readSerializable();
deletedIDs = (ArrayList<String>) source.readSerializable();
@ -55,10 +54,11 @@ public class SaveKeyringParcel implements Parcelable {
primaryIDChanged = source.readByte() != 0;
moddedKeys = source.createBooleanArray();
byte[] tmp = source.createByteArray();
if (tmp == null)
if (tmp == null) {
deletedKeys = null;
else
} else {
deletedKeys = PgpConversionHelper.BytesToPGPSecretKeyList(tmp);
}
keysExpiryDates = (ArrayList<GregorianCalendar>) source.readSerializable();
keysUsages = source.readArrayList(Integer.class.getClassLoader());
newPassPhrase = source.readString();

View File

@ -120,7 +120,8 @@ public class EncryptFileFragment extends Fragment {
new Choice(Id.choice.compression.zlib, "ZLIB ("
+ getString(R.string.compression_fast) + ")"),
new Choice(Id.choice.compression.bzip2, "BZIP2 ("
+ getString(R.string.compression_very_slow) + ")"),};
+ getString(R.string.compression_very_slow) + ")"),
};
ArrayAdapter<Choice> adapter = new ArrayAdapter<Choice>(getActivity(),
android.R.layout.simple_spinner_item, choices);
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);

View File

@ -141,7 +141,8 @@ public class SelectSecretKeyFragment extends ListFragment implements
+ Keys.IS_REVOKED + " = '0' AND valid_keys." + Keys.CAN_SIGN
+ " = '1' AND valid_keys." + Keys.CREATION + " <= '" + now + "' AND "
+ "(valid_keys." + Keys.EXPIRY + " IS NULL OR valid_keys." + Keys.EXPIRY
+ " >= '" + now + "')) AS " + SelectKeyCursorAdapter.PROJECTION_ROW_VALID,};
+ " >= '" + now + "')) AS " + SelectKeyCursorAdapter.PROJECTION_ROW_VALID,
};
String orderBy = UserIds.USER_ID + " ASC";

View File

@ -53,12 +53,12 @@ public class SelectSecretKeyLayoutFragment extends Fragment implements LoaderMan
private SelectSecretKeyCallback mCallback;
final String[] PROJECTION = new String[]{
private static final String[] PROJECTION = new String[] {
KeychainContract.UserIds.USER_ID,
KeychainContract.KeyRings.MASTER_KEY_ID
KeychainContract.KeyRings.MASTER_KEY_ID,
};
final int INDEX_USER_ID = 0;
final int INDEX_MASTER_KEY_ID = 1;
private static final int INDEX_USER_ID = 0;
private static final int INDEX_MASTER_KEY_ID = 1;
public interface SelectSecretKeyCallback {
void onKeySelected(long secretKeyId);

View File

@ -148,8 +148,7 @@ public class ViewKeyKeysAdapter extends CursorAdapter {
DateFormat.getDateFormat(context).format(expiryDate) + ")");
keyExpiry.setVisibility(View.VISIBLE);
}
else {
} else {
keyExpiry.setVisibility(View.GONE);
}
// if key is expired or revoked, strike through text

View File

@ -61,10 +61,11 @@ public class ViewKeyUserIdsAdapter extends CursorAdapter {
int count = newCursor.getCount();
mCheckStates.ensureCapacity(count);
// initialize to true (use case knowledge: we usually want to sign all uids)
for(int i = 0; i < count; i++)
for (int i = 0; i < count; i++) {
mCheckStates.add(true);
}
}
}
return super.swapCursor(newCursor);
}
@ -100,8 +101,9 @@ public class ViewKeyUserIdsAdapter extends CursorAdapter {
vAddress.setText(userId[1]);
// don't care further if checkboxes aren't shown
if(mCheckStates == null)
if (mCheckStates == null) {
return;
}
final CheckBox vCheckBox = (CheckBox) view.findViewById(R.id.checkBox);
final int position = cursor.getPosition();

View File

@ -140,7 +140,8 @@ public class CreateKeyDialogFragment extends DialogFragment {
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
final Choice selectedAlgorithm = (Choice) algorithm.getSelectedItem();
final int selectedKeySize = Integer.parseInt((String) keySize.getSelectedItem());
final boolean isWeakRsa = (selectedAlgorithm.getId() == Id.choice.algorithm.rsa && selectedKeySize <= 1024);
final boolean isWeakRsa = (selectedAlgorithm.getId() == Id.choice.algorithm.rsa &&
selectedKeySize <= 1024);
alertDialog.getButton(AlertDialog.BUTTON_POSITIVE).setEnabled(!isWeakRsa);
}

View File

@ -184,12 +184,10 @@ public class DeleteKeyDialogFragment extends DialogFragment {
if (cursor == null || cursor.getCount() == 0 || !checkDeleteSecret.isChecked()) {
isSuccessfullyDeleted = true;
}
} finally {
if (cursor != null) {
cursor.close();
}
}
dismiss();
@ -200,9 +198,7 @@ public class DeleteKeyDialogFragment extends DialogFragment {
sendMessageToHandler(MESSAGE_ERROR, null);
}
}
}
);
});
builder.setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() {
@Override
@ -232,5 +228,4 @@ public class DeleteKeyDialogFragment extends DialogFragment {
Log.w(Constants.TAG, "Messenger is null!", e);
}
}
}