From d0d4bb84595d48116b3751b14efbc39388a78882 Mon Sep 17 00:00:00 2001 From: Michael Jurka Date: Tue, 4 Sep 2012 06:25:50 -0700 Subject: Fixing preloading recents for all devices - Fixed for tablets and phones with hard nav buttons Change-Id: I1dc2249376b3f376c283598f5cef6e326b191ace --- .../com/android/systemui/recent/RecentTasksLoader.java | 14 +++++++++++--- .../com/android/systemui/statusbar/BaseStatusBar.java | 18 ++---------------- .../systemui/statusbar/tablet/TabletStatusBar.java | 2 +- 3 files changed, 14 insertions(+), 20 deletions(-) (limited to 'packages') diff --git a/packages/SystemUI/src/com/android/systemui/recent/RecentTasksLoader.java b/packages/SystemUI/src/com/android/systemui/recent/RecentTasksLoader.java index 2a225d9..11802dd 100644 --- a/packages/SystemUI/src/com/android/systemui/recent/RecentTasksLoader.java +++ b/packages/SystemUI/src/com/android/systemui/recent/RecentTasksLoader.java @@ -254,10 +254,9 @@ public class RecentTasksLoader implements View.OnTouchListener { public boolean onTouch(View v, MotionEvent ev) { int action = ev.getAction() & MotionEvent.ACTION_MASK; if (action == MotionEvent.ACTION_DOWN) { - mHandler.post(mPreloadTasksRunnable); + preloadRecentTasksList(); } else if (action == MotionEvent.ACTION_CANCEL) { - cancelLoadingThumbnailsAndIcons(); - mHandler.removeCallbacks(mPreloadTasksRunnable); + cancelPreloadingRecentTasksList(); } else if (action == MotionEvent.ACTION_UP) { // Remove the preloader if we haven't called it yet mHandler.removeCallbacks(mPreloadTasksRunnable); @@ -269,6 +268,15 @@ public class RecentTasksLoader implements View.OnTouchListener { return false; } + public void preloadRecentTasksList() { + mHandler.post(mPreloadTasksRunnable); + } + + public void cancelPreloadingRecentTasksList() { + cancelLoadingThumbnailsAndIcons(); + mHandler.removeCallbacks(mPreloadTasksRunnable); + } + public void cancelLoadingThumbnailsAndIcons(RecentsPanelView caller) { // Only oblige this request if it comes from the current RecentsPanel // (eg when you rotate, the old RecentsPanel request should be ignored) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java index 832cf88..97034bb 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java @@ -594,25 +594,11 @@ public abstract class BaseStatusBar extends SystemUI implements break; case MSG_PRELOAD_RECENT_APPS: if (DEBUG) Slog.d(TAG, "preloading recents"); - { - // TODO: - // need to implement this - //final RecentsPanelView recentsPanel = getRecentsPanel(); - //if (recentsPanel != null) { - //recentsPanel.preloadRecentTasksList(); - //} - } + getRecentTasksLoader().preloadRecentTasksList(); break; case MSG_CANCEL_PRELOAD_RECENT_APPS: if (DEBUG) Slog.d(TAG, "cancel preloading recents"); - { - // TODO: - // need to implement this - //final RecentsPanelView recentsPanel = getRecentsPanel(); - //if (recentsPanel != null) { - //recentsPanel.clearRecentTasksList(); - //} - } + getRecentTasksLoader().cancelPreloadingRecentTasksList(); break; case MSG_OPEN_SEARCH_PANEL: if (DEBUG) Slog.d(TAG, "opening search panel"); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java index 8ca3a9c..7153ec7 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java @@ -355,7 +355,7 @@ public class TabletStatusBar extends BaseStatusBar implements mWindowManager.addView(mCompatModePanel, lp); - //mRecentButton.setOnTouchListener(mRecentsPanel); //TODO: plumb this + mRecentButton.setOnTouchListener(getRecentTasksLoader()); mPile = (NotificationRowLayout)mNotificationPanel.findViewById(R.id.content); mPile.removeAllViews(); -- cgit v1.1