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

Commit aaa71475 authored by Romain Guy's avatar Romain Guy Committed by Android (Google) Code Review
Browse files

Merge "Remove unnecessary framework allocations" into jb-dev

parents 139e5aa1 ab4c4f4f
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -9187,7 +9187,7 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal
    }
    public final boolean getLocalVisibleRect(Rect r) {
        Point offset = new Point();
        final Point offset = mAttachInfo != null ? mAttachInfo.mPoint : new Point();
        if (getGlobalVisibleRect(r, offset)) {
            r.offset(-offset.x, -offset.y); // make r local
            return true;
@@ -17023,6 +17023,11 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal
         */
        final boolean mDebugLayout = SystemProperties.getBoolean(DEBUG_LAYOUT_PROPERTY, false);
        /**
         * Point used to compute visible regions.
         */
        final Point mPoint = new Point();
        /**
         * Creates a new set of attachment information with the specified
         * events handler and thread.
+22 −14
Original line number Diff line number Diff line
@@ -211,6 +211,7 @@ public class ProgressBar extends View {
    private boolean mOnlyIndeterminate;
    private Transformation mTransformation;
    private AlphaAnimation mAnimation;
    private boolean mHasAnimation;
    private Drawable mIndeterminateDrawable;
    private Drawable mProgressDrawable;
    private Drawable mCurrentDrawable;
@@ -670,18 +671,14 @@ public class ProgressBar extends View {
        if (mUiThreadId == Thread.currentThread().getId()) {
            doRefreshProgress(id, progress, fromUser, true);
        } else {
            RefreshProgressRunnable r;
            if (mRefreshProgressRunnable != null) {
                // Use cached RefreshProgressRunnable if available
                r = mRefreshProgressRunnable;
            } else {
                // Make a new one
                r = new RefreshProgressRunnable();
            if (mRefreshProgressRunnable == null) {
                mRefreshProgressRunnable = new RefreshProgressRunnable();
            }

            final RefreshData rd = RefreshData.obtain(id, progress, fromUser);
            mRefreshData.add(rd);
            if (mAttached && !mRefreshIsPosted) {
                post(r);
                post(mRefreshProgressRunnable);
                mRefreshIsPosted = true;
            }
        }
@@ -860,14 +857,26 @@ public class ProgressBar extends View {

        if (mIndeterminateDrawable instanceof Animatable) {
            mShouldStartAnimationDrawable = true;
            mAnimation = null;
            mHasAnimation = false;
        } else {
            mHasAnimation = true;

            if (mInterpolator == null) {
                mInterpolator = new LinearInterpolator();
            }
    
            if (mTransformation == null) {
                mTransformation = new Transformation();
            } else {
                mTransformation.clear();
            }
            
            if (mAnimation == null) {
                mAnimation = new AlphaAnimation(0.0f, 1.0f);
            } else {
                mAnimation.reset();
            }

            mAnimation.setRepeatMode(mBehavior);
            mAnimation.setRepeatCount(Animation.INFINITE);
            mAnimation.setDuration(mDuration);
@@ -881,8 +890,7 @@ public class ProgressBar extends View {
     * <p>Stop the indeterminate progress animation.</p>
     */
    void stopAnimation() {
        mAnimation = null;
        mTransformation = null;
        mHasAnimation = false;
        if (mIndeterminateDrawable instanceof Animatable) {
            ((Animatable) mIndeterminateDrawable).stop();
            mShouldStartAnimationDrawable = false;
@@ -1030,7 +1038,7 @@ public class ProgressBar extends View {
            canvas.save();
            canvas.translate(mPaddingLeft, mPaddingTop);
            long time = getDrawingTime();
            if (mAnimation != null) {
            if (mHasAnimation) {
                mAnimation.getTransformation(time, mTransformation);
                float scale = mTransformation.getAlpha();
                try {