summaryrefslogtreecommitdiffstats
path: root/packages/SystemUI/src
diff options
context:
space:
mode:
authorD4rKn3sSyS <jedga_95@outlook.com>2012-09-15 15:00:48 -0500
committerDanesh Mondegarian <daneshm90@gmail.com>2012-12-16 13:50:13 -0500
commit7ba230e3513ad0f47bc9b334cbdc3a0d380b8e3c (patch)
tree49386c865e97d535111414361362bd3f73d9fb7a /packages/SystemUI/src
parent10220eca785766b276d563e18717c1c3c2e385ea (diff)
downloadframeworks_base-7ba230e3513ad0f47bc9b334cbdc3a0d380b8e3c.zip
frameworks_base-7ba230e3513ad0f47bc9b334cbdc3a0d380b8e3c.tar.gz
frameworks_base-7ba230e3513ad0f47bc9b334cbdc3a0d380b8e3c.tar.bz2
"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
Diffstat (limited to 'packages/SystemUI/src')
-rw-r--r--packages/SystemUI/src/com/android/systemui/recent/RecentsHorizontalScrollView.java16
-rw-r--r--packages/SystemUI/src/com/android/systemui/recent/RecentsPanelView.java13
-rw-r--r--packages/SystemUI/src/com/android/systemui/recent/RecentsVerticalScrollView.java16
3 files changed, 44 insertions, 1 deletions
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) ||