Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d0d4bb84 authored by Michael Jurka's avatar Michael Jurka
Browse files

Fixing preloading recents for all devices

- Fixed for tablets and phones with hard nav buttons

Change-Id: I1dc2249376b3f376c283598f5cef6e326b191ace
parent 84819804
Loading
Loading
Loading
Loading
+11 −3
Original line number Diff line number Diff line
@@ -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)
+2 −16
Original line number Diff line number Diff line
@@ -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");
+1 −1
Original line number Diff line number Diff line
@@ -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();