From 9c0ec1f4965bd34a05a7a417df51ca470f5f1fae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Sch=C3=BCrmann?= Date: Mon, 6 Jul 2015 13:36:28 +0200 Subject: Fix account key selection for API --- .../java/org/sufficientlysecure/keychain/ui/widget/KeySpinner.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/KeySpinner.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/KeySpinner.java index 5050c01af..c2414e86d 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/KeySpinner.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/KeySpinner.java @@ -84,7 +84,8 @@ public abstract class KeySpinner extends AppCompatSpinner implements @Override public void onItemSelected(AdapterView parent, View view, int position, long id) { if (mListener != null) { - mListener.onKeyChanged(id); + long keyId = getSelectedKeyId(getItemAtPosition(position)); + mListener.onKeyChanged(keyId); } } @@ -137,6 +138,10 @@ public abstract class KeySpinner extends AppCompatSpinner implements public long getSelectedKeyId() { Object item = getSelectedItem(); + return getSelectedKeyId(item); + } + + public long getSelectedKeyId(Object item) { if (item instanceof KeyItem) { return ((KeyItem) item).mKeyId; } -- cgit v1.2.3