diff --git a/core/api/current.txt b/core/api/current.txt
index 8e2d14fa28e57..163143155a115 100644
--- a/core/api/current.txt
+++ b/core/api/current.txt
@@ -573,6 +573,7 @@ package android {
field public static final int dropDownWidth = 16843362; // 0x1010262
field public static final int duplicateParentState = 16842985; // 0x10100e9
field public static final int duration = 16843160; // 0x1010198
+ field public static final int edgeEffectType = 16844329; // 0x1010629
field public static final int editTextBackground = 16843602; // 0x1010352
field public static final int editTextColor = 16843601; // 0x1010351
field public static final int editTextPreferenceStyle = 16842898; // 0x1010092
@@ -53561,6 +53562,7 @@ package android.widget {
method @Nullable public android.graphics.BlendMode getBlendMode();
method @ColorInt public int getColor();
method public int getMaxHeight();
+ method public int getType();
method public boolean isFinished();
method public void onAbsorb(int);
method public void onPull(float);
@@ -53569,7 +53571,10 @@ package android.widget {
method public void setBlendMode(@Nullable android.graphics.BlendMode);
method public void setColor(@ColorInt int);
method public void setSize(int, int);
+ method public void setType(int);
field public static final android.graphics.BlendMode DEFAULT_BLEND_MODE;
+ field public static final int TYPE_GLOW = 0; // 0x0
+ field public static final int TYPE_STRETCH = 1; // 0x1
}
public class EditText extends android.widget.TextView {
diff --git a/core/java/android/widget/EdgeEffect.java b/core/java/android/widget/EdgeEffect.java
index c10ffbee686ad..61ff36c09cb9a 100644
--- a/core/java/android/widget/EdgeEffect.java
+++ b/core/java/android/widget/EdgeEffect.java
@@ -17,6 +17,7 @@
package android.widget;
import android.annotation.ColorInt;
+import android.annotation.IntDef;
import android.annotation.Nullable;
import android.compat.annotation.UnsupportedAppUsage;
import android.content.Context;
@@ -30,6 +31,9 @@ import android.view.animation.AnimationUtils;
import android.view.animation.DecelerateInterpolator;
import android.view.animation.Interpolator;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
/**
* This class performs the graphical effect used at the edges of scrollable widgets
* when the user scrolls beyond the content bounds in 2D space.
@@ -55,6 +59,24 @@ public class EdgeEffect {
*/
public static final BlendMode DEFAULT_BLEND_MODE = BlendMode.SRC_ATOP;
+ /**
+ * Use a color edge glow for the edge effect. From XML, use
+ * android:edgeEffectType="glow".
+ */
+ public static final int TYPE_GLOW = 0;
+
+ /**
+ * Use a stretch for the edge effect. From XML, use
+ * android:edgeEffectType="stretch".
+ */
+ public static final int TYPE_STRETCH = 1;
+
+ /** @hide */
+ @IntDef({TYPE_GLOW, TYPE_STRETCH})
+ @Retention(RetentionPolicy.SOURCE)
+ public @interface EdgeEffectType {
+ }
+
@SuppressWarnings("UnusedDeclaration")
private static final String TAG = "EdgeEffect";
@@ -121,6 +143,7 @@ public class EdgeEffect {
private float mBaseGlowScale;
private float mDisplacement = 0.5f;
private float mTargetDisplacement = 0.5f;
+ private @EdgeEffectType int mEdgeEffectType = TYPE_GLOW;
/**
* Construct a new EdgeEffect with a theme appropriate for the provided context.
@@ -132,6 +155,8 @@ public class EdgeEffect {
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, TYPE_GLOW);
a.recycle();
mPaint.setColor((themeColor & 0xffffff) | 0x33000000);
mPaint.setStyle(Paint.Style.FILL);
@@ -308,6 +333,17 @@ public class EdgeEffect {
mPaint.setColor(color);
}
+ /**
+ * 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
@@ -333,6 +369,15 @@ public class EdgeEffect {
return mPaint.getColor();
}
+ /**
+ * 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
diff --git a/core/res/res/values/attrs.xml b/core/res/res/values/attrs.xml
index 586c99d76335e..aeb4fc468fe47 100644
--- a/core/res/res/values/attrs.xml
+++ b/core/res/res/values/attrs.xml
@@ -1140,6 +1140,15 @@
+
+
+
+
+
+
+
+
+
@@ -9050,6 +9059,7 @@
+