Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d8f57c7c authored by Nader Jawad's avatar Nader Jawad Committed by Android (Google) Code Review
Browse files

Merge changes from topic "fling_after_pull" into sc-dev

* changes:
  Allow EdgeEffect to fling during pull
  Remove edge effect type from the API.
parents 0f2aea79 07406f36
Loading
Loading
Loading
Loading
+0 −11
Original line number Diff line number Diff line
@@ -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);
+0 −21
Original line number Diff line number Diff line
@@ -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
+10 −57
Original line number Diff line number Diff line
@@ -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);
@@ -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;
@@ -505,17 +479,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 +504,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 +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() {
+0 −21
Original line number Diff line number Diff line
@@ -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.
+0 −22
Original line number Diff line number Diff line
@@ -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);
Loading