summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--api/current.txt10
-rw-r--r--core/java/android/app/ActivityTransitionCoordinator.java2
-rw-r--r--core/java/android/transition/SidePropagation.java40
-rw-r--r--core/java/android/transition/Slide.java43
-rw-r--r--core/java/android/transition/Transition.java6
-rw-r--r--core/java/android/transition/TransitionInflater.java3
6 files changed, 28 insertions, 76 deletions
diff --git a/api/current.txt b/api/current.txt
index b7eda9f5dcf6..8d6b906dd00a 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -29852,20 +29852,12 @@ package android.transition {
method public long getStartDelay(android.view.ViewGroup, android.transition.Transition, android.transition.TransitionValues, android.transition.TransitionValues);
method public void setPropagationSpeed(float);
method public void setSide(int);
- field public static final int BOTTOM = 3; // 0x3
- field public static final int LEFT = 0; // 0x0
- field public static final int RIGHT = 2; // 0x2
- field public static final int TOP = 1; // 0x1
}
public class Slide extends android.transition.Visibility {
ctor public Slide();
ctor public Slide(int);
method public void setSlideEdge(int);
- field public static final int BOTTOM = 3; // 0x3
- field public static final int LEFT = 0; // 0x0
- field public static final int RIGHT = 2; // 0x2
- field public static final int TOP = 1; // 0x1
}
public abstract class Transition implements java.lang.Cloneable {
@@ -29919,7 +29911,7 @@ package android.transition {
public static abstract class Transition.EpicenterCallback {
ctor public Transition.EpicenterCallback();
- method public abstract android.graphics.Rect getEpicenter(android.transition.Transition);
+ method public abstract android.graphics.Rect onGetEpicenter(android.transition.Transition);
}
public static abstract interface Transition.TransitionListener {
diff --git a/core/java/android/app/ActivityTransitionCoordinator.java b/core/java/android/app/ActivityTransitionCoordinator.java
index b739387a76c3..b658597b494e 100644
--- a/core/java/android/app/ActivityTransitionCoordinator.java
+++ b/core/java/android/app/ActivityTransitionCoordinator.java
@@ -563,7 +563,7 @@ abstract class ActivityTransitionCoordinator extends ResultReceiver {
public void setEpicenter(Rect epicenter) { mEpicenter = epicenter; }
@Override
- public Rect getEpicenter(Transition transition) {
+ public Rect onGetEpicenter(Transition transition) {
return mEpicenter;
}
}
diff --git a/core/java/android/transition/SidePropagation.java b/core/java/android/transition/SidePropagation.java
index 5d38ac85f699..623cdd18ee44 100644
--- a/core/java/android/transition/SidePropagation.java
+++ b/core/java/android/transition/SidePropagation.java
@@ -18,6 +18,7 @@ package android.transition;
import android.graphics.Rect;
import android.util.FloatMath;
import android.util.Log;
+import android.view.Gravity;
import android.view.View;
import android.view.ViewGroup;
@@ -32,38 +33,19 @@ import android.view.ViewGroup;
public class SidePropagation extends VisibilityPropagation {
private static final String TAG = "SlidePropagation";
- /**
- * Transition propagates relative to the distance of the left side of the scene.
- */
- public static final int LEFT = Slide.LEFT;
-
- /**
- * Transition propagates relative to the distance of the top of the scene.
- */
- public static final int TOP = Slide.TOP;
-
- /**
- * Transition propagates relative to the distance of the right side of the scene.
- */
- public static final int RIGHT = Slide.RIGHT;
-
- /**
- * Transition propagates relative to the distance of the bottom of the scene.
- */
- public static final int BOTTOM = Slide.BOTTOM;
-
private float mPropagationSpeed = 3.0f;
- private int mSide = BOTTOM;
+ private int mSide = Gravity.BOTTOM;
/**
* Sets the side that is used to calculate the transition propagation. If the transitioning
* View is visible in the start of the transition, then it will transition sooner when
* closer to the side and later when farther. If the view is not visible in the start of
* the transition, then it will transition later when closer to the side and sooner when
- * farther from the edge. The default is {@link #BOTTOM}.
+ * farther from the edge. The default is {@link Gravity#BOTTOM}.
*
* @param side The side that is used to calculate the transition propagation. Must be one of
- * {@link #LEFT}, {@link #TOP}, {@link #RIGHT}, or {@link #BOTTOM}.
+ * {@link Gravity#LEFT}, {@link Gravity#TOP}, {@link Gravity#RIGHT}, or
+ * {@link Gravity#BOTTOM}.
*/
public void setSide(int side) {
mSide = side;
@@ -141,16 +123,16 @@ public class SidePropagation extends VisibilityPropagation {
int left, int top, int right, int bottom) {
int distance = 0;
switch (mSide) {
- case LEFT:
+ case Gravity.LEFT:
distance = right - viewX + Math.abs(epicenterY - viewY);
break;
- case TOP:
+ case Gravity.TOP:
distance = bottom - viewY + Math.abs(epicenterX - viewX);
break;
- case RIGHT:
+ case Gravity.RIGHT:
distance = viewX - left + Math.abs(epicenterY - viewY);
break;
- case BOTTOM:
+ case Gravity.BOTTOM:
distance = viewY - top + Math.abs(epicenterX - viewX);
break;
}
@@ -159,8 +141,8 @@ public class SidePropagation extends VisibilityPropagation {
private int getMaxDistance(ViewGroup sceneRoot) {
switch (mSide) {
- case LEFT:
- case RIGHT:
+ case Gravity.LEFT:
+ case Gravity.RIGHT:
return sceneRoot.getWidth();
default:
return sceneRoot.getHeight();
diff --git a/core/java/android/transition/Slide.java b/core/java/android/transition/Slide.java
index 0ff8ddd4d1f9..8269258eaad8 100644
--- a/core/java/android/transition/Slide.java
+++ b/core/java/android/transition/Slide.java
@@ -24,6 +24,7 @@ import android.animation.ValueAnimator;
import android.graphics.Rect;
import android.util.Log;
import android.util.Property;
+import android.view.Gravity;
import android.view.View;
import android.view.ViewGroup;
import android.view.animation.AccelerateInterpolator;
@@ -41,35 +42,9 @@ import android.view.animation.DecelerateInterpolator;
public class Slide extends Visibility {
private static final String TAG = "Slide";
- /**
- * Move Views in or out of the left edge of the scene.
- * @see #setSlideEdge(int)
- */
- public static final int LEFT = 0;
-
- /**
- * Move Views in or out of the top edge of the scene.
- * @see #setSlideEdge(int)
- */
- public static final int TOP = 1;
-
- /**
- * Move Views in or out of the right edge of the scene.
- * @see #setSlideEdge(int)
- */
- public static final int RIGHT = 2;
-
- /**
- * Move Views in or out of the bottom edge of the scene. This is the
- * default slide direction.
- * @see #setSlideEdge(int)
- */
- public static final int BOTTOM = 3;
-
private static final TimeInterpolator sDecelerate = new DecelerateInterpolator();
private static final TimeInterpolator sAccelerate = new AccelerateInterpolator();
- private int[] mTempLoc = new int[2];
private CalculateSlide mSlideCalculator = sCalculateBottom;
private interface CalculateSlide {
@@ -136,11 +111,11 @@ public class Slide extends Visibility {
};
/**
- * Constructor using the default {@link android.transition.Slide#BOTTOM}
+ * Constructor using the default {@link Gravity#BOTTOM}
* slide edge direction.
*/
public Slide() {
- setSlideEdge(BOTTOM);
+ setSlideEdge(Gravity.BOTTOM);
}
/**
@@ -152,20 +127,22 @@ public class Slide extends Visibility {
/**
* Change the edge that Views appear and disappear from.
- * @param slideEdge The edge of the scene to use for Views appearing and disappearing.
+ * @param slideEdge The edge of the scene to use for Views appearing and disappearing. One of
+ * {@link android.view.Gravity#LEFT}, {@link android.view.Gravity#TOP},
+ * {@link android.view.Gravity#RIGHT}, {@link android.view.Gravity#BOTTOM}.
*/
public void setSlideEdge(int slideEdge) {
switch (slideEdge) {
- case LEFT:
+ case Gravity.LEFT:
mSlideCalculator = sCalculateLeft;
break;
- case TOP:
+ case Gravity.TOP:
mSlideCalculator = sCalculateTop;
break;
- case RIGHT:
+ case Gravity.RIGHT:
mSlideCalculator = sCalculateRight;
break;
- case BOTTOM:
+ case Gravity.BOTTOM:
mSlideCalculator = sCalculateBottom;
break;
default:
diff --git a/core/java/android/transition/Transition.java b/core/java/android/transition/Transition.java
index 9a7009928186..e9c2bba0c3a7 100644
--- a/core/java/android/transition/Transition.java
+++ b/core/java/android/transition/Transition.java
@@ -1763,7 +1763,7 @@ public abstract class Transition implements Cloneable {
/**
* Sets the callback to use to find the epicenter of a Transition. A null value indicates
- * that there is no epicenter in the Transition and getEpicenter() will return null.
+ * that there is no epicenter in the Transition and onGetEpicenter() will return null.
* Transitions like {@link android.transition.Explode} use a point or Rect to orient
* the direction of travel. This is called the epicenter of the Transition and is
* typically centered on a touched View. The
@@ -1799,7 +1799,7 @@ public abstract class Transition implements Cloneable {
if (mEpicenterCallback == null) {
return null;
}
- return mEpicenterCallback.getEpicenter(this);
+ return mEpicenterCallback.onGetEpicenter(this);
}
/**
@@ -2112,6 +2112,6 @@ public abstract class Transition implements Cloneable {
* @return The Rect region of the epicenter of <code>transition</code> or null if
* there is no epicenter.
*/
- public abstract Rect getEpicenter(Transition transition);
+ public abstract Rect onGetEpicenter(Transition transition);
}
}
diff --git a/core/java/android/transition/TransitionInflater.java b/core/java/android/transition/TransitionInflater.java
index f4b562f58808..5b7c7379d093 100644
--- a/core/java/android/transition/TransitionInflater.java
+++ b/core/java/android/transition/TransitionInflater.java
@@ -22,6 +22,7 @@ import android.content.res.TypedArray;
import android.content.res.XmlResourceParser;
import android.util.AttributeSet;
import android.util.Xml;
+import android.view.Gravity;
import android.view.InflateException;
import android.view.ViewGroup;
import android.view.animation.AnimationUtils;
@@ -208,7 +209,7 @@ public class TransitionInflater {
private Slide createSlideTransition(AttributeSet attrs) {
TypedArray a = mContext.obtainStyledAttributes(attrs,
com.android.internal.R.styleable.Slide);
- int edge = a.getInt(com.android.internal.R.styleable.Slide_slideEdge, Slide.BOTTOM);
+ int edge = a.getInt(com.android.internal.R.styleable.Slide_slideEdge, Gravity.BOTTOM);
Slide slide = new Slide(edge);
a.recycle();
return slide;