From 523180020caee56525c1c0e16c92fbcd8750e9c9 Mon Sep 17 00:00:00 2001 From: Joe Steele Date: Sat, 3 May 2014 10:58:44 -0400 Subject: [PATCH] Don't use enum ordinal as array index, v. 2 This revises commit 51aa34d per the GitHub comments therewith. --- .../k9/activity/setup/AccountSetupIncoming.java | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/src/com/fsck/k9/activity/setup/AccountSetupIncoming.java b/src/com/fsck/k9/activity/setup/AccountSetupIncoming.java index 808a046cc..408852094 100644 --- a/src/com/fsck/k9/activity/setup/AccountSetupIncoming.java +++ b/src/com/fsck/k9/activity/setup/AccountSetupIncoming.java @@ -261,10 +261,8 @@ public class AccountSetupIncoming extends K9Activity implements OnClickListener securityTypesAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); mSecurityTypeView.setAdapter(securityTypesAdapter); - int index = getSecurityTypePosition(mConnectionSecurityChoices, - settings.connectionSecurity); - // Select currently configured security type + int index = securityTypesAdapter.getPosition(settings.connectionSecurity); mSecurityTypeView.setSelection(index, false); /* @@ -472,13 +470,4 @@ public class AccountSetupIncoming extends K9Activity implements OnClickListener Toast toast = Toast.makeText(getApplication(), toastText, Toast.LENGTH_LONG); toast.show(); } - - private int getSecurityTypePosition(ConnectionSecurity[] haystack, ConnectionSecurity needle) { - for (int i = 0; i < haystack.length; i++) { - if (haystack[i] == needle) { - return i; - } - } - return 0; - } }