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

Commit c80ad99a authored by Alan Viverette's avatar Alan Viverette
Browse files

TouchFeedbackDrawable is now RippleDrawable

Change-Id: I59f5f04b73089215c6320560556ac21beb03db06
parent c9550f2c
Loading
Loading
Loading
Loading
+9 −35
Original line number Diff line number Diff line
@@ -10908,7 +10908,6 @@ package android.graphics.drawable {
    method public void applyTheme(android.content.res.Resources.Theme);
    method public boolean canApplyTheme();
    method public void clearColorFilter();
    method public void clearHotspots();
    method public final void copyBounds(android.graphics.Rect);
    method public final android.graphics.Rect copyBounds();
    method public static android.graphics.drawable.Drawable createFromPath(java.lang.String);
@@ -10951,7 +10950,6 @@ package android.graphics.drawable {
    method protected void onBoundsChange(android.graphics.Rect);
    method protected boolean onLevelChange(int);
    method protected boolean onStateChange(int[]);
    method public void removeHotspot(int);
    method public static int resolveOpacity(int, int);
    method public void scheduleSelf(java.lang.Runnable, long);
    method public abstract void setAlpha(int);
@@ -10964,11 +10962,11 @@ package android.graphics.drawable {
    method public void setColorFilter(int, android.graphics.PorterDuff.Mode);
    method public void setDither(boolean);
    method public void setFilterBitmap(boolean);
    method public void setHotspot(int, float, float);
    method public void setHotspot(float, float);
    method public void setHotspotBounds(int, int, int, int);
    method public final boolean setLevel(int);
    method public boolean setState(int[]);
    method public boolean setVisible(boolean, boolean);
    method public boolean supportsHotspots();
    method public void unscheduleSelf(java.lang.Runnable);
  }
@@ -11027,30 +11025,6 @@ package android.graphics.drawable {
    method public final void setVariablePadding(boolean);
  }
  public class DrawableWrapper extends android.graphics.drawable.Drawable implements android.graphics.drawable.Drawable.Callback {
    ctor public DrawableWrapper();
    method public void draw(android.graphics.Canvas);
    method public android.graphics.Rect getDirtyBounds();
    method protected final android.graphics.drawable.Drawable getDrawable();
    method public int getOpacity();
    method public final int[] getState();
    method public void invalidateDrawable(android.graphics.drawable.Drawable);
    method public void scheduleDrawable(android.graphics.drawable.Drawable, java.lang.Runnable, long);
    method public void setAlpha(int);
    method public final void setBounds(int, int, int, int);
    method public final void setBounds(android.graphics.Rect);
    method public void setColorFilter(android.graphics.ColorFilter);
    method protected void setConstantState(android.graphics.drawable.DrawableWrapper.WrapperState, android.content.res.Resources);
    method protected final void setDrawable(android.graphics.drawable.Drawable, android.content.res.Resources);
    method public final boolean setState(int[]);
    method public void setXfermode(android.graphics.Xfermode);
    method public void unscheduleDrawable(android.graphics.drawable.Drawable, java.lang.Runnable);
  }
  public static abstract class DrawableWrapper.WrapperState extends android.graphics.drawable.Drawable.ConstantState {
    method public int getChangingConfigurations();
  }
  public class GradientDrawable extends android.graphics.drawable.Drawable {
    ctor public GradientDrawable();
    ctor public GradientDrawable(android.graphics.drawable.GradientDrawable.Orientation, int[]);
@@ -11174,6 +11148,13 @@ package android.graphics.drawable {
    method public void setPicture(android.graphics.Picture);
  }
  public class RippleDrawable extends android.graphics.drawable.LayerDrawable {
    method public android.graphics.Rect getDirtyBounds();
    method public android.content.res.ColorStateList getTint();
    method public void setTint(android.content.res.ColorStateList);
    method public void setTintMode(android.graphics.PorterDuff.Mode);
  }
  public class RotateDrawable extends android.graphics.drawable.Drawable implements android.graphics.drawable.Drawable.Callback {
    ctor public RotateDrawable();
    method public void draw(android.graphics.Canvas);
@@ -11243,13 +11224,6 @@ package android.graphics.drawable {
    method public void addState(int[], android.graphics.drawable.Drawable);
  }
  public class TouchFeedbackDrawable extends android.graphics.drawable.LayerDrawable {
    method public android.graphics.Rect getDirtyBounds();
    method public android.content.res.ColorStateList getTint();
    method public void setTint(android.content.res.ColorStateList);
    method public void setTintMode(android.graphics.PorterDuff.Mode);
  }
  public class TransitionDrawable extends android.graphics.drawable.LayerDrawable implements android.graphics.drawable.Drawable.Callback {
    ctor public TransitionDrawable(android.graphics.drawable.Drawable[]);
    method public boolean isCrossFadeEnabled();
+21 −40
Original line number Diff line number Diff line
@@ -4789,7 +4789,10 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
     * @param v previous or the next focus holder, or null if none
     */
    private void manageFocusHotspot(boolean focused, View v) {
        if (mBackground != null && mBackground.supportsHotspots()) {
        if (mBackground == null) {
            return;
        }
        final Rect r = new Rect();
        if (!focused && v != null) {
            v.getBoundsOnScreen(r);
@@ -4802,12 +4805,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
        final float x = r.exactCenterX();
        final float y = r.exactCenterY();
            mBackground.setHotspot(R.attr.state_focused, x, y);
            if (!focused) {
                mBackground.removeHotspot(R.attr.state_focused);
            }
        }
        mBackground.setHotspot(x, y);
    }
    /**
@@ -6763,7 +6761,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
     */
    private void setPressed(boolean pressed, float x, float y) {
        if (pressed) {
            setHotspot(R.attr.state_pressed, x, y);
            setHotspot(x, y);
        }
        setPressed(pressed);
@@ -6787,10 +6785,6 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
            mPrivateFlags &= ~PFLAG_PRESSED;
        }
        if (!pressed) {
            clearHotspot(R.attr.state_pressed);
        }
        if (needsRefresh) {
            refreshDrawableState();
        }
@@ -9106,21 +9100,20 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
                        postDelayed(mPendingCheckForTap, ViewConfiguration.getTapTimeout());
                    } else {
                        // Not inside a scrolling container, so show the feedback right away
                        setHotspot(R.attr.state_pressed, x, y);
                        setHotspot(x, y);
                        setPressed(true);
                        checkForLongClick(0);
                    }
                    break;
                case MotionEvent.ACTION_CANCEL:
                    clearHotspot(R.attr.state_pressed);
                    setPressed(false);
                    removeTapCallback();
                    removeLongPressCallback();
                    break;
                case MotionEvent.ACTION_MOVE:
                    setHotspot(R.attr.state_pressed, x, y);
                    setHotspot(x, y);
                    // Be lenient about moving outside of buttons
                    if (!pointInView(x, y, mTouchSlop)) {
@@ -9142,17 +9135,9 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
        return false;
    }
    private void setHotspot(int id, float x, float y) {
        final Drawable bg = mBackground;
        if (bg != null && bg.supportsHotspots()) {
            bg.setHotspot(id, x, y);
        }
    }
    private void clearHotspot(int id) {
        final Drawable bg = mBackground;
        if (bg != null && bg.supportsHotspots()) {
            bg.removeHotspot(id);
    private void setHotspot(float x, float y) {
        if (mBackground != null) {
            mBackground.setHotspot(x, y);
        }
    }
@@ -12903,10 +12888,6 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
        mPrivateFlags &= ~PFLAG_CANCEL_NEXT_UP_EVENT;
        mPrivateFlags3 &= ~PFLAG3_IS_LAID_OUT;
        if (mBackground != null) {
            mBackground.clearHotspots();
        }
        removeUnsetPressCallback();
        removeLongPressCallback();
        removePerformClickCallback();
+4 −17
Original line number Diff line number Diff line
@@ -2502,22 +2502,16 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te
        positionSelector(position, sel);

        final Drawable selector = mSelector;
        if (selector != null && selector.supportsHotspots() && position != INVALID_POSITION) {
        if (selector != null && position != INVALID_POSITION) {
            final Rect bounds = mSelectorRect;
            final float x = bounds.exactCenterX();
            final float y = bounds.exactCenterY();
            selector.setHotspot(R.attr.state_focused, x, y);
            selector.setHotspot(x, y);
        }
    }

    void positionSelector(int position, View sel) {
        if (position != INVALID_POSITION) {
            if (mSelectorPosition != position) {
                final Drawable selector = mSelector;
                if (selector != null && selector.supportsHotspots()) {
                    selector.clearHotspots();
                }
            }
            mSelectorPosition = position;
        }

@@ -3245,9 +3239,7 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te
                                    ((TransitionDrawable) d).resetTransition();
                                }
                            }
                            if (d.supportsHotspots()) {
                                d.setHotspot(R.attr.state_pressed, x, y);
                            }
                            d.setHotspot(x, y);
                        }

                        if (longClickable) {
@@ -3783,9 +3775,7 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te
                                if (d != null && d instanceof TransitionDrawable) {
                                    ((TransitionDrawable) d).resetTransition();
                                }
                                if (mSelector.supportsHotspots()) {
                                    mSelector.setHotspot(R.attr.state_pressed, x, ev.getY());
                                }
                                mSelector.setHotspot(x, ev.getY());
                            }
                            if (mTouchModeReset != null) {
                                removeCallbacks(mTouchModeReset);
@@ -3797,9 +3787,6 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te
                                    mTouchMode = TOUCH_MODE_REST;
                                    child.setPressed(false);
                                    setPressed(false);
                                    if (mSelector != null && mSelector.supportsHotspots()) {
                                        mSelector.removeHotspot(R.attr.state_pressed);
                                    }
                                    if (!mDataChanged && !mIsDetaching && isAttachedToWindow()) {
                                        performClick.run();
                                    }
+5 −15
Original line number Diff line number Diff line
@@ -31,8 +31,6 @@ import android.view.ViewConfiguration;
import android.view.accessibility.AccessibilityEvent;
import android.view.accessibility.AccessibilityNodeInfo;

import com.android.internal.R;

public abstract class AbsSeekBar extends ProgressBar {
    private final Rect mTempRect = new Rect();

@@ -348,7 +346,7 @@ public abstract class AbsSeekBar extends ProgressBar {
        final int right = left + thumbWidth;

        final Drawable background = getBackground();
        if (background != null && background.supportsHotspots()) {
        if (background != null) {
            final Rect bounds = mThumb.getBounds();
            final int offsetX = mPaddingLeft - mThumbOffset;
            final int offsetY = mPaddingTop;
@@ -499,17 +497,10 @@ public abstract class AbsSeekBar extends ProgressBar {
        return true;
    }

    private void setHotspot(int id, float x, float y) {
        final Drawable bg = getBackground();
        if (bg != null && bg.supportsHotspots()) {
            bg.setHotspot(id, x, y);
        }
    }

    private void clearHotspot(int id) {
    private void setHotspot(float x, float y) {
        final Drawable bg = getBackground();
        if (bg != null && bg.supportsHotspots()) {
            bg.removeHotspot(id);
        if (bg != null) {
            bg.setHotspot(x, y);
        }
    }

@@ -541,7 +532,7 @@ public abstract class AbsSeekBar extends ProgressBar {
        final int max = getMax();
        progress += scale * max;

        setHotspot(R.attr.state_pressed, x, (int) event.getY());
        setHotspot(x, (int) event.getY());
        setProgress((int) progress, true);
    }

@@ -567,7 +558,6 @@ public abstract class AbsSeekBar extends ProgressBar {
     * canceled.
     */
    void onStopTrackingTouch() {
        clearHotspot(R.attr.state_pressed);
        mIsDragging = false;
    }

+1 −1
Original line number Diff line number Diff line
@@ -285,7 +285,7 @@ public abstract class CompoundButton extends Button implements Checkable {
            buttonDrawable.setBounds(left, top, right, bottom);

            final Drawable background = getBackground();
            if (background != null && background.supportsHotspots()) {
            if (background != null) {
                background.setHotspotBounds(left, top, right, bottom);
            }
        }
Loading