replace spinner with non-functioning checkboxes

This commit is contained in:
Ashley Hughes 2014-02-02 22:14:07 +00:00
parent ba08970850
commit 212ee222c3
3 changed files with 77 additions and 30 deletions

View File

@ -89,18 +89,18 @@ public class KeyEditor extends LinearLayout implements Editor, OnClickListener {
mKeyId = (TextView) findViewById(R.id.keyId); mKeyId = (TextView) findViewById(R.id.keyId);
mCreationDate = (TextView) findViewById(R.id.creation); mCreationDate = (TextView) findViewById(R.id.creation);
mExpiryDateButton = (BootstrapButton) findViewById(R.id.expiry); mExpiryDateButton = (BootstrapButton) findViewById(R.id.expiry);
mUsage = (Spinner) findViewById(R.id.usage); //mUsage = (Spinner) findViewById(R.id.usage);
Choice choices[] = { //Choice choices[] = {
new Choice(Id.choice.usage.sign_only, getResources().getString( // new Choice(Id.choice.usage.sign_only, getResources().getString(
R.string.choice_sign_only)), // R.string.choice_sign_only)),
new Choice(Id.choice.usage.encrypt_only, getResources().getString( // new Choice(Id.choice.usage.encrypt_only, getResources().getString(
R.string.choice_encrypt_only)), // R.string.choice_encrypt_only)),
new Choice(Id.choice.usage.sign_and_encrypt, getResources().getString( // new Choice(Id.choice.usage.sign_and_encrypt, getResources().getString(
R.string.choice_sign_and_encrypt)), }; // R.string.choice_sign_and_encrypt)), };
ArrayAdapter<Choice> adapter = new ArrayAdapter<Choice>(getContext(), //ArrayAdapter<Choice> adapter = new ArrayAdapter<Choice>(getContext(),
android.R.layout.simple_spinner_item, choices); // android.R.layout.simple_spinner_item, choices);
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); //adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
mUsage.setAdapter(adapter); //mUsage.setAdapter(adapter);
mDeleteButton = (BootstrapButton) findViewById(R.id.delete); mDeleteButton = (BootstrapButton) findViewById(R.id.delete);
mDeleteButton.setOnClickListener(this); mDeleteButton.setOnClickListener(this);
@ -139,7 +139,7 @@ public class KeyEditor extends LinearLayout implements Editor, OnClickListener {
public void setCanEdit(boolean bCanEdit) { public void setCanEdit(boolean bCanEdit) {
if (!bCanEdit) { if (!bCanEdit) {
mDeleteButton.setVisibility(View.INVISIBLE); mDeleteButton.setVisibility(View.INVISIBLE);
mUsage.setEnabled(false); //mUsage.setEnabled(false);
mExpiryDateButton.setEnabled(false); mExpiryDateButton.setEnabled(false);
} }
} }
@ -161,22 +161,22 @@ public class KeyEditor extends LinearLayout implements Editor, OnClickListener {
boolean isElGamalKey = (key.getPublicKey().getAlgorithm() == PGPPublicKey.ELGAMAL_ENCRYPT); boolean isElGamalKey = (key.getPublicKey().getAlgorithm() == PGPPublicKey.ELGAMAL_ENCRYPT);
boolean isDSAKey = (key.getPublicKey().getAlgorithm() == PGPPublicKey.DSA); boolean isDSAKey = (key.getPublicKey().getAlgorithm() == PGPPublicKey.DSA);
if (!isElGamalKey) { if (!isElGamalKey) {
choices.add(new Choice(Id.choice.usage.sign_only, getResources().getString( //choices.add(new Choice(Id.choice.usage.sign_only, getResources().getString(
R.string.choice_sign_only))); // R.string.choice_sign_only)));
} }
if (!mIsMasterKey && !isDSAKey) { if (!mIsMasterKey && !isDSAKey) {
choices.add(new Choice(Id.choice.usage.encrypt_only, getResources().getString( //choices.add(new Choice(Id.choice.usage.encrypt_only, getResources().getString(
R.string.choice_encrypt_only))); // R.string.choice_encrypt_only)));
} }
if (!isElGamalKey && !isDSAKey) { if (!isElGamalKey && !isDSAKey) {
choices.add(new Choice(Id.choice.usage.sign_and_encrypt, getResources().getString( //choices.add(new Choice(Id.choice.usage.sign_and_encrypt, getResources().getString(
R.string.choice_sign_and_encrypt))); // R.string.choice_sign_and_encrypt)));
} }
ArrayAdapter<Choice> adapter = new ArrayAdapter<Choice>(getContext(), ArrayAdapter<Choice> adapter = new ArrayAdapter<Choice>(getContext(),
android.R.layout.simple_spinner_item, choices); android.R.layout.simple_spinner_item, choices);
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
mUsage.setAdapter(adapter); //mUsage.setAdapter(adapter);
// Set value in choice dropdown to key // Set value in choice dropdown to key
int selectId = 0; int selectId = 0;
@ -198,7 +198,7 @@ public class KeyEditor extends LinearLayout implements Editor, OnClickListener {
for (int i = 0; i < choices.size(); ++i) { for (int i = 0; i < choices.size(); ++i) {
if (choices.get(i).getId() == selectId) { if (choices.get(i).getId() == selectId) {
mUsage.setSelection(i); //mUsage.setSelection(i);
break; break;
} }
} }
@ -249,7 +249,7 @@ public class KeyEditor extends LinearLayout implements Editor, OnClickListener {
} }
public int getUsage() { public int getUsage() {
return ((Choice) mUsage.getSelectedItem()).getId(); return 1; //((Choice) mUsage.getSelectedItem()).getId();
} }
} }

View File

@ -97,11 +97,54 @@
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical"
android:paddingRight="10dip" android:paddingRight="10dip"
android:text="@string/label_usage" /> android:text="@string/label_usage" />
<CheckBox
android:id="@+id/chkCertify"
android:enabled = "false"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/flag_certify" />
</TableRow>
<Spinner <TableRow>
android:id="@+id/usage"
android:layout_width="match_parent" <TextView
android:layout_height="wrap_content" /> android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:paddingRight="10dip" />
<CheckBox
android:id="@+id/chkSign"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/flag_sign" />
</TableRow>
<TableRow>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:paddingRight="10dip" />
<CheckBox
android:id="@+id/chkEncrypt"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/flag_encrypt" />
</TableRow>
<TableRow>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:paddingRight="10dip" />
<CheckBox
android:id="@+id/chkAuthenticate"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/flag_authenticate" />
</TableRow> </TableRow>
</TableLayout> </TableLayout>
@ -122,4 +165,5 @@
android:layout_height="1dip" android:layout_height="1dip"
android:background="?android:attr/listDivider" /> android:background="?android:attr/listDivider" />
</org.sufficientlysecure.keychain.ui.widget.KeyEditor> </org.sufficientlysecure.keychain.ui.widget.KeyEditor>

View File

@ -153,9 +153,6 @@
<!-- choice --> <!-- choice -->
<string name="choice_none">None</string> <string name="choice_none">None</string>
<string name="choice_sign_only">Sign only</string>
<string name="choice_encrypt_only">Encrypt only</string>
<string name="choice_sign_and_encrypt">Sign and Encrypt</string>
<string name="choice_15secs">15 secs</string> <string name="choice_15secs">15 secs</string>
<string name="choice_1min">1 min</string> <string name="choice_1min">1 min</string>
<string name="choice_3mins">3 mins</string> <string name="choice_3mins">3 mins</string>
@ -176,6 +173,12 @@
<string name="error">Error</string> <string name="error">Error</string>
<string name="error_message">Error: %s</string> <string name="error_message">Error: %s</string>
<!-- key flags -->
<string name="flag_certify">Certify</string>
<string name="flag_sign">Sign</string>
<string name="flag_encrypt">Encrypt</string>
<string name="flag_authenticate">Authenticate</string>
<!-- sentences --> <!-- sentences -->
<string name="wrong_passphrase">Wrong passphrase.</string> <string name="wrong_passphrase">Wrong passphrase.</string>
<string name="using_clipboard_content">Using clipboard content.</string> <string name="using_clipboard_content">Using clipboard content.</string>