From 27bf2a57710edc559afe653ea6e04339aad1fb7b Mon Sep 17 00:00:00 2001 From: bcbarnes-gmx Date: Mon, 22 Jul 2013 09:59:14 -0500 Subject: [PATCH] Issues #41 and #43 --- OpenPGP-Keychain/res/layout/create_key.xml | 2 +- OpenPGP-Keychain/res/values/strings.xml | 3 ++- .../keychain/ui/widget/KeyEditor.java | 14 +++++++++++--- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/OpenPGP-Keychain/res/layout/create_key.xml b/OpenPGP-Keychain/res/layout/create_key.xml index d5bf6cf9f..8858e8d80 100644 --- a/OpenPGP-Keychain/res/layout/create_key.xml +++ b/OpenPGP-Keychain/res/layout/create_key.xml @@ -65,7 +65,7 @@ android:gravity="right" android:numeric="integer" android:padding="4dp" - android:text="1024" /> + android:text="@string/default_key_bit_size" /> diff --git a/OpenPGP-Keychain/res/values/strings.xml b/OpenPGP-Keychain/res/values/strings.xml index 5e3807a3a..d02cceff8 100644 --- a/OpenPGP-Keychain/res/values/strings.xml +++ b/OpenPGP-Keychain/res/values/strings.xml @@ -328,7 +328,8 @@ fast slow very slow - + 2048 + diff --git a/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/ui/widget/KeyEditor.java b/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/ui/widget/KeyEditor.java index e9a5674cd..45c106eb9 100644 --- a/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/ui/widget/KeyEditor.java +++ b/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/ui/widget/KeyEditor.java @@ -59,10 +59,14 @@ public class KeyEditor extends LinearLayout implements Editor, OnClickListener { Button mExpiryDateButton; GregorianCalendar mExpiryDate; + private int mDatePickerResultCount = 0; private DatePickerDialog.OnDateSetListener mExpiryDateSetListener = new DatePickerDialog.OnDateSetListener() { public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) { - GregorianCalendar date = new GregorianCalendar(year, monthOfYear, dayOfMonth); - setExpiryDate(date); + if(mDatePickerResultCount++ == 0) // Note: Ignore results after the first one - android sends multiples. + { + GregorianCalendar date = new GregorianCalendar(year, monthOfYear, dayOfMonth); + setExpiryDate(date); + } } }; @@ -111,11 +115,15 @@ public class KeyEditor extends LinearLayout implements Editor, OnClickListener { DatePickerDialog dialog = new DatePickerDialog(getContext(), mExpiryDateSetListener, date.get(Calendar.YEAR), date.get(Calendar.MONTH), date.get(Calendar.DAY_OF_MONTH)); + mDatePickerResultCount = 0; dialog.setCancelable(true); dialog.setButton(Dialog.BUTTON_NEGATIVE, getContext() .getString(R.string.btn_noDate), new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { - setExpiryDate(null); + if(mDatePickerResultCount++ == 0) // Note: Ignore results after the first one - android sends multiples. + { + setExpiryDate(null); + } } }); dialog.show();