Fix IntDef's usages in the platform Transitions

Bug: 68490704

1) Add annotation in some places where it was missed: constructors of Fade and Slide
2) Add Fade.IN and Fade.OUT into a set of allowed values for Visibility.MODE IntDef. Without it Lint will false alarm on this line:
new Fade().setMode(Fade.IN);
It should be allowed as Fade.IN is just a proxy value for Visibility.MODE_IN.

Test: n/a
Change-Id: I56d8ba5f49b1cf8f6a61357f58ac76312e7cf037
This commit is contained in:
Andrey Kulikov
2018-09-07 14:05:18 +01:00
parent 75edffed94
commit 275ca2a651
3 changed files with 6 additions and 4 deletions

View File

@@ -94,7 +94,7 @@ public class Fade extends Visibility {
* @param fadingMode The behavior of this transition, a combination of
* {@link #IN} and {@link #OUT}.
*/
public Fade(int fadingMode) {
public Fade(@VisibilityMode int fadingMode) {
setMode(fadingMode);
}

View File

@@ -147,7 +147,7 @@ public class Slide extends Visibility {
/**
* Constructor using the provided slide edge direction.
*/
public Slide(int slideEdge) {
public Slide(@GravityFlag int slideEdge) {
setSlideEdge(slideEdge);
}

View File

@@ -52,9 +52,11 @@ public abstract class Visibility extends Transition {
/** @hide */
@Retention(RetentionPolicy.SOURCE)
@IntDef(flag = true, prefix = { "MODE_" }, value = {
@IntDef(flag = true, value = {
MODE_IN,
MODE_OUT
MODE_OUT,
Fade.IN,
Fade.OUT
})
@interface VisibilityMode {}