All notable changes to this project will be documented in this file.
PreferenceBinder.bind
andPreferenceBinder.unbind
statement check now looks inside blocks/scopes (e.g.if
blocks).- Added
PreferenceBinder.bind(Context context, Object target, SharedPreferences prefs)
to allow testing with mockedSharedPreferences
files.
- Removed compiler check for
PreferenceBinder.bind
andPreferenceBinder.unbind
method calls pending testing and stability improvement to the feature
- Fixed NullPointerException when using this library in classes with abstract methods.
- Updated bind/unbind statement checker to look in scopes inside methods.
- New annotation
@BindPref
replaces both@InjectPreference
and@OnPreferenceChanged
. Thelisten
flag now defaults to true - All instances of "inject", "injector", and "injection" have been replaced with "bind", "binding", and "binding".
@PreferenceDefault
annotated fields now apply globally (application-wide) rather than just for their containing class.
@BindPref
annotation may now be used on certain widget types (fields), to automatically bind the preference value to a widget's method. See README.md for details.- Compiler now checks for
PreferenceBinder.bind
andPreferenceBinder.unbind
(when necessary) method calls in classes with@BindPref
annotations.
- Set minSdk to 4, to prevent unnecessary permissions being added by default (see this reference for explanation)
- Optional "listen" flag for
@InjectPreference
annotation as shorthand for also adding@OnPreferenceChange
annotation to the same element OnPreferenceChange
annotations on methods can now contain multiple keys (if the method has zero parameters)
- Method calls now always occur after field updates for any given preference key (for both initialization and updates)
- Annotated methods can now contain zero parameters, to disregard the preference value.
PreferenceInjector.bind(Fragment target)
method. TheContext
can be inferred from theFragment
.PreferenceInjector.bind(Service target)
method. TheContext
can be inferred from theService
.
@PreferenceDefault
annotation, to specify injection values when none exists in theSharedPreferences
file
String
andSet<String>
are now properly recognized as valid types
- Removed
initialize
flag from@OnPreferenceChange
annotation,@InjectPreference
can now be applied to methods instead - Removed
autoUpdate
flag from@InjectPreference
annotation,@OnPreferenceChange
can now be applied to fields instead PreferenceInjector.unbind
no longer needs to be called if no@OnPreferenceChange
annotations exist
- @InjectPreference and code generation for it
- @OnPreferenceChange and code generation for it