Skip to content

Commit c4f09e0

Browse files
mikejurkaAndroid (Google) Code Review
authored andcommitted
Merge "Fix recents button on large devices (5490265)" into ics-mr1
2 parents d01b645 + 5571ab2 commit c4f09e0

File tree

2 files changed

+24
-7
lines changed

2 files changed

+24
-7
lines changed

packages/SystemUI/src/com/android/systemui/recent/RecentsPanelView.java

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ public class RecentsPanelView extends RelativeLayout implements OnItemClickListe
7575

7676
private RecentTasksLoader mRecentTasksLoader;
7777
private ArrayList<TaskDescription> mRecentTaskDescriptions;
78+
private Runnable mPreloadTasksRunnable;
7879
private boolean mRecentTasksDirty = true;
7980
private TaskDescriptionAdapter mListAdapter;
8081
private int mThumbnailWidth;
@@ -198,10 +199,16 @@ public void show(boolean show, boolean animate,
198199
} else {
199200
if (noApps) {
200201
if (DEBUG) Log.v(TAG, "Nothing to show");
202+
// Need to set recent tasks to dirty so that next time we load, we
203+
// refresh the list of tasks
204+
mRecentTasksLoader.cancelLoadingThumbnails();
205+
mRecentTasksDirty = true;
201206
return;
202207
}
203208
}
204209
} else {
210+
// Need to set recent tasks to dirty so that next time we load, we
211+
// refresh the list of tasks
205212
mRecentTasksLoader.cancelLoadingThumbnails();
206213
mRecentTasksDirty = true;
207214
}
@@ -361,6 +368,13 @@ public void onClick(View v) {
361368
if (mRecentsScrim != null && mRecentsScrim.getBackground() instanceof BitmapDrawable) {
362369
((BitmapDrawable) mRecentsScrim.getBackground()).setTileModeY(TileMode.REPEAT);
363370
}
371+
372+
mPreloadTasksRunnable = new Runnable() {
373+
public void run() {
374+
setVisibility(INVISIBLE);
375+
refreshRecentTasksList();
376+
}
377+
};
364378
}
365379

366380
private void createCustomAnimations(LayoutTransition transitioner) {
@@ -446,14 +460,18 @@ public boolean onTouch(View v, MotionEvent ev) {
446460
if (!mShowing) {
447461
int action = ev.getAction() & MotionEvent.ACTION_MASK;
448462
if (action == MotionEvent.ACTION_DOWN) {
449-
// If we set our visibility to INVISIBLE here, we avoid an extra call to onLayout
450-
// later when we become visible
451-
setVisibility(INVISIBLE);
452-
refreshRecentTasksList();
463+
// If we set our visibility to INVISIBLE here, we avoid an extra call to
464+
// onLayout later when we become visible (because onLayout is always called
465+
// when going from GONE)
466+
post(mPreloadTasksRunnable);
453467
} else if (action == MotionEvent.ACTION_CANCEL) {
454468
setVisibility(GONE);
455469
clearRecentTasksList();
470+
// Remove the preloader if we haven't called it yet
471+
removeCallbacks(mPreloadTasksRunnable);
456472
} else if (action == MotionEvent.ACTION_UP) {
473+
// Remove the preloader if we haven't called it yet
474+
removeCallbacks(mPreloadTasksRunnable);
457475
if (!v.isPressed()) {
458476
setVisibility(GONE);
459477
clearRecentTasksList();

packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1262,9 +1262,8 @@ public void onClick(View v) {
12621262
public void onClickRecentButton() {
12631263
if (DEBUG) Slog.d(TAG, "clicked recent apps; disabled=" + mDisabled);
12641264
if ((mDisabled & StatusBarManager.DISABLE_EXPAND) == 0) {
1265-
int msg = (mRecentsPanel.getVisibility() == View.GONE)
1266-
? MSG_OPEN_RECENTS_PANEL
1267-
: MSG_CLOSE_RECENTS_PANEL;
1265+
int msg = (mRecentsPanel.getVisibility() == View.VISIBLE)
1266+
? MSG_CLOSE_RECENTS_PANEL : MSG_OPEN_RECENTS_PANEL;
12681267
mHandler.removeMessages(msg);
12691268
mHandler.sendEmptyMessage(msg);
12701269
}

0 commit comments

Comments
 (0)