Tweakr
Android Library for Remote Debugging, Autogenerating Settings/Preference UIs, and Wizard-of-Ozing
|
Public Member Functions | |
String | child () default "" |
Class<? extends ValueType > | valueType () default ValueType.class |
String | description () default "" |
Add this annotation to any field or method you want to alter in the Tweakr UI.
Most primitive types are supported automatically. If you want to handle a custom type, you will need to implement com.google.tweakr.types.ValueType
and either specify it in the valueType()
attribute, or register your own com.google.tweakr.types.ValueTypeConverter
to return your custom ValueType whenever it encounters a field using your type.
If annotating a method, that method will be called with the updated value whenever you alter it in the UI. If the method is a setter, it will automatically try to derive the initial value from the corresponding getter (if it can find it).
Only methods that take 0 or 1 parameters are currently supported.
String com.google.tweakr.annotations.Tweak.child | ( | ) |
If specified, Tweaks a child member of the annotated object instead of the object itself.
If the member is a property, Tweakr will automatically call the getters and setters as appropriate, e.g.:
if child="text", Tweakr will call "getText()" and "setText()".
If there are multiple overloads of the method that take different parameters, you may specify which overload to use by appending the parameter type in parenthesis, e.g.:
child="setText(CharSequence)" or child="setText(int)"
Only methods that take 0 or 1 parameters are currently supported.
String com.google.tweakr.annotations.Tweak.description | ( | ) |
A description to display in the Tweakr UI.
Class<? extends ValueType > com.google.tweakr.annotations.Tweak.valueType | ( | ) |
If specified, uses the given com.google.tweakr.types.ValueType
instead of one provided by the registered com.google.tweakr.types.ValueTypeConverter
. This is helpful if you want to specify a custom UI to tweak types that otherwise already have a default UI.
e.g. to present a color picker UI for an "int" field instead of the default number slider, use @Tweak(valueType = ColorValueType.class)