Remove edge effect type from the API. am: b1aee44bea

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/14390423

Change-Id: Icdc9197f2c67cf5cb9fe90f76359ecd3a8e8b644
This commit is contained in:
George Mount
2021-05-04 04:49:02 +00:00
committed by Automerger Merge Worker
10 changed files with 10 additions and 204 deletions

View File

@@ -586,7 +586,6 @@ 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;
field public static final int editTextBackground = 16843602; // 0x1010352
field public static final int editTextColor = 16843601; // 0x1010351
field public static final int editTextPreferenceStyle = 16842898; // 0x1010092
@@ -53791,7 +53790,6 @@ package android.widget {
method public int getCheckedItemPosition();
method public android.util.SparseBooleanArray getCheckedItemPositions();
method public int getChoiceMode();
method public int getEdgeEffectType();
method public int getListPaddingBottom();
method public int getListPaddingLeft();
method public int getListPaddingRight();
@@ -53833,7 +53831,6 @@ package android.widget {
method public void setChoiceMode(int);
method public void setDrawSelectorOnTop(boolean);
method public void setEdgeEffectColor(@ColorInt int);
method public void setEdgeEffectType(int);
method public void setFastScrollAlwaysVisible(boolean);
method public void setFastScrollEnabled(boolean);
method public void setFastScrollStyle(int);
@@ -54524,7 +54521,6 @@ package android.widget {
method @ColorInt public int getColor();
method public float getDistance();
method public int getMaxHeight();
method public int getType();
method public boolean isFinished();
method public void onAbsorb(int);
method public void onPull(float);
@@ -54534,10 +54530,7 @@ 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 {
@@ -54842,7 +54835,6 @@ package android.widget {
method public boolean executeKeyEvent(android.view.KeyEvent);
method public void fling(int);
method public boolean fullScroll(int);
method public int getEdgeEffectType();
method @ColorInt public int getLeftEdgeEffectColor();
method public int getMaxScrollAmount();
method @ColorInt public int getRightEdgeEffectColor();
@@ -54850,7 +54842,6 @@ package android.widget {
method public boolean isSmoothScrollingEnabled();
method public boolean pageScroll(int);
method public void setEdgeEffectColor(@ColorInt int);
method public void setEdgeEffectType(int);
method public void setFillViewport(boolean);
method public void setLeftEdgeEffectColor(@ColorInt int);
method public void setRightEdgeEffectColor(@ColorInt int);
@@ -55736,7 +55727,6 @@ package android.widget {
method public void fling(int);
method public boolean fullScroll(int);
method @ColorInt public int getBottomEdgeEffectColor();
method public int getEdgeEffectType();
method public int getMaxScrollAmount();
method @ColorInt public int getTopEdgeEffectColor();
method public boolean isFillViewport();
@@ -55745,7 +55735,6 @@ package android.widget {
method public void scrollToDescendant(@NonNull android.view.View);
method public void setBottomEdgeEffectColor(@ColorInt int);
method public void setEdgeEffectColor(@ColorInt int);
method public void setEdgeEffectType(int);
method public void setFillViewport(boolean);
method public void setSmoothScrollingEnabled(boolean);
method public void setTopEdgeEffectColor(@ColorInt int);

View File

@@ -6613,27 +6613,6 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te
return mEdgeGlowBottom.getColor();
}
/**
* 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

View File

@@ -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
*/
@@ -72,35 +70,20 @@ public class EdgeEffect {
@EnabledSince(targetSdkVersion = Build.VERSION_CODES.BASE)
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);
@@ -505,17 +480,6 @@ 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
@@ -541,16 +505,6 @@ 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
* (generated by a drawing command) are composited with the destination pixels
@@ -568,7 +522,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 +640,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() {

View File

@@ -307,27 +307,6 @@ public class HorizontalScrollView extends FrameLayout {
return mEdgeGlowRight.getColor();
}
/**
* 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.

View File

@@ -339,27 +339,6 @@ public class ScrollView extends FrameLayout {
return mEdgeGlowBottom.getColor();
}
/**
* 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);

View File

@@ -16,16 +16,10 @@
package com.android.internal.widget;
import static android.widget.EdgeEffect.TYPE_GLOW;
import static android.widget.EdgeEffect.TYPE_STRETCH;
import static android.widget.EdgeEffect.USE_STRETCH_EDGE_EFFECT_BY_DEFAULT;
import static android.widget.EdgeEffect.USE_STRETCH_EDGE_EFFECT_FOR_SUPPORTED;
import android.annotation.CallSuper;
import android.annotation.IntDef;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.compat.Compatibility;
import android.compat.annotation.UnsupportedAppUsage;
import android.content.Context;
import android.content.res.TypedArray;
@@ -466,8 +460,6 @@ public class RecyclerView extends ViewGroup implements ScrollingView, NestedScro
private final int[] mScrollConsumed = new int[2];
private final int[] mNestedOffsets = new int[2];
private int mEdgeEffectType;
/**
* These are views that had their a11y importance changed during a layout. We defer these events
* until the end of the layout because a11y service may make sync calls back to the RV while
@@ -595,12 +587,8 @@ public class RecyclerView extends ViewGroup implements ScrollingView, NestedScro
setDescendantFocusability(ViewGroup.FOCUS_AFTER_DESCENDANTS);
}
boolean defaultToStretch = Compatibility.isChangeEnabled(USE_STRETCH_EDGE_EFFECT_BY_DEFAULT)
|| Compatibility.isChangeEnabled(USE_STRETCH_EDGE_EFFECT_FOR_SUPPORTED);
TypedArray a = context.obtainStyledAttributes(attrs,
com.android.internal.R.styleable.EdgeEffect);
mEdgeEffectType = a.getInt(com.android.internal.R.styleable.EdgeEffect_edgeEffectType,
defaultToStretch ? TYPE_STRETCH : TYPE_GLOW);
a.recycle();
// Re-set whether nested scrolling is enabled so that it is set on all API levels
@@ -625,28 +613,6 @@ public class RecyclerView extends ViewGroup implements ScrollingView, NestedScro
setAccessibilityDelegate(mAccessibilityDelegate);
}
/**
* Returns the {@link EdgeEffect#getType()} used for all EdgeEffects.
*
* @return @link EdgeEffect#getType()} used for all EdgeEffects.
*/
@EdgeEffect.EdgeEffectType
public int getEdgeEffectType() {
return mEdgeEffectType;
}
/**
* Sets the {@link EdgeEffect#getType()} used in all EdgeEffects.
* Any existing over-scroll effects are cleared and new effects are created as needed.
*
* @param type the {@link EdgeEffect#getType()} used in all EdgeEffects.
*/
public void setEdgeEffectType(@EdgeEffect.EdgeEffectType int type) {
mEdgeEffectType = type;
invalidateGlows();
invalidate();
}
/**
* Instantiate and set a LayoutManager, if specified in the attributes.
*/
@@ -2223,7 +2189,6 @@ public class RecyclerView extends ViewGroup implements ScrollingView, NestedScro
return;
}
mLeftGlow = new EdgeEffect(getContext());
mLeftGlow.setType(mEdgeEffectType);
if (mClipToPadding) {
mLeftGlow.setSize(getMeasuredHeight() - getPaddingTop() - getPaddingBottom(),
getMeasuredWidth() - getPaddingLeft() - getPaddingRight());
@@ -2237,7 +2202,6 @@ public class RecyclerView extends ViewGroup implements ScrollingView, NestedScro
return;
}
mRightGlow = new EdgeEffect(getContext());
mRightGlow.setType(mEdgeEffectType);
if (mClipToPadding) {
mRightGlow.setSize(getMeasuredHeight() - getPaddingTop() - getPaddingBottom(),
getMeasuredWidth() - getPaddingLeft() - getPaddingRight());
@@ -2251,7 +2215,6 @@ public class RecyclerView extends ViewGroup implements ScrollingView, NestedScro
return;
}
mTopGlow = new EdgeEffect(getContext());
mTopGlow.setType(mEdgeEffectType);
if (mClipToPadding) {
mTopGlow.setSize(getMeasuredWidth() - getPaddingLeft() - getPaddingRight(),
getMeasuredHeight() - getPaddingTop() - getPaddingBottom());
@@ -2266,7 +2229,6 @@ public class RecyclerView extends ViewGroup implements ScrollingView, NestedScro
return;
}
mBottomGlow = new EdgeEffect(getContext());
mBottomGlow.setType(mEdgeEffectType);
if (mClipToPadding) {
mBottomGlow.setSize(getMeasuredWidth() - getPaddingLeft() - getPaddingRight(),
getMeasuredHeight() - getPaddingTop() - getPaddingBottom());

View File

@@ -386,28 +386,6 @@ public class ViewPager extends ViewGroup {
}
}
/**
* 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() {
// Both left and right edge have the same edge effect type
return mLeftEdge.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) {
mLeftEdge.setType(type);
mRightEdge.setType(type);
invalidate();
}
/**
* Set a PagerAdapter that will supply views for this pager as needed.
*

View File

@@ -1179,15 +1179,6 @@
<!-- Color applied to effects. -->
<attr name="effectColor" format="color" />
<!-- The type of the edge effect. The default is glow. -->
<attr name="edgeEffectType">
<!-- Use a colored glow at the edge. -->
<enum name="glow" value="0" />
<!-- Stretch the content. -->
<enum name="stretch" value="1" />
</attr>
<!-- =================== -->
<!-- Lighting properties -->
<!-- =================== -->
@@ -9257,7 +9248,6 @@
<!-- Used as a filter array on the theme to pull out only the EdgeEffect-relevant bits. -->
<declare-styleable name="EdgeEffect">
<attr name="colorEdgeEffect" />
<attr name="edgeEffectType" />
</declare-styleable>
<!-- Use <code>tv-input</code> as the root tag of the XML resource that describes a

View File

@@ -3064,7 +3064,6 @@
<public name="hotwordDetectionService" />
<public name="previewLayout" />
<public name="clipToOutline" />
<public name="edgeEffectType" />
<public name="knownCerts" />
<public name="windowBackgroundBlurRadius"/>
<public name="windowSplashScreenBackground"/>

View File

@@ -16,7 +16,6 @@
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/scroll_view"
android:edgeEffectType="stretch"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<LinearLayout
@@ -26,7 +25,6 @@
<HorizontalScrollView
android:id="@+id/horizontal_scroll_view"
android:edgeEffectType="stretch"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout