public E getPreferenceValue(final SharedPreferences prefs, final E defValue) { if (!prefs.contains(key)) { prefs.edit().putString(key, defValue.getResValue()).commit(); } return EnumUtils.getByResValue(enumClass, prefs.getString(key, null), defValue); }
public EnumPreferenceDefinition(final Class<E> enumClass, final int keyRes, final int defValRef) { super(keyRes); this.enumClass = enumClass; this.defValue = EnumUtils.getByResValue(enumClass, BaseDroidApp.context.getString(defValRef), null); }