mirror of
https://github.com/moparisthebest/k-9
synced 2025-02-17 07:30:16 -05:00
Don't use enum ordinal as array index
This fixes a crash when setting up WebDAV accounts.
This commit is contained in:
parent
da74253f7b
commit
51aa34d52b
@ -261,8 +261,11 @@ public class AccountSetupIncoming extends K9Activity implements OnClickListener
|
|||||||
securityTypesAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
securityTypesAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
||||||
mSecurityTypeView.setAdapter(securityTypesAdapter);
|
mSecurityTypeView.setAdapter(securityTypesAdapter);
|
||||||
|
|
||||||
|
int index = getSecurityTypePosition(mConnectionSecurityChoices,
|
||||||
|
settings.connectionSecurity);
|
||||||
|
|
||||||
// Select currently configured security type
|
// Select currently configured security type
|
||||||
mSecurityTypeView.setSelection(settings.connectionSecurity.ordinal(), false);
|
mSecurityTypeView.setSelection(index, false);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Updates the port when the user changes the security type. This allows
|
* Updates the port when the user changes the security type. This allows
|
||||||
@ -469,4 +472,13 @@ public class AccountSetupIncoming extends K9Activity implements OnClickListener
|
|||||||
Toast toast = Toast.makeText(getApplication(), toastText, Toast.LENGTH_LONG);
|
Toast toast = Toast.makeText(getApplication(), toastText, Toast.LENGTH_LONG);
|
||||||
toast.show();
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user