Skip to content

Commit 4360e3f

Browse files
committed
Added missing usage examples in JavaDocs on some annotations
1 parent bb18d55 commit 4360e3f

4 files changed

Lines changed: 94 additions & 5 deletions

File tree

‎AndroidAnnotations/androidannotations-api/src/main/java/org/androidannotations/annotations/AfterExtras.java‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,25 @@
3232
* There may be several methods annotated with @{@link AfterExtras} in the same
3333
* class.
3434
*
35+
* <blockquote>
36+
*
37+
* Example :
38+
*
39+
* <pre>
40+
* &#064;EActivity(R.layout.main)
41+
* public class MyActivity extends Activity {
42+
*
43+
* &#064;Extra
44+
* String myExtra;
45+
*
46+
* &#064;AfterExtras
47+
* void afterExtras() {
48+
* // myExtra is now available
49+
* }
50+
* }
51+
* </pre>
52+
*
53+
* </blockquote>
3554
*/
3655
@Retention(RetentionPolicy.CLASS)
3756
@Target(ElementType.METHOD)

‎AndroidAnnotations/androidannotations-api/src/main/java/org/androidannotations/annotations/IgnoredWhenDetached.java‎

Lines changed: 30 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,42 @@
2121
import java.lang.annotation.Target;
2222

2323
/**
24-
* When used standalone in an {@link EFragment} or in conjunction with the {@link UiThread}
25-
* or {@link Background} annotations, the annotated method will be wrapped in an 'if attached'
26-
* block such that no code will be executed if the {@link EFragment} is no longer bound to
27-
* its parent activity.
24+
* When used standalone in an {@link EFragment} or in conjunction with the
25+
* {@link UiThread} or {@link Background} annotations, the annotated method will
26+
* be wrapped in an 'if attached' block such that no code will be executed if
27+
* the {@link EFragment} is no longer bound to its parent activity.
2828
* <p/>
2929
* Should be used on method that must meet the following criteria
3030
* <p/>
31-
* 1) Can only be used in conjunction with classes annotated with {@link EFragment}
31+
* 1) Can only be used in conjunction with classes annotated with
32+
* {@link EFragment}
3233
* <p/>
3334
* 2) The annotated method MUST return void and MAY contain parameters.
3435
*
36+
* <blockquote> <b>Example</b> :
37+
*
38+
* <pre>
39+
* &#064;EFragment
40+
* public class LoaderFragment extends Fragment {
41+
*
42+
* ...
43+
*
44+
* &#064;UiThread
45+
* &#064;IgnoredWhenDetached
46+
* void killActivity() {
47+
* getActivity().finish();
48+
* }
49+
*
50+
*
51+
* &#064;IgnoredWhenDetached
52+
* void updateTitle(String title) {
53+
* getActivity().setTitle(title);
54+
* }
55+
* }
56+
* </pre>
57+
*
58+
* </blockquote>
59+
*
3560
* @see org.androidannotations.annotations.EFragment
3661
* @see org.androidannotations.annotations.UiThread
3762
* @see org.androidannotations.annotations.Background

‎AndroidAnnotations/androidannotations-api/src/main/java/org/androidannotations/annotations/NonConfigurationInstance.java‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,25 @@
4242
* This caution doesn't apply to beans annotated with {@link Bean}, because
4343
* AndroidAnnotations automatically takes care of rebinding their context.
4444
* </p>
45+
*
46+
* <blockquote>
47+
*
48+
* Example :
49+
*
50+
* <pre>
51+
* &#064;EActivity(R.layout.main)
52+
* public class MyActivity extends Activity {
53+
*
54+
* &#064;NonConfigurationInstance
55+
* Bitmap someBitmap;
56+
*
57+
* &#064;NonConfigurationInstance
58+
* &#064;Bean
59+
* MyBackgroundTask myBackgroundTask;
60+
* }
61+
* </pre>
62+
*
63+
* </blockquote>
4564
*/
4665
@Retention(RetentionPolicy.CLASS)
4766
@Target(ElementType.FIELD)

‎AndroidAnnotations/androidannotations-api/src/main/java/org/androidannotations/annotations/RootContext.java‎

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,32 @@
3131
* instance of the bean using a Service context, and you use {@link RootContext}
3232
* on a field that extends Activity, this field will be null at runtime.
3333
* </p>
34+
* <blockquote>
35+
*
36+
* Example :
37+
*
38+
* <pre>
39+
* &#064;EBean
40+
* public class MyClass {
41+
*
42+
* &#064;RootContext
43+
* Context context;
44+
*
45+
* // Only injected if the root context is an activity
46+
* &#064;RootContext
47+
* Activity activity;
48+
*
49+
* // Only injected if the root context is a service
50+
* &#064;RootContext
51+
* Service service;
52+
*
53+
* // Only injected if the root context is an instance of MyActivity
54+
* &#064;RootContext
55+
* MyActivity myActivity;
56+
* }
57+
* </pre>
58+
*
59+
* </blockquote>
3460
*/
3561
@Retention(RetentionPolicy.CLASS)
3662
@Target(ElementType.FIELD)

0 commit comments

Comments
 (0)