-
Notifications
You must be signed in to change notification settings - Fork 728
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
New view annotation for hook after view bound (#242)
- Loading branch information
Showing
10 changed files
with
419 additions
and
6 deletions.
There are no files selected for viewing
21 changes: 21 additions & 0 deletions
21
epoxy-annotations/src/main/java/com/airbnb/epoxy/AfterPropsSet.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package com.airbnb.epoxy; | ||
|
||
import java.lang.annotation.ElementType; | ||
import java.lang.annotation.Retention; | ||
import java.lang.annotation.RetentionPolicy; | ||
import java.lang.annotation.Target; | ||
|
||
/** | ||
* This can be used to annotate methods inside classes with a {@link com.airbnb.epoxy.ModelView} | ||
* annotation. Methods with this annotation will be called after a view instance is bound to a | ||
* model and all model props have been set. This is useful if you need to wait until multiple props | ||
* are set before doing certain initialization. | ||
* <p> | ||
* Methods with this annotation will be called after both the initial bind when the view comes on | ||
* screen, and after partial binds when an onscreen view is updated. | ||
*/ | ||
@Target(ElementType.METHOD) | ||
@Retention(RetentionPolicy.CLASS) | ||
public @interface AfterPropsSet { | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
epoxy-processortest/src/test/resources/TestAfterBindPropsSuperView.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package com.airbnb.epoxy; | ||
|
||
import android.content.Context; | ||
import android.view.View; | ||
|
||
@ModelView(defaultLayout = 1) | ||
public abstract class TestAfterBindPropsSuperView extends View { | ||
|
||
public TestAfterBindPropsSuperView(Context context) { | ||
super(context); | ||
} | ||
|
||
@ModelProp | ||
public void setFlagSuper(boolean flag) { | ||
|
||
} | ||
|
||
@AfterPropsSet | ||
public void afterFlagSetSuper() { | ||
|
||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
epoxy-processortest/src/test/resources/TestAfterBindPropsView.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package com.airbnb.epoxy; | ||
|
||
import android.content.Context; | ||
|
||
@ModelView(defaultLayout = 1) | ||
public class TestAfterBindPropsView extends TestAfterBindPropsSuperView { | ||
|
||
public TestAfterBindPropsView(Context context) { | ||
super(context); | ||
} | ||
|
||
@ModelProp | ||
public void setFlag(boolean flag) { | ||
|
||
} | ||
|
||
@AfterPropsSet | ||
public void afterFlagSet() { | ||
|
||
} | ||
} |
Oops, something went wrong.