Useful Constretto project extensions for Android.
public class ScreenPreferences {
@Configuration // implies that the preference name in the SharedPreferences store is "brightness"
private String brightness;
@Configuration("length") // implies that the preference name in the SharedPreferences store is "length"
private Integer scale;
public String getBrightness() {
return brightness;
}
public Integer getScale() {
return scale;
}
}
SharedPreferences prefs = this.getSharedPreferences("org.constretto.app", Context.MODE_PRIVATE);
ConstrettoConfiguration conf = ConstrettoAndroidBuilder.createConfigurationForSharedPreferences(prefs);
final ScreenPreferences screenPreferences = configuration.as(ScreenPreferences.class);
- a ConfigurationStore implementation that wraps a SharedPreferences store
- an easy way of creating a ConstrettoConfiguration object for a SharedPreferences
Follow development at the github issue tracker