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

Commit e40e318b authored by Alan Viverette's avatar Alan Viverette Committed by android-build-merger
Browse files

Merge "resolve merge conflicts of f1187008 to nyc-dev-plus-aosp" into...

Merge "resolve merge conflicts of f1187008 to nyc-dev-plus-aosp" into nyc-dev-plus-aosp am: 9ab249be
am: 32148220

* commit '32148220':
  Chronometer: Update the value only if displayed on screen

Change-Id: Icf53d90ea83f54457b77bec28291efe92b4c1c88
parents 746a31fa 32148220
Loading
Loading
Loading
Loading
+9 −1
Original line number Diff line number Diff line
@@ -23,6 +23,8 @@ import android.os.SystemClock;
import android.text.format.DateUtils;
import android.util.AttributeSet;
import android.util.Log;
import android.view.View;
import android.view.accessibility.AccessibilityEvent;
import android.widget.RemoteViews.RemoteView;

import com.android.internal.R;
@@ -253,6 +255,12 @@ public class Chronometer extends TextView {
        updateRunning();
    }

    @Override
    protected void onVisibilityChanged(View changedView, int visibility) {
        super.onVisibilityChanged(changedView, visibility);
        updateRunning();
    }

    private synchronized void updateText(long now) {
        mNow = now;
        long seconds = mCountDown ? mBase - now : now - mBase;
@@ -289,7 +297,7 @@ public class Chronometer extends TextView {
    }

    private void updateRunning() {
        boolean running = mVisible && mStarted;
        boolean running = mVisible && mStarted && isShown();
        if (running != mRunning) {
            if (running) {
                updateText(SystemClock.elapsedRealtime());