use usage argument if needed

This commit is contained in:
Ashley Hughes 2014-02-04 22:02:53 +00:00
parent fe3db8f0e6
commit 6d40bc3c0c
2 changed files with 7 additions and 5 deletions

View File

@ -146,7 +146,7 @@ public class KeyEditor extends LinearLayout implements Editor, OnClickListener {
}
}
public void setValue(PGPSecretKey key, boolean isMasterKey, int usage) {
public void setValue(PGPSecretKey key, boolean isMasterKey, int usage, boolean isNewKey) {
mKey = key;
mIsMasterKey = isMasterKey;
@ -190,8 +190,10 @@ public class KeyEditor extends LinearLayout implements Editor, OnClickListener {
mChkSign.setChecked(PgpKeyHelper.isSigningKey(key));
mChkEncrypt.setChecked(PgpKeyHelper.isEncryptionKey(key));
mChkAuthenticate.setChecked(PgpKeyHelper.isAuthenticationKey(key));
mUsage = PgpKeyHelper.getKeyUsage(key);
// TODO: use usage argument?
if (isNewKey)
mUsage = usage;
else
mUsage = PgpKeyHelper.getKeyUsage(key);
GregorianCalendar cal = new GregorianCalendar(TimeZone.getTimeZone("UTC"));
cal.setTime(PgpKeyHelper.getCreationDate(key));

View File

@ -272,7 +272,7 @@ public class SectionView extends LinearLayout implements OnClickListener, Editor
false);
view.setEditorListener(this);
boolean isMasterKey = (mEditors.getChildCount() == 0);
view.setValue(list.get(i), isMasterKey, usages.get(i));
view.setValue(list.get(i), isMasterKey, usages.get(i), false);
view.setCanEdit(canEdit);
mEditors.addView(view);
}
@ -344,7 +344,7 @@ public class SectionView extends LinearLayout implements OnClickListener, Editor
KeyEditor view = (KeyEditor) mInflater.inflate(R.layout.edit_key_key_item,
mEditors, false);
view.setEditorListener(SectionView.this);
view.setValue(newKey, newKey.isMasterKey(), -1);
view.setValue(newKey, newKey.isMasterKey(), -1, true);
mEditors.addView(view);
SectionView.this.updateEditorsVisible();
}