Skip to content

Commit 94bf5b8

Browse files
committed
More javadoc Improvement
1 parent ebf237b commit 94bf5b8

25 files changed

Lines changed: 719 additions & 152 deletions

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
* The annotation value should be one of R.id.* fields. If not set, the method
2929
* name will be used as the R.id.* field name.
3030
* <p/>
31-
* The method MAY one parameter:
31+
* The method MAY have one parameter:
3232
* <ul>
3333
* <li>A {@link android.view.View} parameter to know which view has been clicked
3434
* </ul>
@@ -50,6 +50,11 @@
5050
* </pre>
5151
*
5252
* </blockquote>
53+
*
54+
* @see LongClick
55+
* @see ItemClick
56+
* @see ItemLongClick
57+
* @see ItemSelect
5358
*/
5459
@Retention(RetentionPolicy.CLASS)
5560
@Target(ElementType.METHOD)

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

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,6 @@
3838
* content view will be set, and you should call the setContentView() method
3939
* yourself, in <b>onCreate()</b>
4040
* <p/>
41-
* The generated class will also contain an IntentBuilder to start activity with
42-
* a fluent API. Android's extra can also be enhanced by using {@link Extra}
43-
* annotation on every native or serializable/parcelable field.
44-
* <p/>
4541
* <blockquote>
4642
*
4743
* Example :
@@ -52,9 +48,7 @@
5248
*
5349
* public void launchActivity() {
5450
* // Note the use of generated class instead of original one
55-
* MyActivityTwo_.intent(this) //
56-
* .myExtra(&quot;test&quot;) //
57-
* .startActivity();
51+
* MyActivityTwo_.intent(this).startActivity();
5852
* }
5953
* }
6054
*
@@ -67,17 +61,14 @@
6761
* &#064;ViewById
6862
* TextView myTextView;
6963
*
70-
* &#064;Extra
71-
* String myExtra;
72-
*
7364
* &#064;AfterInject
7465
* void init() {
7566
* myBean.doSomeStuff();
7667
* }
7768
*
7869
* &#064;AfterViews
7970
* void initViews() {
80-
* myTextView.setText(myExtra);
71+
* myTextView.setText(&quot;test&quot;);
8172
* }
8273
* }
8374
* </pre>

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

Lines changed: 50 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,20 +15,64 @@
1515
*/
1616
package org.androidannotations.annotations;
1717

18+
import java.io.Serializable;
1819
import java.lang.annotation.ElementType;
1920
import java.lang.annotation.Retention;
2021
import java.lang.annotation.RetentionPolicy;
2122
import java.lang.annotation.Target;
2223

24+
import android.app.Activity;
25+
import android.os.Parcelable;
26+
2327
/**
24-
* Use on Extra fields in activity and service classes. This String value field
25-
* corresponds to the Android extra name.
28+
* Use on any native, {@link Parcelable} or {@link Serializable} field in an
29+
* {@link EActivity} annotated class to bind it with Android's extra.
30+
* <p/>
31+
* The annotation value is the key used for extra. If not set, the field name
32+
* will be used as the key.
33+
* <p/>
34+
* When {@link Extra} is used, the intent builder will hold dedicated methods
35+
* for each annotated fields.
36+
* <p/>
37+
* Your code related to injected extra should go in an {@link AfterInject}
38+
* annotated method.
39+
* <p/>
40+
* Calling {@link Activity#setIntent(android.content.Intent)} will automatically
41+
* update the annotated extras.
42+
* <p/>
43+
* <blockquote>
44+
*
45+
* Example :
46+
*
47+
* <pre>
48+
* &#064;EActivity
49+
* public class MyActivity extends Activity {
50+
*
51+
* &#064;Click
52+
* void buttonClicked() {
53+
* MyExtraActivity_.intent(this) //
54+
* .myMessage(&quot;test&quot;) //
55+
* .startActivity();
56+
* }
57+
* }
58+
*
59+
* &#064;EActivity
60+
* public class MyExtraActivity extends Activity {
61+
*
62+
* &#064;Extra
63+
* String myMessage;
64+
*
65+
* &#064;AfterInject
66+
* void init() {
67+
* Log.d(&quot;AA&quot;, &quot;extra myMessage = &quot; + myMessage);
68+
* }
69+
* }
70+
* </pre>
2671
*
27-
* When {@link Extra} is used on fields in an Activity, the intent builder will
28-
* hold dedicated methods for these extras. Calling
29-
* Activity#setIntent(android.content.Intent) will automatically update the
30-
* annotated extras.
72+
* </blockquote>
3173
*
74+
* @see AfterInject
75+
* @see EActivity
3276
*/
3377
@Retention(RetentionPolicy.CLASS)
3478
@Target(ElementType.FIELD)

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

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,49 @@
2121
import java.lang.annotation.Target;
2222

2323
/**
24+
* This annotation is intended to be used on methods to receive events defined
25+
* by
26+
* {@link android.view.View.OnFocusChangeListener#onFocusChange(android.view.View, boolean)}
27+
* after focus is changed on the targeted View or subclass of View.
28+
* <p/>
29+
* The annotation value should be one or several R.id.* fields that refers to
30+
* View or subclasses of View. If not set, the method name will be used as the
31+
* R.id.* field name.
32+
* <p/>
33+
* The method MAY have multiple parameter:
34+
* <ul>
35+
* <li>A {@link android.view.View} parameter to know which view has targeted
36+
* this event</li>
37+
* <li>An {@link boolean} to know the view has focus.</li>
38+
* </ul>
39+
* <p/>
40+
* <blockquote>
41+
*
42+
* Example :
43+
*
44+
* <pre>
45+
* &#064;FocusChange(<b>R.id.myButton</b>)
46+
* void focusChangedOnMyButton(boolean isChecked, View button) {
47+
* // Something Here
48+
* }
49+
*
50+
* &#064;FocusChange
51+
* void <b>myButton</b>FocusChanged(View button) {
52+
* // Something Here
53+
* }
54+
*
55+
* &#064;FocusChange(<b>{R.id.myButton, R.id.myButton1}</b>)
56+
* void focusChangedOnSomeButtons(View button, boolean isChecked) {
57+
* // Something Here
58+
* }
59+
*
60+
* &#064;FocusChange(<b>R.id.myButton</b>)
61+
* void focusChangedOnMyButton() {
62+
* // Something Here
63+
* }
64+
* </pre>
65+
*
66+
* </blockquote>
2467
*
2568
* @author Rostislav Chekan
2669
*/

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

Lines changed: 42 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,56 @@
1515
*/
1616
package org.androidannotations.annotations;
1717

18+
import java.io.Serializable;
1819
import java.lang.annotation.ElementType;
1920
import java.lang.annotation.Retention;
2021
import java.lang.annotation.RetentionPolicy;
2122
import java.lang.annotation.Target;
2223

24+
import android.os.Parcelable;
25+
2326
/**
24-
* Use on fields in fragments. This String value field corresponds to the
25-
* argument name.
27+
* Use on any native, {@link Parcelable} or {@link Serializable} field in an
28+
* {@link EFragment} annotated class to bind it with Android's arguments.
29+
* <p/>
30+
* The annotation value is the key used for argument. If not set, the field name
31+
* will be used as the key.
32+
* <p/>
33+
* When {@link FragmentArg} is used, the intent builder will hold dedicated
34+
* methods for each annotated fields.
35+
* <p/>
36+
* Your code related to injected extra should go in an {@link AfterInject}
37+
* annotated method.
38+
* <p/>
39+
* <blockquote>
40+
*
41+
* Example :
42+
*
43+
* <pre>
44+
* &#064;EFragment
45+
* public class MyFragment extends Fragment {
46+
*
47+
* &#064;FragmentArg
48+
* String myMessage;
49+
* }
50+
*
51+
* &#064;EActivity
52+
* public class MyActivity extends Activity {
53+
*
54+
* &#064;AfterViews
55+
* void init() {
56+
* MyFragment myFragment = MyFragment_.builder() //
57+
* .myMessage(&quot;Hello&quot;) //
58+
* .build();
59+
* }
60+
* }
61+
* </pre>
2662
*
27-
* When {@link FragmentArg} is used on fields in a Fragment, the fragment
28-
* builder will hold dedicated methods for these arguments.
63+
* </blockquote>
2964
*
65+
* @see EFragment
66+
* @see FragmentById
67+
* @see FragmentByTag
3068
*/
3169
@Retention(RetentionPolicy.CLASS)
3270
@Target(ElementType.FIELD)

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

Lines changed: 41 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,50 @@
2121
import java.lang.annotation.Target;
2222

2323
/**
24-
* Use it on Fragment fields in activity classes
25-
*
24+
* Use it on {@link android.app.Fragment} or
25+
* {@link android.support.v4.app.Fragment} fields in activity classes to
26+
* retrieve and inject a fragment.
27+
* <p/>
2628
* The annotation value should be one of R.id.* fields. If not set, the field
2729
* name will be used as the R.id.* field name.
30+
* <p/>
31+
* <b>Note:</b> This can only inject an existing fragment, not create them.
32+
* <p/>
33+
* <blockquote>
34+
*
35+
* Example :
36+
*
37+
* <pre>
38+
* &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
39+
* android:layout_width="match_parent"
40+
* android:layout_height="match_parent" >
41+
*
42+
* &lt;fragment
43+
* android:id="@+id/myFragment"
44+
* android:name="mypackage.MyFragment_"
45+
* android:layout_width="match_parent"
46+
* android:layout_height="match_parent" />
47+
* &lt;/LinearLayout>
48+
*
49+
*
50+
* &#064;EActivity(R.layout.main)
51+
* public class MyActivity extends Activity {
52+
*
53+
* // all injected fragment will be the same
54+
*
55+
* &#064;FragmentById
56+
* public MyFragment myFragment;
57+
*
58+
* &#064;FragmentById(R.id.myFragment)
59+
* public MyFragment myFragment2;
60+
* }
61+
* </pre>
62+
*
63+
* </blockquote>
2864
*
65+
* @see EFragment
66+
* @see FragmentArg
67+
* @see FragmentByTag
2968
*/
3069
@Retention(RetentionPolicy.CLASS)
3170
@Target(ElementType.FIELD)

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

Lines changed: 43 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,51 @@
2121
import java.lang.annotation.Target;
2222

2323
/**
24-
* Use it on Fragment fields in activity classes
24+
* Use it on {@link android.app.Fragment} or
25+
* {@link android.support.v4.app.Fragment} fields in activity classes to
26+
* retrieve and inject a fragment.
27+
* <p/>
28+
* The annotation value should be one of fragment tag. If not set, the field
29+
* name will be used as the tag name.
30+
* <p/>
31+
* <b>Note:</b> This can only inject an existing fragment, not create them.
32+
* <p/>
33+
* <blockquote>
2534
*
26-
* The annotation value should be the tag name of the fragment. If not set, the
27-
* field name will be used as tag name name.
35+
* Example :
2836
*
37+
* <pre>
38+
* &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
39+
* android:layout_width="match_parent"
40+
* android:layout_height="match_parent" >
41+
*
42+
* &lt;fragment
43+
* android:id="@+id/myFragment"
44+
* android:tag="myFragmentTag"
45+
* android:name="mypackage.MyFragment_"
46+
* android:layout_width="match_parent"
47+
* android:layout_height="match_parent" />
48+
* &lt;/LinearLayout>
49+
*
50+
*
51+
* &#064;EActivity(R.layout.main)
52+
* public class MyActivity extends Activity {
53+
*
54+
* // all injected fragment will be the same
55+
*
56+
* &#064;FragmentByTag
57+
* public MyFragment myFragmentTag;
58+
*
59+
* &#064;FragmentByTag("myFragmentTag")
60+
* public MyFragment myFragmentTag2;
61+
* }
62+
* </pre>
63+
*
64+
* </blockquote>
65+
*
66+
* @see EFragment
67+
* @see FragmentArg
68+
* @see FragmentById
2969
*/
3070
@Retention(RetentionPolicy.CLASS)
3171
@Target(ElementType.FIELD)

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

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,39 @@
2020
import java.lang.annotation.RetentionPolicy;
2121
import java.lang.annotation.Target;
2222

23+
import org.androidannotations.annotations.res.HtmlRes;
24+
25+
/**
26+
* Use on a {@link android.widget.TextView} field or a
27+
* {@link android.widget.TextView} subclass field annotated with
28+
* {@link ViewById} to inject text as HTML.
29+
* <p/>
30+
* The annotation value should be a R.id.* field that refers to string resource.
31+
* If not set, the method name will be used as the R.id.* field name.
32+
* <p/>
33+
* <blockquote>
34+
*
35+
* Example :
36+
*
37+
* <pre>
38+
* &#064;EActivity(R.layout.main)
39+
* public class MyActivity extends Activity {
40+
*
41+
* &#064;ViewById(R.id.my_text_view)
42+
* &#064;FromHtml(R.string.hello_html)
43+
* TextView textView;
44+
*
45+
* &#064;ViewById
46+
* &#064;FromHtml
47+
* TextView someView;
48+
* }
49+
* </pre>
50+
*
51+
* </blockquote>
52+
*
53+
* @see ViewById
54+
* @see HtmlRes
55+
*/
2356
@Retention(RetentionPolicy.CLASS)
2457
@Target(ElementType.FIELD)
2558
public @interface FromHtml {

0 commit comments

Comments
 (0)