Skip to content

Commit

Permalink
Merge ""Clear all" button on recent apps" into cm-10.1
Browse files Browse the repository at this point in the history
  • Loading branch information
DvTonder authored and Gerrit Code Review committed Dec 16, 2012
2 parents 9efa2de + 7ba230e commit b99fc61
Show file tree
Hide file tree
Showing 6 changed files with 71 additions and 1 deletion.
9 changes: 9 additions & 0 deletions packages/SystemUI/res/layout-land/status_bar_recent_panel.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
9 changes: 9 additions & 0 deletions packages/SystemUI/res/layout/status_bar_recent_panel.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
9 changes: 9 additions & 0 deletions packages/SystemUI/res/layout/system_bar_recent_panel.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
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;
Expand Down Expand Up @@ -176,6 +177,21 @@ public void removeViewInLayout(final View view) {
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) ||
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -330,7 +331,7 @@ private void showImpl(boolean show) {
&& (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);
Expand Down Expand Up @@ -434,6 +435,16 @@ protected void onFinishInflate() {
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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
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;
Expand Down Expand Up @@ -184,6 +185,21 @@ public void removeViewInLayout(final View view) {
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) ||
Expand Down

0 comments on commit b99fc61

Please sign in to comment.