@Override public Boolean fromString(String value) throws InvalidSettingValueException { if (Boolean.TRUE.toString().equals(value)) { return true; } else if (Boolean.FALSE.toString().equals(value)) { return false; } throw new InvalidSettingValueException(); } }
@Override public Integer fromPrettyString(String value) throws InvalidSettingValueException { try { if (value.length() == 7) { return Integer.parseInt(value.substring(1), 16) | 0xFF000000; } } catch (NumberFormatException e) { /* do nothing */ } throw new InvalidSettingValueException(); } }
@Override public T fromPrettyString(String value) throws InvalidSettingValueException { for (Entry<T, String> entry : getMapping().entrySet()) { if (entry.getValue().equals(value)) { return entry.getKey(); } } throw new InvalidSettingValueException(); } }
throw new InvalidSettingValueException(); if (account.outgoing == null && !incomingServerType.equals(Protocols.WEBDAV)) { throw new InvalidSettingValueException(); } else if (!mergeImportedAccount) { throw new InvalidSettingValueException();
throw new InvalidSettingValueException();
@Override public K9.Theme fromString(String value) throws InvalidSettingValueException { try { Integer theme = Integer.parseInt(value); if (theme == K9.Theme.LIGHT.ordinal() || // We used to store the resource ID of the theme in the preference storage, // but don't use the database upgrade mechanism to update the values. So // we have to deal with the old format here. theme == android.R.style.Theme_Light) { return K9.Theme.LIGHT; } else if (theme == K9.Theme.DARK.ordinal() || theme == android.R.style.Theme) { return K9.Theme.DARK; } } catch (NumberFormatException e) { /* do nothing */ } throw new InvalidSettingValueException(); }
@Override public Integer fromString(String value) throws InvalidSettingValueException { try { int intValue = Integer.parseInt(value); if (start <= intValue && intValue <= end) { return intValue; } } catch (NumberFormatException e) { /* do nothing */ } throw new InvalidSettingValueException(); } }
@Override public T fromString(String value) throws InvalidSettingValueException { try { return Enum.valueOf(enumClass, value); } catch (Exception e) { throw new InvalidSettingValueException(); } } }
@Override public Integer fromString(String value) throws InvalidSettingValueException { try { return Integer.parseInt(value); } catch (NumberFormatException e) { throw new InvalidSettingValueException(); } }
@Override public String fromString(String value) throws InvalidSettingValueException { if (!value.matches(VALIDATION_EXPRESSION)) { throw new InvalidSettingValueException(); } return value; } }
@Override public Integer fromString(String value) throws InvalidSettingValueException { try { Integer deletePolicy = Integer.parseInt(value); if (mapping.containsKey(deletePolicy)) { return deletePolicy; } } catch (NumberFormatException e) { /* do nothing */ } throw new InvalidSettingValueException(); } }
@Override public Integer fromString(String value) throws InvalidSettingValueException { try { Integer fontSize = Integer.parseInt(value); if (mapping.containsKey(fontSize)) { return fontSize; } } catch (NumberFormatException e) { /* do nothing */ } throw new InvalidSettingValueException(); } }
@Override public K9.Theme fromString(String value) throws InvalidSettingValueException { try { Integer theme = Integer.parseInt(value); if (theme == K9.Theme.USE_GLOBAL.ordinal()) { return K9.Theme.USE_GLOBAL; } return super.fromString(value); } catch (NumberFormatException e) { throw new InvalidSettingValueException(); } }
@Override public String fromString(String value) throws InvalidSettingValueException { if (mapping.containsKey(value)) { return value; } throw new InvalidSettingValueException(); } }
@Override public Integer fromString(String value) throws InvalidSettingValueException { try { Integer fontSize = Integer.parseInt(value); if (mapping.containsKey(fontSize)) { return fontSize; } } catch (NumberFormatException e) { /* do nothing */ } throw new InvalidSettingValueException(); } }
@Override public String fromString(String value) throws InvalidSettingValueException { if (!mapping.containsKey(value)) { throw new InvalidSettingValueException(); } return value; } }
@Override public Integer fromString(String value) throws InvalidSettingValueException { try { return Integer.parseInt(value); } catch (NumberFormatException e) { throw new InvalidSettingValueException(); } } }
@Override public K9.Theme fromPrettyString(String value) throws InvalidSettingValueException { if (THEME_LIGHT.equals(value)) { return K9.Theme.LIGHT; } else if (THEME_DARK.equals(value)) { return K9.Theme.DARK; } throw new InvalidSettingValueException(); }
@Override public String fromString(String value) throws InvalidSettingValueException { if (value != null && !validator.isValidAddressOnly(value)) { throw new InvalidSettingValueException(); } return value; }