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

Commit 2ab71c1e authored by Roman Birg's avatar Roman Birg
Browse files

SystemUI: fix qstile page reset timeout



When the user hasn't visisted the quick settings tile area for some time
(currently 10s), we need to reset the page back to the first one.

We can't go off whether we are listening to events because when the user
turns the screen off, listening is set to true, so the page would never
reset if the user turned their screen off.

We now key off whether we are expanded, which represents whether the
user is interacting with the panel.

Change-Id: I010aaa9e9ea84eb96308184dad606d47ce136748
Signed-off-by: default avatarRoman Birg <roman@cyngn.com>
parent 94c32d8b
Loading
Loading
Loading
Loading
+8 −7
Original line number Diff line number Diff line
@@ -121,9 +121,10 @@ public class QSDragPanel extends QSPanel implements View.OnDragListener, View.On
    private Runnable mResetPage = new Runnable() {
        @Override
        public void run() {
            if (!mListening) {
            if (!mExpanded) {
                // only reset when the user isn't interacting at all
                mViewPager.setCurrentItem(0);
                mPagerAdapter.notifyDataSetChanged();
            }
        }
    };
@@ -386,12 +387,6 @@ public class QSDragPanel extends QSPanel implements View.OnDragListener, View.On
    public void setListening(boolean listening) {
        if (mListening == listening) return;
        mListening = listening;
        // reset the page when inactive for a while
        if (listening) {
            removeCallbacks(mResetPage);
        } else {
            postDelayed(mResetPage, PAGE_RESET_DELAY);
        }
        for (TileRecord r : mRecords) {
            r.tile.setListening(mListening);
        }
@@ -1824,6 +1819,12 @@ public class QSDragPanel extends QSPanel implements View.OnDragListener, View.On
    @Override
    public void setExpanded(boolean expanded) {
        super.setExpanded(expanded);
        // reset the page when inactive for a while
        if (expanded) {
            removeCallbacks(mResetPage);
        } else {
            postDelayed(mResetPage, PAGE_RESET_DELAY);
        }
        if (!expanded) {
            if (mEditing) {
                mHost.setEditing(false);