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

Commit 9633b6cf authored by Isaac Katzenelson's avatar Isaac Katzenelson
Browse files

Hide fragements onPause

Bug: 8838745
Hide fragment's view in onPause to prevent showing stale time in onResume

Change-Id: I7f15fcc38a54ca0a8f48657ceeb2a54217157cc9
parent 0ab83ea7
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
@@ -354,11 +354,24 @@ public class StopwatchFragment extends DeskClockFragment
        }
        showLaps();
        ((DeskClock)getActivity()).registerPageChangedListener(this);
        // View was hidden in onPause, make sure it is visible now.
        View v = getView();
        if (v != null) {
            getView().setVisibility(View.VISIBLE);
        }
        super.onResume();
    }

    @Override
    public void onPause() {
        // This is called because the lock screen was activated, the window stay
        // active under it and when we unlock the screen, we see the old time for
        // a fraction of a second.
        View v = getView();
        if (v != null) {
            getView().setVisibility(View.INVISIBLE);
        }

        if (mState == Stopwatches.STOPWATCH_RUNNING) {
            stopUpdateThread();
        }
+12 −0
Original line number Diff line number Diff line
@@ -539,6 +539,11 @@ public class TimerFragment extends DeskClockFragment
        }
        mLastVisibleView = null;   // Force a non animation setting of the view
        setPage();
        // View was hidden in onPause, make sure it is visible now.
        View v = getView();
        if (v != null) {
            getView().setVisibility(View.VISIBLE);
        }
    }

    @Override
@@ -552,6 +557,13 @@ public class TimerFragment extends DeskClockFragment
            mAdapter.saveGlobalState ();
        }
        mPrefs.unregisterOnSharedPreferenceChangeListener(this);
        // This is called because the lock screen was activated, the window stay
        // active under it and when we unlock the screen, we see the old time for
        // a fraction of a second.
        View v = getView();
        if (v != null) {
            getView().setVisibility(View.INVISIBLE);
        }
    }

    @Override