aboutsummaryrefslogtreecommitdiffstats
path: root/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui
diff options
context:
space:
mode:
Diffstat (limited to 'OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui')
-rw-r--r--OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/EditKeyActivity.java8
-rw-r--r--OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/dialog/DeleteKeyDialogFragment.java3
-rw-r--r--OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/KeyEditor.java19
-rw-r--r--OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/SectionView.java55
-rw-r--r--OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/UserIdEditor.java12
5 files changed, 47 insertions, 50 deletions
diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/EditKeyActivity.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/EditKeyActivity.java
index a8b3e29ed..d0a0d20ad 100644
--- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/EditKeyActivity.java
+++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/EditKeyActivity.java
@@ -391,8 +391,9 @@ public class EditKeyActivity extends ActionBarActivity implements EditorListener
if (!isSet) {
isSet = true;
String[] parts = PgpKeyHelper.splitUserId(userId);
- if (parts[0] != null)
+ if (parts[0] != null) {
setTitle(parts[0]);
+ }
}
mUserIds.add(userId);
}
@@ -547,10 +548,11 @@ public class EditKeyActivity extends ActionBarActivity implements EditorListener
}
String passphrase;
- if (mIsPassPhraseSet)
+ if (mIsPassPhraseSet) {
passphrase = PassphraseCacheService.getCachedPassphrase(this, masterKeyId);
- else
+ } else {
passphrase = "";
+ }
if (passphrase == null) {
showPassphraseDialog(masterKeyId);
} else {
diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/dialog/DeleteKeyDialogFragment.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/dialog/DeleteKeyDialogFragment.java
index a467c779c..4de332d3c 100644
--- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/dialog/DeleteKeyDialogFragment.java
+++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/dialog/DeleteKeyDialogFragment.java
@@ -148,8 +148,9 @@ public class DeleteKeyDialogFragment extends DialogFragment {
String selectionIDs = "";
for (int i = 0; i < keyRingRowIds.length; i++) {
selectionIDs += "'" + String.valueOf(keyRingRowIds[i]) + "'";
- if (i + 1 < keyRingRowIds.length)
+ if (i + 1 < keyRingRowIds.length) {
selectionIDs += ",";
+ }
}
selection += selectionIDs + ")";
diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/KeyEditor.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/KeyEditor.java
index de26e20a3..5fd06f4fc 100644
--- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/KeyEditor.java
+++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/KeyEditor.java
@@ -255,8 +255,9 @@ public class KeyEditor extends LinearLayout implements Editor, OnClickListener {
} else {
mUsage = PgpKeyHelper.getKeyUsage(key);
mOriginalUsage = mUsage;
- if (key.isMasterKey())
+ if (key.isMasterKey()) {
mChkCertify.setChecked(PgpKeyHelper.isCertificationKey(key));
+ }
mChkSign.setChecked(PgpKeyHelper.isSigningKey(key));
mChkEncrypt.setChecked(PgpKeyHelper.isEncryptionKey(key));
mChkAuthenticate.setChecked(PgpKeyHelper.isAuthenticationKey(key));
@@ -332,10 +333,10 @@ public class KeyEditor extends LinearLayout implements Editor, OnClickListener {
return mUsage;
}
- public boolean needsSaving()
- {
- if (mIsNewKey)
+ public boolean needsSaving() {
+ if (mIsNewKey) {
return true;
+ }
boolean retval = (getUsage() != mOriginalUsage);
@@ -345,21 +346,21 @@ public class KeyEditor extends LinearLayout implements Editor, OnClickListener {
if (mOEDNull != mEDNull) {
dateChanged = true;
} else {
- if(mOEDNull) //both null, no change
+ if (mOEDNull) {
+ //both null, no change
dateChanged = false;
- else
+ } else {
dateChanged = ((mExpiryDate.compareTo(mOriginalExpiryDate)) != 0);
+ }
}
retval |= dateChanged;
return retval;
}
- public boolean getIsNewKey()
- {
+ public boolean getIsNewKey() {
return mIsNewKey;
}
-
}
class ExpiryDatePickerDialog extends DatePickerDialog {
diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/SectionView.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/SectionView.java
index 150f6e221..1f388e865 100644
--- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/SectionView.java
+++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/SectionView.java
@@ -164,34 +164,34 @@ public class SectionView extends LinearLayout implements OnClickListener, Editor
mEditors.setVisibility(hasChildren ? View.VISIBLE : View.GONE);
}
- public boolean needsSaving()
- {
+ public boolean needsSaving() {
//check each view for needs saving, take account of deleted items
boolean ret = mOldItemDeleted;
for (int i = 0; i < mEditors.getChildCount(); ++i) {
Editor editor = (Editor) mEditors.getChildAt(i);
ret |= editor.needsSaving();
- if (mType == Id.type.user_id)
- ret |= ((UserIdEditor)editor).primarySwapped();
+ if (mType == Id.type.user_id) {
+ ret |= ((UserIdEditor) editor).primarySwapped();
+ }
}
return ret;
}
- public boolean primaryChanged()
- {
+ public boolean primaryChanged() {
boolean ret = false;
for (int i = 0; i < mEditors.getChildCount(); ++i) {
Editor editor = (Editor) mEditors.getChildAt(i);
- if (mType == Id.type.user_id)
- ret |= ((UserIdEditor)editor).primarySwapped();
+ if (mType == Id.type.user_id) {
+ ret |= ((UserIdEditor) editor).primarySwapped();
+ }
}
return ret;
}
- public String getOriginalPrimaryID()
- { //NB: this will have to change when we change how Primary IDs are chosen, and so we need to be
- // careful about where Master key capabilities are stored... multiple primaries and
- // revoked ones make this harder than the simple case we are continuing to assume here
+ public String getOriginalPrimaryID() {
+ //NB: this will have to change when we change how Primary IDs are chosen, and so we need to be
+ // careful about where Master key capabilities are stored... multiple primaries and
+ // 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) {
@@ -203,16 +203,16 @@ public class SectionView extends LinearLayout implements OnClickListener, Editor
return null;
}
- public ArrayList<String> getOriginalIDs()
- {
+ public ArrayList<String> getOriginalIDs() {
ArrayList<String> orig = new ArrayList<String>();
if (mType == Id.type.user_id) {
for (int i = 0; i < mEditors.getChildCount(); ++i) {
UserIdEditor editor = (UserIdEditor) mEditors.getChildAt(i);
- if (editor.isMainUserId())
+ if (editor.isMainUserId()) {
orig.add(0, editor.getOriginalID());
- else
+ } else {
orig.add(editor.getOriginalID());
+ }
}
return orig;
} else {
@@ -220,18 +220,15 @@ public class SectionView extends LinearLayout implements OnClickListener, Editor
}
}
- public ArrayList<String> getDeletedIDs()
- {
+ public ArrayList<String> getDeletedIDs() {
return mDeletedIDs;
}
- public ArrayList<PGPSecretKey> getDeletedKeys()
- {
+ public ArrayList<PGPSecretKey> getDeletedKeys() {
return mDeletedKeys;
}
- public List<Boolean> getNeedsSavingArray()
- {
+ public List<Boolean> getNeedsSavingArray() {
ArrayList<Boolean> mList = new ArrayList<Boolean>();
for (int i = 0; i < mEditors.getChildCount(); ++i) {
Editor editor = (Editor) mEditors.getChildAt(i);
@@ -240,21 +237,20 @@ public class SectionView extends LinearLayout implements OnClickListener, Editor
return mList;
}
- public List<Boolean> getNewIDFlags()
- {
+ public List<Boolean> getNewIDFlags() {
ArrayList<Boolean> mList = new ArrayList<Boolean>();
for (int i = 0; i < mEditors.getChildCount(); ++i) {
UserIdEditor editor = (UserIdEditor) mEditors.getChildAt(i);
- if (editor.isMainUserId())
+ if (editor.isMainUserId()) {
mList.add(0, editor.getIsNewID());
- else
+ } else {
mList.add(editor.getIsNewID());
+ }
}
return mList;
}
- public List<Boolean> getNewKeysArray()
- {
+ public List<Boolean> getNewKeysArray() {
ArrayList<Boolean> mList = new ArrayList<Boolean>();
if (mType == Id.type.key) {
for (int i = 0; i < mEditors.getChildCount(); ++i) {
@@ -420,8 +416,9 @@ public class SectionView extends LinearLayout implements OnClickListener, Editor
mEditors, false);
view.setEditorListener(SectionView.this);
int usage = 0;
- if (mEditors.getChildCount() == 0)
+ if (mEditors.getChildCount() == 0) {
usage = PGPKeyFlags.CAN_CERTIFY;
+ }
view.setValue(newKey, newKey.isMasterKey(), usage, true);
mEditors.addView(view);
SectionView.this.updateEditorsVisible();
diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/UserIdEditor.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/UserIdEditor.java
index 71f5f0d86..b21b99254 100644
--- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/UserIdEditor.java
+++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/UserIdEditor.java
@@ -84,8 +84,7 @@ public class UserIdEditor extends LinearLayout implements Editor, OnClickListene
}
@Override
- public void afterTextChanged(Editable s)
- {
+ public void afterTextChanged(Editable s) {
if (mEditorListener != null) {
mEditorListener.onEdited();
}
@@ -246,18 +245,15 @@ public class UserIdEditor extends LinearLayout implements Editor, OnClickListene
return retval;
}
- public boolean getIsOriginallyMainUserID()
- {
+ public boolean getIsOriginallyMainUserID() {
return mOriginallyMainUserID;
}
- public boolean primarySwapped()
- {
+ public boolean primarySwapped() {
return (mOriginallyMainUserID != isMainUserId());
}
- public String getOriginalID()
- {
+ public String getOriginalID() {
return mOriginalID;
}