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

Commit d61f2271 authored by Jorim Jaggi's avatar Jorim Jaggi
Browse files

Remove dead code #6: Delete old recents implementation

Change-Id: I93b1257563d6352a54141bd4c90d2d4587782fd2
parent cd3b5b52
Loading
Loading
Loading
Loading
+0 −12
Original line number Diff line number Diff line
@@ -173,18 +173,6 @@
                android:excludeFromRecents="true">
        </activity>

        <activity android:name=".recent.RecentsActivity"
                android:label="@string/accessibility_desc_recent_apps"
                android:theme="@style/RecentsStyle"
                android:excludeFromRecents="true"
                android:launchMode="singleInstance"
                android:resumeWhilePausing="true"
                android:exported="true">
          <intent-filter>
            <action android:name="com.android.systemui.TOGGLE_RECENTS" />
          </intent-filter>
        </activity>

        <receiver
            android:name=".recent.RecentsPreloadReceiver"
            android:exported="false">
+1 −1
Original line number Diff line number Diff line
@@ -41,7 +41,7 @@ public class SystemUIApplication extends Application {
     */
    private final Class<?>[] SERVICES = new Class[] {
            com.android.systemui.keyguard.KeyguardViewMediator.class,
            com.android.systemui.recent.Recents.class,
            com.android.systemui.recents.Recents.class,
            com.android.systemui.volume.VolumeUI.class,
            com.android.systemui.statusbar.SystemBars.class,
            com.android.systemui.usb.StorageNotification.class,
+0 −40
Original line number Diff line number Diff line
/*
 * Copyright (C) 2013 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.android.systemui.recent;

import android.graphics.drawable.ColorDrawable;

public class ColorDrawableWithDimensions extends ColorDrawable {
    private int mWidth;
    private int mHeight;

    public ColorDrawableWithDimensions(int color, int width, int height) {
        super(color);
        mWidth = width;
        mHeight = height;
    }

    @Override
    public int getIntrinsicWidth() {
        return mWidth;
    }

    @Override
    public int getIntrinsicHeight() {
        return mHeight;
    }
}
+0 −25
Original line number Diff line number Diff line
/*
 * Copyright (C) 2011 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.android.systemui.recent;

public class Constants {
    static final int MAX_ESCAPE_ANIMATION_DURATION = 500; // in ms
    static final int SNAP_BACK_DURATION = 250; // in ms
    static final int ESCAPE_VELOCITY = 100; // speed of item required to "curate" it in dp/s
    public static float ALPHA_FADE_START = 0.8f; // fraction of thumbnail width where fade starts
    static final float ALPHA_FADE_END = 0.5f; // fraction of thumbnail width beyond which alpha->0
}
+0 −193
Original line number Diff line number Diff line
/*
 * Copyright (C) 2011 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.android.systemui.recent;

import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.LinearGradient;
import android.graphics.Matrix;
import android.graphics.Paint;
import android.graphics.Shader;
import android.util.AttributeSet;
import android.view.View;
import android.view.ViewConfiguration;
import android.widget.LinearLayout;

import com.android.systemui.R;

public class FadedEdgeDrawHelper {
    public static final boolean OPTIMIZE_SW_RENDERED_RECENTS = true;
    public static final boolean USE_DARK_FADE_IN_HW_ACCELERATED_MODE = true;
    private View mScrollView;

    private int mFadingEdgeLength;
    private boolean mIsVertical;
    private boolean mSoftwareRendered = false;
    private Paint mBlackPaint;
    private Paint mFadePaint;
    private Matrix mFadeMatrix;
    private LinearGradient mFade;

    public static FadedEdgeDrawHelper create(Context context,
            AttributeSet attrs, View scrollView, boolean isVertical) {
        boolean isTablet = context.getResources().
                getBoolean(R.bool.config_recents_interface_for_tablets);
        if (!isTablet && (OPTIMIZE_SW_RENDERED_RECENTS || USE_DARK_FADE_IN_HW_ACCELERATED_MODE)) {
            return new FadedEdgeDrawHelper(context, attrs, scrollView, isVertical);
        } else {
            return null;
        }
    }

    public FadedEdgeDrawHelper(Context context,
            AttributeSet attrs, View scrollView, boolean isVertical) {
        mScrollView = scrollView;
        TypedArray a = context.obtainStyledAttributes(attrs, com.android.internal.R.styleable.View);
        mFadingEdgeLength = a.getDimensionPixelSize(android.R.styleable.View_fadingEdgeLength,
                ViewConfiguration.get(context).getScaledFadingEdgeLength());
        mIsVertical = isVertical;
    }

    public void onAttachedToWindowCallback(
            LinearLayout layout, boolean hardwareAccelerated) {
        mSoftwareRendered = !hardwareAccelerated;
        if ((mSoftwareRendered && OPTIMIZE_SW_RENDERED_RECENTS)
                || USE_DARK_FADE_IN_HW_ACCELERATED_MODE) {
            mScrollView.setVerticalFadingEdgeEnabled(false);
            mScrollView.setHorizontalFadingEdgeEnabled(false);
        }
    }

    public void addViewCallback(View newLinearLayoutChild) {
        if (mSoftwareRendered && OPTIMIZE_SW_RENDERED_RECENTS) {
            final RecentsPanelView.ViewHolder holder =
                    (RecentsPanelView.ViewHolder) newLinearLayoutChild.getTag();
            holder.labelView.setDrawingCacheEnabled(true);
            holder.labelView.buildDrawingCache();
        }
    }

    public void drawCallback(Canvas canvas,
            int left, int right, int top, int bottom, int scrollX, int scrollY,
            float topFadingEdgeStrength, float bottomFadingEdgeStrength,
            float leftFadingEdgeStrength, float rightFadingEdgeStrength, int mPaddingTop) {

        if ((mSoftwareRendered && OPTIMIZE_SW_RENDERED_RECENTS)
                || USE_DARK_FADE_IN_HW_ACCELERATED_MODE) {
            if (mFadePaint == null) {
                mFadePaint = new Paint();
                mFadeMatrix = new Matrix();
                // use use a height of 1, and then wack the matrix each time we
                // actually use it.
                mFade = new LinearGradient(0, 0, 0, 1, 0xCC000000, 0, Shader.TileMode.CLAMP);
                // PULL OUT THIS CONSTANT
                mFadePaint.setShader(mFade);
            }

            // draw the fade effect
            boolean drawTop = false;
            boolean drawBottom = false;
            boolean drawLeft = false;
            boolean drawRight = false;

            float topFadeStrength = 0.0f;
            float bottomFadeStrength = 0.0f;
            float leftFadeStrength = 0.0f;
            float rightFadeStrength = 0.0f;

            final float fadeHeight = mFadingEdgeLength;
            int length = (int) fadeHeight;

            // clip the fade length if top and bottom fades overlap
            // overlapping fades produce odd-looking artifacts
            if (mIsVertical && (top + length > bottom - length)) {
                length = (bottom - top) / 2;
            }

            // also clip horizontal fades if necessary
            if (!mIsVertical && (left + length > right - length)) {
                length = (right - left) / 2;
            }

            if (mIsVertical) {
                topFadeStrength = Math.max(0.0f, Math.min(1.0f, topFadingEdgeStrength));
                drawTop = topFadeStrength * fadeHeight > 1.0f;
                bottomFadeStrength = Math.max(0.0f, Math.min(1.0f, bottomFadingEdgeStrength));
                drawBottom = bottomFadeStrength * fadeHeight > 1.0f;
            }

            if (!mIsVertical) {
                leftFadeStrength = Math.max(0.0f, Math.min(1.0f, leftFadingEdgeStrength));
                drawLeft = leftFadeStrength * fadeHeight > 1.0f;
                rightFadeStrength = Math.max(0.0f, Math.min(1.0f, rightFadingEdgeStrength));
                drawRight = rightFadeStrength * fadeHeight > 1.0f;
            }

            if (drawTop) {
                mFadeMatrix.setScale(1, fadeHeight * topFadeStrength);
                mFadeMatrix.postTranslate(left, top);
                mFade.setLocalMatrix(mFadeMatrix);
                mFadePaint.setShader(mFade);
                canvas.drawRect(left, top, right, top + length, mFadePaint);

                if (mBlackPaint == null) {
                    // Draw under the status bar at the top
                    mBlackPaint = new Paint();
                    mBlackPaint.setColor(0xFF000000);
                }
                canvas.drawRect(left, top - mPaddingTop, right, top, mBlackPaint);
            }

            if (drawBottom) {
                mFadeMatrix.setScale(1, fadeHeight * bottomFadeStrength);
                mFadeMatrix.postRotate(180);
                mFadeMatrix.postTranslate(left, bottom);
                mFade.setLocalMatrix(mFadeMatrix);
                mFadePaint.setShader(mFade);
                canvas.drawRect(left, bottom - length, right, bottom, mFadePaint);
            }

            if (drawLeft) {
                mFadeMatrix.setScale(1, fadeHeight * leftFadeStrength);
                mFadeMatrix.postRotate(-90);
                mFadeMatrix.postTranslate(left, top);
                mFade.setLocalMatrix(mFadeMatrix);
                mFadePaint.setShader(mFade);
                canvas.drawRect(left, top, left + length, bottom, mFadePaint);
            }

            if (drawRight) {
                mFadeMatrix.setScale(1, fadeHeight * rightFadeStrength);
                mFadeMatrix.postRotate(90);
                mFadeMatrix.postTranslate(right, top);
                mFade.setLocalMatrix(mFadeMatrix);
                mFadePaint.setShader(mFade);
                canvas.drawRect(right - length, top, right, bottom, mFadePaint);
            }
        }
    }

    public int getVerticalFadingEdgeLength() {
        return mFadingEdgeLength;
    }

    public int getHorizontalFadingEdgeLength() {
        return mFadingEdgeLength;
    }

}
Loading