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

Commit 7ba230e3 authored by D4rKn3sSyS's avatar D4rKn3sSyS Committed by Danesh Mondegarian
Browse files

"Clear all" button on recent apps

    Ported from ParanoidAndroid by zigackly:
    https://github.com/ParanoidAndroid/android_frameworks_base/commit/f8c44e6ef667a3ebe9b658f148fa78a8d4f9a8dd

    Add button to tablet layout ported from Codename Android by zigackly:
    https://github.com/CNA/android_frameworks_base/commit/8d259fe3588c261baa5a17c361255cf28cc82bfe

    Patch set 2: Make the layout consistent, with the button at the top right.

    Patch set 3: Remove the redundant use of removeTask()

    Patch set 4: Top right layout does not work in tablet mode: make it top left for tablets only.

    Patch set 5: Different implementation (No need to keep track of views) - Danesh M

    Patch set 6: Top left layout no longer works for tablet mode with new implementation.
                 Make it bottom left for tablets only.

Change-Id: Iceb86eef41160f1c17e51463b37fd97e27acfb2e

Conflicts:
	packages/SystemUI/res/layout-port/status_bar_recent_panel.xml
	packages/SystemUI/src/com/android/systemui/recent/RecentsPanelView.java

Change-Id: I5f3827299866a951e657ce64bea7c5f31c34ef9e
parent 10220eca
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -51,6 +51,15 @@

        </com.android.systemui.recent.RecentsHorizontalScrollView>

        <ImageView
            android:id="@+id/recents_clear"
            android:clickable="true"
            android:layout_width="50dp"
            android:layout_height="50dp"
            android:scaleType="center"
            android:layout_gravity="top|right"
            android:src="@drawable/ic_notify_clear" />

    </FrameLayout>

    <include layout="@layout/status_bar_no_recent_apps"
+9 −0
Original line number Diff line number Diff line
@@ -57,6 +57,15 @@

        </com.android.systemui.recent.RecentsVerticalScrollView>

        <ImageView
            android:id="@+id/recents_clear"
            android:clickable="true"
            android:layout_width="50dp"
            android:layout_height="50dp"
            android:scaleType="center"
            android:layout_gravity="top|right"
            android:src="@drawable/ic_notify_clear" />

    </FrameLayout>

    <include layout="@layout/status_bar_no_recent_apps"
+9 −0
Original line number Diff line number Diff line
@@ -61,6 +61,15 @@

        </com.android.systemui.recent.RecentsVerticalScrollView>

        <ImageView
            android:id="@+id/recents_clear"
            android:clickable="true"
            android:layout_width="50dp"
            android:layout_height="50dp"
            android:scaleType="center"
            android:layout_gravity="bottom|left"
            android:src="@drawable/ic_notify_clear" />

        <include layout="@layout/system_bar_no_recent_apps"
            android:id="@+id/recents_no_apps"
            android:layout_width="match_parent"
+16 −0
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@ import android.content.Context;
import android.content.res.Configuration;
import android.database.DataSetObserver;
import android.graphics.Canvas;
import android.os.Handler;
import android.util.AttributeSet;
import android.util.DisplayMetrics;
import android.util.FloatMath;
@@ -176,6 +177,21 @@ public class RecentsHorizontalScrollView extends HorizontalScrollView
        dismissChild(view);
    }

    @Override
    public void removeAllViewsInLayout() {
        smoothScrollTo(0, 0);
        int count = mLinearLayout.getChildCount();
        for (int i = 0; i < count; i++) {
            final View child = mLinearLayout.getChildAt(i);
            postDelayed(new Runnable() {
                @Override
                public void run() {
                    dismissChild(child);
                }
            }, i * 150);
        }
    }

    public boolean onInterceptTouchEvent(MotionEvent ev) {
        if (DEBUG) Log.v(TAG, "onInterceptTouchEvent()");
        return mSwipeHelper.onInterceptTouchEvent(ev) ||
+12 −1
Original line number Diff line number Diff line
@@ -88,6 +88,7 @@ public class RecentsPanelView extends FrameLayout implements OnItemClickListener
    private boolean mFitThumbnailToXY;
    private int mRecentItemLayoutId;
    private boolean mHighEndGfx;
    private ImageView mClearRecents;

    public static interface RecentsScrollView {
        public int numItemsInOneScreenful();
@@ -330,7 +331,7 @@ public class RecentsPanelView extends FrameLayout implements OnItemClickListener
                    && (mRecentTaskDescriptions.size() == 0);
            mRecentsNoApps.setAlpha(1f);
            mRecentsNoApps.setVisibility(noApps ? View.VISIBLE : View.INVISIBLE);

            mClearRecents.setVisibility(noApps ? View.GONE : View.VISIBLE);
            onAnimationEnd(null);
            setFocusable(true);
            setFocusableInTouchMode(true);
@@ -434,6 +435,16 @@ public class RecentsPanelView extends FrameLayout implements OnItemClickListener
        mRecentsScrim = findViewById(R.id.recents_bg_protect);
        mRecentsNoApps = findViewById(R.id.recents_no_apps);

        mClearRecents = (ImageView) findViewById(R.id.recents_clear);
        if (mClearRecents != null){
            mClearRecents.setOnClickListener(new OnClickListener() {
                @Override
                public void onClick(View v) {
                    mRecentsContainer.removeAllViewsInLayout();
                }
            });
        }

        if (mRecentsScrim != null) {
            mHighEndGfx = ActivityManager.isHighEndGfx();
            if (!mHighEndGfx) {
Loading