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

Commit 5571ab2d authored by Michael Jurka's avatar Michael Jurka
Browse files

Fix recents button on large devices (5490265)

- Also, delay preloading recents so that we get haptic feedback immediately (5507038)

Change-Id: I8a22ad719493bd9cfec0ef56d09949b164c1451b
parent 27812a8f
Loading
Loading
Loading
Loading
+22 −4
Original line number Diff line number Diff line
@@ -75,6 +75,7 @@ public class RecentsPanelView extends RelativeLayout implements OnItemClickListe

    private RecentTasksLoader mRecentTasksLoader;
    private ArrayList<TaskDescription> mRecentTaskDescriptions;
    private Runnable mPreloadTasksRunnable;
    private boolean mRecentTasksDirty = true;
    private TaskDescriptionAdapter mListAdapter;
    private int mThumbnailWidth;
@@ -198,10 +199,16 @@ public class RecentsPanelView extends RelativeLayout implements OnItemClickListe
            } else {
                if (noApps) {
                    if (DEBUG) Log.v(TAG, "Nothing to show");
                    // Need to set recent tasks to dirty so that next time we load, we
                    // refresh the list of tasks
                    mRecentTasksLoader.cancelLoadingThumbnails();
                    mRecentTasksDirty = true;
                    return;
                }
            }
        } else {
            // Need to set recent tasks to dirty so that next time we load, we
            // refresh the list of tasks
            mRecentTasksLoader.cancelLoadingThumbnails();
            mRecentTasksDirty = true;
        }
@@ -361,6 +368,13 @@ public class RecentsPanelView extends RelativeLayout implements OnItemClickListe
        if (mRecentsScrim != null && mRecentsScrim.getBackground() instanceof BitmapDrawable) {
            ((BitmapDrawable) mRecentsScrim.getBackground()).setTileModeY(TileMode.REPEAT);
        }

        mPreloadTasksRunnable = new Runnable() {
            public void run() {
                setVisibility(INVISIBLE);
                refreshRecentTasksList();
            }
        };
    }

    private void createCustomAnimations(LayoutTransition transitioner) {
@@ -446,14 +460,18 @@ public class RecentsPanelView extends RelativeLayout implements OnItemClickListe
        if (!mShowing) {
            int action = ev.getAction() & MotionEvent.ACTION_MASK;
            if (action == MotionEvent.ACTION_DOWN) {
                // If we set our visibility to INVISIBLE here, we avoid an extra call to onLayout
                // later when we become visible
                setVisibility(INVISIBLE);
                refreshRecentTasksList();
                // If we set our visibility to INVISIBLE here, we avoid an extra call to
                // onLayout later when we become visible (because onLayout is always called
                // when going from GONE)
                post(mPreloadTasksRunnable);
            } else if (action == MotionEvent.ACTION_CANCEL) {
                setVisibility(GONE);
                clearRecentTasksList();
                // Remove the preloader if we haven't called it yet
                removeCallbacks(mPreloadTasksRunnable);
            } else if (action == MotionEvent.ACTION_UP) {
                // Remove the preloader if we haven't called it yet
                removeCallbacks(mPreloadTasksRunnable);
                if (!v.isPressed()) {
                    setVisibility(GONE);
                    clearRecentTasksList();
+2 −3
Original line number Diff line number Diff line
@@ -1262,9 +1262,8 @@ public class TabletStatusBar extends StatusBar implements
    public void onClickRecentButton() {
        if (DEBUG) Slog.d(TAG, "clicked recent apps; disabled=" + mDisabled);
        if ((mDisabled & StatusBarManager.DISABLE_EXPAND) == 0) {
            int msg = (mRecentsPanel.getVisibility() == View.GONE)
                ? MSG_OPEN_RECENTS_PANEL
                : MSG_CLOSE_RECENTS_PANEL;
            int msg = (mRecentsPanel.getVisibility() == View.VISIBLE)
                ? MSG_CLOSE_RECENTS_PANEL : MSG_OPEN_RECENTS_PANEL;
            mHandler.removeMessages(msg);
            mHandler.sendEmptyMessage(msg);
        }