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);
mCreationDate = (TextView) findViewById(R.id.creation);
mExpiryDateButton = (BootstrapButton) findViewById(R.id.expiry);
mUsage = (Spinner) findViewById(R.id.usage);
Choice choices[] = {
new Choice(Id.choice.usage.sign_only, getResources().getString(
R.string.choice_sign_only)),
new Choice(Id.choice.usage.encrypt_only, getResources().getString(
R.string.choice_encrypt_only)),
new Choice(Id.choice.usage.sign_and_encrypt, getResources().getString(
R.string.choice_sign_and_encrypt)), };
ArrayAdapter<Choice> adapter = new ArrayAdapter<Choice>(getContext(),
android.R.layout.simple_spinner_item, choices);
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
mUsage.setAdapter(adapter);
//mUsage = (Spinner) findViewById(R.id.usage);
//Choice choices[] = {
// new Choice(Id.choice.usage.sign_only, getResources().getString(
// R.string.choice_sign_only)),
// new Choice(Id.choice.usage.encrypt_only, getResources().getString(
// R.string.choice_encrypt_only)),
// new Choice(Id.choice.usage.sign_and_encrypt, getResources().getString(
// R.string.choice_sign_and_encrypt)), };
//ArrayAdapter<Choice> adapter = new ArrayAdapter<Choice>(getContext(),
// android.R.layout.simple_spinner_item, choices);
//adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
//mUsage.setAdapter(adapter);
mDeleteButton = (BootstrapButton) findViewById(R.id.delete);
mDeleteButton.setOnClickListener(this);
@ -139,7 +139,7 @@ public class KeyEditor extends LinearLayout implements Editor, OnClickListener {
public void setCanEdit(boolean bCanEdit) {
if (!bCanEdit) {
mDeleteButton.setVisibility(View.INVISIBLE);
mUsage.setEnabled(false);
//mUsage.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 isDSAKey = (key.getPublicKey().getAlgorithm() == PGPPublicKey.DSA);
if (!isElGamalKey) {
choices.add(new Choice(Id.choice.usage.sign_only, getResources().getString(
R.string.choice_sign_only)));
//choices.add(new Choice(Id.choice.usage.sign_only, getResources().getString(
// R.string.choice_sign_only)));
}
if (!mIsMasterKey && !isDSAKey) {
choices.add(new Choice(Id.choice.usage.encrypt_only, getResources().getString(
R.string.choice_encrypt_only)));
//choices.add(new Choice(Id.choice.usage.encrypt_only, getResources().getString(
// R.string.choice_encrypt_only)));
}
if (!isElGamalKey && !isDSAKey) {
choices.add(new Choice(Id.choice.usage.sign_and_encrypt, getResources().getString(
R.string.choice_sign_and_encrypt)));
//choices.add(new Choice(Id.choice.usage.sign_and_encrypt, getResources().getString(
// R.string.choice_sign_and_encrypt)));
}
ArrayAdapter<Choice> adapter = new ArrayAdapter<Choice>(getContext(),
android.R.layout.simple_spinner_item, choices);
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
mUsage.setAdapter(adapter);
//mUsage.setAdapter(adapter);
// Set value in choice dropdown to key
int selectId = 0;
@ -198,7 +198,7 @@ public class KeyEditor extends LinearLayout implements Editor, OnClickListener {
for (int i = 0; i < choices.size(); ++i) {
if (choices.get(i).getId() == selectId) {
mUsage.setSelection(i);
//mUsage.setSelection(i);
break;
}
}
@ -249,7 +249,7 @@ public class KeyEditor extends LinearLayout implements Editor, OnClickListener {
}
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:paddingRight="10dip"
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
android:id="@+id/usage"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<TableRow>
<TextView
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>
</TableLayout>
@ -122,4 +165,5 @@
android:layout_height="1dip"
android:background="?android:attr/listDivider" />
</org.sufficientlysecure.keychain.ui.widget.KeyEditor>
</org.sufficientlysecure.keychain.ui.widget.KeyEditor>

View File

@ -153,9 +153,6 @@
<!-- choice -->
<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_1min">1 min</string>
<string name="choice_3mins">3 mins</string>
@ -176,6 +173,12 @@
<string name="error">Error</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 -->
<string name="wrong_passphrase">Wrong passphrase.</string>
<string name="using_clipboard_content">Using clipboard content.</string>