Skip to content

constretto/constretto-android

Repository files navigation

constretto-android

Useful Constretto project extensions for Android. Build Status

Quickstart

1. Add annotations to your POJO

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;
	}

}

2. Create Constretto Configuration

SharedPreferences prefs = this.getSharedPreferences("org.constretto.app", Context.MODE_PRIVATE);
ConstrettoConfiguration conf = ConstrettoAndroidBuilder.createConfigurationForSharedPreferences(prefs);

3. Inject configuration

final ScreenPreferences screenPreferences = configuration.as(ScreenPreferences.class);

Planned features

  • 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

About

Useful Constretto extensions for Android

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages