summaryrefslogtreecommitdiff
path: root/core/java/android
diff options
context:
space:
mode:
authorNader Jawad <njawad@google.com>2021-05-04 04:41:04 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2021-05-04 04:41:04 +0000
commitd8f57c7cf37298beb7792629acc88d608dd0b838 (patch)
treee44e2515076b476bd476307c4bc9970efcc8a079 /core/java/android
parent0f2aea790327202e2cc1727872d3e5fff5e9b470 (diff)
parent07406f36423bdb9bad7d12d82193c745b257d189 (diff)
Merge changes from topic "fling_after_pull" into sc-dev
* changes: Allow EdgeEffect to fling during pull Remove edge effect type from the API.
Diffstat (limited to 'core/java/android')
-rw-r--r--core/java/android/widget/AbsListView.java21
-rw-r--r--core/java/android/widget/EdgeEffect.java67
-rw-r--r--core/java/android/widget/HorizontalScrollView.java21
-rw-r--r--core/java/android/widget/ScrollView.java22
4 files changed, 10 insertions, 121 deletions
diff --git a/core/java/android/widget/AbsListView.java b/core/java/android/widget/AbsListView.java
index eb16cef15248..b3f848b4cf22 100644
--- a/core/java/android/widget/AbsListView.java
+++ b/core/java/android/widget/AbsListView.java
@@ -6614,27 +6614,6 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te
}
/**
- * Returns the {@link EdgeEffect#getType()} for the edge effects.
- * @return the {@link EdgeEffect#getType()} for the edge effects.
- * @attr ref android.R.styleable#EdgeEffect_edgeEffectType
- */
- @EdgeEffect.EdgeEffectType
- public int getEdgeEffectType() {
- return mEdgeGlowTop.getType();
- }
-
- /**
- * Sets the {@link EdgeEffect#setType(int)} for the edge effects.
- * @param type The edge effect type to use for the edge effects.
- * @attr ref android.R.styleable#EdgeEffect_edgeEffectType
- */
- public void setEdgeEffectType(@EdgeEffect.EdgeEffectType int type) {
- mEdgeGlowTop.setType(type);
- mEdgeGlowBottom.setType(type);
- invalidate();
- }
-
- /**
* Sets the recycler listener to be notified whenever a View is set aside in
* the recycler for later reuse. This listener can be used to free resources
* associated to the View.
diff --git a/core/java/android/widget/EdgeEffect.java b/core/java/android/widget/EdgeEffect.java
index 4d2d9e86f1a6..c11344ebaece 100644
--- a/core/java/android/widget/EdgeEffect.java
+++ b/core/java/android/widget/EdgeEffect.java
@@ -62,9 +62,7 @@ import java.lang.annotation.RetentionPolicy;
*/
public class EdgeEffect {
/**
- * This sets the default value for {@link #setType(int)} to {@link #TYPE_STRETCH} instead
- * of {@link #TYPE_GLOW}. The type can still be overridden by the theme, view attribute,
- * or by calling {@link #setType(int)}.
+ * This sets the edge effect to use stretch instead of glow.
*
* @hide
*/
@@ -73,34 +71,19 @@ public class EdgeEffect {
public static final long USE_STRETCH_EDGE_EFFECT_BY_DEFAULT = 171228096L;
/**
- * This sets the default value for {@link #setType(int)} to {@link #TYPE_STRETCH} instead
- * of {@link #TYPE_GLOW} for views that instantiate with
- * {@link #EdgeEffect(Context, AttributeSet)}, indicating use of S+ EdgeEffect support. The
- * type can still be overridden by the theme, view attribute, or by calling
- * {@link #setType(int)}.
- *
- * @hide
- */
- @ChangeId
- @EnabledSince(targetSdkVersion = Build.VERSION_CODES.S)
- public static final long USE_STRETCH_EDGE_EFFECT_FOR_SUPPORTED = 178807038L;
-
- /**
* The default blend mode used by {@link EdgeEffect}.
*/
public static final BlendMode DEFAULT_BLEND_MODE = BlendMode.SRC_ATOP;
/**
- * Use a color edge glow for the edge effect. From XML, use
- * <code>android:edgeEffectType="glow"</code>.
+ * Use a color edge glow for the edge effect.
*/
- public static final int TYPE_GLOW = 0;
+ private static final int TYPE_GLOW = 0;
/**
- * Use a stretch for the edge effect. From XML, use
- * <code>android:edgeEffectType="stretch"</code>.
+ * Use a stretch for the edge effect.
*/
- public static final int TYPE_STRETCH = 1;
+ private static final int TYPE_STRETCH = 1;
/**
* The velocity threshold before the spring animation is considered settled.
@@ -221,7 +204,7 @@ public class EdgeEffect {
* @param context Context used to provide theming and resource information for the EdgeEffect
*/
public EdgeEffect(Context context) {
- this(context, null, Compatibility.isChangeEnabled(USE_STRETCH_EDGE_EFFECT_BY_DEFAULT));
+ this(context, null);
}
/**
@@ -230,20 +213,12 @@ public class EdgeEffect {
* @param attrs The attributes of the XML tag that is inflating the view
*/
public EdgeEffect(@NonNull Context context, @Nullable AttributeSet attrs) {
- this(context, attrs,
- Compatibility.isChangeEnabled(USE_STRETCH_EDGE_EFFECT_BY_DEFAULT)
- || Compatibility.isChangeEnabled(USE_STRETCH_EDGE_EFFECT_FOR_SUPPORTED));
- }
-
- private EdgeEffect(@NonNull Context context, @Nullable AttributeSet attrs,
- boolean defaultStretch) {
final TypedArray a = context.obtainStyledAttributes(
attrs, com.android.internal.R.styleable.EdgeEffect);
final int themeColor = a.getColor(
com.android.internal.R.styleable.EdgeEffect_colorEdgeEffect, 0xff666666);
- mEdgeEffectType = a.getInt(
- com.android.internal.R.styleable.EdgeEffect_edgeEffectType,
- defaultStretch ? TYPE_STRETCH : TYPE_GLOW);
+ mEdgeEffectType = Compatibility.isChangeEnabled(USE_STRETCH_EDGE_EFFECT_BY_DEFAULT)
+ ? TYPE_STRETCH : TYPE_GLOW;
a.recycle();
mPaint.setAntiAlias(true);
@@ -467,7 +442,6 @@ public class EdgeEffect {
if (mEdgeEffectType == TYPE_STRETCH) {
mState = STATE_RECEDE;
mVelocity = velocity * ON_ABSORB_VELOCITY_ADJUSTMENT;
- mDistance = 0;
mStartTime = AnimationUtils.currentAnimationTimeMillis();
} else {
mState = STATE_ABSORB;
@@ -506,17 +480,6 @@ public class EdgeEffect {
}
/**
- * Sets the edge effect type to use. The default without a theme attribute set is
- * {@link EdgeEffect#TYPE_GLOW}.
- *
- * @param type The edge effect type to use.
- * @attr ref android.R.styleable#EdgeEffect_edgeEffectType
- */
- public void setType(@EdgeEffectType int type) {
- mEdgeEffectType = type;
- }
-
- /**
* Set or clear the blend mode. A blend mode defines how source pixels
* (generated by a drawing command) are composited with the destination pixels
* (content of the render target).
@@ -542,16 +505,6 @@ public class EdgeEffect {
}
/**
- * Return the edge effect type to use.
- *
- * @return The edge effect type to use.
- * @attr ref android.R.styleable#EdgeEffect_edgeEffectType
- */
- public @EdgeEffectType int getType() {
- return mEdgeEffectType;
- }
-
- /**
* Returns the blend mode. A blend mode defines how source pixels
* (generated by a drawing command) are composited with the destination pixels
* (content of the render target).
@@ -568,7 +521,7 @@ public class EdgeEffect {
* Draw into the provided canvas. Assumes that the canvas has been rotated
* accordingly and the size has been set. The effect will be drawn the full
* width of X=0 to X=width, beginning from Y=0 and extending to some factor <
- * 1.f of height. The {@link #TYPE_STRETCH} effect will only be visible on a
+ * 1.f of height. The effect will only be visible on a
* hardware canvas, e.g. {@link RenderNode#beginRecording()}.
*
* @param canvas Canvas to draw into
@@ -686,7 +639,7 @@ public class EdgeEffect {
* @return The maximum height of the edge effect
*/
public int getMaxHeight() {
- return (int) (mBounds.height() * MAX_GLOW_SCALE + 0.5f);
+ return (int) mHeight;
}
private void update() {
diff --git a/core/java/android/widget/HorizontalScrollView.java b/core/java/android/widget/HorizontalScrollView.java
index e41893e37103..018cba7f95e5 100644
--- a/core/java/android/widget/HorizontalScrollView.java
+++ b/core/java/android/widget/HorizontalScrollView.java
@@ -308,27 +308,6 @@ public class HorizontalScrollView extends FrameLayout {
}
/**
- * Returns the {@link EdgeEffect#getType()} for the edge effects.
- * @return the {@link EdgeEffect#getType()} for the edge effects.
- * @attr ref android.R.styleable#EdgeEffect_edgeEffectType
- */
- @EdgeEffect.EdgeEffectType
- public int getEdgeEffectType() {
- return mEdgeGlowLeft.getType();
- }
-
- /**
- * Sets the {@link EdgeEffect#setType(int)} for the edge effects.
- * @param type The edge effect type to use for the edge effects.
- * @attr ref android.R.styleable#EdgeEffect_edgeEffectType
- */
- public void setEdgeEffectType(@EdgeEffect.EdgeEffectType int type) {
- mEdgeGlowRight.setType(type);
- mEdgeGlowLeft.setType(type);
- invalidate();
- }
-
- /**
* @return The maximum amount this scroll view will scroll in response to
* an arrow event.
*/
diff --git a/core/java/android/widget/ScrollView.java b/core/java/android/widget/ScrollView.java
index 3610eb47edbc..693b13bbf224 100644
--- a/core/java/android/widget/ScrollView.java
+++ b/core/java/android/widget/ScrollView.java
@@ -340,27 +340,6 @@ public class ScrollView extends FrameLayout {
}
/**
- * Returns the {@link EdgeEffect#getType()} for the edge effects.
- * @return the {@link EdgeEffect#getType()} for the edge effects.
- * @attr ref android.R.styleable#EdgeEffect_edgeEffectType
- */
- @EdgeEffect.EdgeEffectType
- public int getEdgeEffectType() {
- return mEdgeGlowTop.getType();
- }
-
- /**
- * Sets the {@link EdgeEffect#setType(int)} for the edge effects.
- * @param type The edge effect type to use for the edge effects.
- * @attr ref android.R.styleable#EdgeEffect_edgeEffectType
- */
- public void setEdgeEffectType(@EdgeEffect.EdgeEffectType int type) {
- mEdgeGlowTop.setType(type);
- mEdgeGlowBottom.setType(type);
- invalidate();
- }
-
- /**
* @return The maximum amount this scroll view will scroll in response to
* an arrow event.
*/
@@ -368,7 +347,6 @@ public class ScrollView extends FrameLayout {
return (int) (MAX_SCROLL_FACTOR * (mBottom - mTop));
}
-
private void initScrollView() {
mScroller = new OverScroller(getContext());
setFocusable(true);