Useful Constretto project extensions for Android.
publicclassScreenPreferences {
@Configuration// implies that the preference name in the SharedPreferences store is "brightness"privateStringbrightness;
@Configuration("length") // implies that the preference name in the SharedPreferences store is "length"privateIntegerscale;
publicStringgetBrightness() {
returnbrightness; }
publicIntegergetScale() {
returnscale;
}
}SharedPreferencesprefs = this.getSharedPreferences("org.constretto.app", Context.MODE_PRIVATE);
ConstrettoConfigurationconf = ConstrettoAndroidBuilder.createConfigurationForSharedPreferences(prefs);finalScreenPreferencesscreenPreferences = 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
