am 2c9ce97c: Merge "API review: Constants to Gravity and Epicenter." into lmp-preview-dev
* commit '2c9ce97c340393cb9fcb49d4163ab7d40f434186': API review: Constants to Gravity and Epicenter.
This commit is contained in:
@@ -30498,20 +30498,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 {
|
||||
@@ -30565,7 +30557,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 {
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user