ViewChangeEvents - WonderCsabo/androidannotations GitHub Wiki
Since AndroidAnnotations 3.0
@FocusChange
This annotation is intended to be used on methods to receive events defined by android.view.View.OnFocusChangeListener.onFocusChange(View view, boolean hasFocus) when the focus state of a view has changed. The annotation value should be one or several R.id.* fields that refers to a subclass of View. If not set, the method name will be used as the R.id.* field name. The method may have multiple parameters:
- A android.view.View parameter to know which view has targeted this event.
- An boolean parameter to know if the view gain or lost the focus.
Some usage examples of @FocusChange annotation:
@FocusChange(R.id.helloTextView)
void focusChangedOnHelloTextView(View hello, boolean hasFocus) {
// Something Here
}
@FocusChange
void helloTextViewFocusChanged(View hello) {
// Something Here
}
@FocusChange({R.id.editText, R.id.helloTextView})
void focusChangedOnSomeTextViews(View hello, boolean hasFocus) {
// Something Here
}
@FocusChange(R.id.helloTextView)
void focusChangedOnHelloTextView() {
// Something Here
}
Since AndroidAnnotations 4.0.0
As of AndroidAnnotations 4.0.0 any subclass of View
can be passed to the methods (eg. EditText
).
@CheckedChange
This annotation is intended to be used on methods to receive events defined by android.widget.CompoundButton.OnCheckedChangeListener.onCheckedChanged(CompoundButton buttonView, boolean isChecked) when the check state of a compound button has changed. The annotation value should be one or several R.id.* fields that refers to a subclass of View. If not set, the method name will be used as the R.id.* field name. The method may have multiple parameters:
- A android.widget.CompoundButton parameter to know which compound button has targeted this event.
- An boolean parameter to know if the view is checked.
Some usage examples of @CheckedChange annotation:
@CheckedChange(R.id.helloCheckBox)
void checkedChangeOnHelloCheckBox(CompoundButton hello, boolean isChecked) {
// Something Here
}
@CheckedChange
void helloCheckBoxCheckedChanged(CompoundButton hello) {
// Something Here
}
@CheckedChange({R.id.aCheckBox, R.id.helloCheckBox})
void checkedChangedOnSomeCheckBoxs(CompoundButton hello, boolean isChecked) {
// Something Here
}
@CheckedChange(R.id.helloCheckBox)
void checkedChangedOnHelloCheckBox() {
// Something Here
}
Since AndroidAnnotations 4.0.0
As of AndroidAnnotations 4.0.0 any subclass of CompoundButton
can be passed to the methods (eg. CheckBox
).