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

Commit b99fc619 authored by David van Tonder's avatar David van Tonder Committed by Gerrit Code Review
Browse files

Merge ""Clear all" button on recent apps" into cm-10.1

parents 9efa2ded 7ba230e3
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