|
15 | 15 | */ |
16 | 16 | package org.androidannotations.annotations; |
17 | 17 |
|
| 18 | +import java.io.Serializable; |
18 | 19 | import java.lang.annotation.ElementType; |
19 | 20 | import java.lang.annotation.Retention; |
20 | 21 | import java.lang.annotation.RetentionPolicy; |
21 | 22 | import java.lang.annotation.Target; |
22 | 23 |
|
| 24 | +import android.app.Activity; |
| 25 | +import android.os.Parcelable; |
| 26 | + |
23 | 27 | /** |
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 | + * @EActivity |
| 49 | + * public class MyActivity extends Activity { |
| 50 | + * |
| 51 | + * @Click |
| 52 | + * void buttonClicked() { |
| 53 | + * MyExtraActivity_.intent(this) // |
| 54 | + * .myMessage("test") // |
| 55 | + * .startActivity(); |
| 56 | + * } |
| 57 | + * } |
| 58 | + * |
| 59 | + * @EActivity |
| 60 | + * public class MyExtraActivity extends Activity { |
| 61 | + * |
| 62 | + * @Extra |
| 63 | + * String myMessage; |
| 64 | + * |
| 65 | + * @AfterInject |
| 66 | + * void init() { |
| 67 | + * Log.d("AA", "extra myMessage = " + myMessage); |
| 68 | + * } |
| 69 | + * } |
| 70 | + * </pre> |
26 | 71 | * |
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> |
31 | 73 | * |
| 74 | + * @see AfterInject |
| 75 | + * @see EActivity |
32 | 76 | */ |
33 | 77 | @Retention(RetentionPolicy.CLASS) |
34 | 78 | @Target(ElementType.FIELD) |
|
0 commit comments