diff options
| author | David van Tonder <david.vantonder@gmail.com> | 2012-12-16 11:29:09 -0800 |
|---|---|---|
| committer | Gerrit Code Review <gerrit@review.cyanogenmod.com> | 2012-12-16 11:29:10 -0800 |
| commit | b99fc619b42087893745e712c90ce75f545a6715 (patch) | |
| tree | 1e47566460cd0fc9d57e2955514b16aba1b82f70 | |
| parent | 9efa2dedf3af329b542ece30fd51736bd005706c (diff) | |
| parent | 7ba230e3513ad0f47bc9b334cbdc3a0d380b8e3c (diff) | |
| download | frameworks_base-b99fc619b42087893745e712c90ce75f545a6715.zip frameworks_base-b99fc619b42087893745e712c90ce75f545a6715.tar.gz frameworks_base-b99fc619b42087893745e712c90ce75f545a6715.tar.bz2 | |
Merge ""Clear all" button on recent apps" into cm-10.1
6 files changed, 71 insertions, 1 deletions
diff --git a/packages/SystemUI/res/layout-land/status_bar_recent_panel.xml b/packages/SystemUI/res/layout-land/status_bar_recent_panel.xml index 8fdde92..337f5de 100644 --- a/packages/SystemUI/res/layout-land/status_bar_recent_panel.xml +++ b/packages/SystemUI/res/layout-land/status_bar_recent_panel.xml @@ -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" diff --git a/packages/SystemUI/res/layout/status_bar_recent_panel.xml b/packages/SystemUI/res/layout/status_bar_recent_panel.xml index 7335f86..698d3cc 100644 --- a/packages/SystemUI/res/layout/status_bar_recent_panel.xml +++ b/packages/SystemUI/res/layout/status_bar_recent_panel.xml @@ -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" diff --git a/packages/SystemUI/res/layout/system_bar_recent_panel.xml b/packages/SystemUI/res/layout/system_bar_recent_panel.xml index 3951bba..1a7bc58 100644 --- a/packages/SystemUI/res/layout/system_bar_recent_panel.xml +++ b/packages/SystemUI/res/layout/system_bar_recent_panel.xml @@ -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" diff --git a/packages/SystemUI/src/com/android/systemui/recent/RecentsHorizontalScrollView.java b/packages/SystemUI/src/com/android/systemui/recent/RecentsHorizontalScrollView.java index 6cb7dec..e436d5c 100644 --- a/packages/SystemUI/src/com/android/systemui/recent/RecentsHorizontalScrollView.java +++ b/packages/SystemUI/src/com/android/systemui/recent/RecentsHorizontalScrollView.java @@ -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) || diff --git a/packages/SystemUI/src/com/android/systemui/recent/RecentsPanelView.java b/packages/SystemUI/src/com/android/systemui/recent/RecentsPanelView.java index cd3bc42..dcb82d4 100644 --- a/packages/SystemUI/src/com/android/systemui/recent/RecentsPanelView.java +++ b/packages/SystemUI/src/com/android/systemui/recent/RecentsPanelView.java @@ -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) { diff --git a/packages/SystemUI/src/com/android/systemui/recent/RecentsVerticalScrollView.java b/packages/SystemUI/src/com/android/systemui/recent/RecentsVerticalScrollView.java index 47b0113..65f09b6 100644 --- a/packages/SystemUI/src/com/android/systemui/recent/RecentsVerticalScrollView.java +++ b/packages/SystemUI/src/com/android/systemui/recent/RecentsVerticalScrollView.java @@ -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; @@ -184,6 +185,21 @@ public class RecentsVerticalScrollView extends ScrollView 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) || |
