1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-11-27 11:42:16 -05:00

Don't use enum ordinal as array index, v. 2

This revises commit 51aa34d per the GitHub comments therewith.
This commit is contained in:
Joe Steele 2014-05-03 10:58:44 -04:00
parent 58efee8be2
commit 523180020c

View File

@ -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;
}
}