diff options
author | Chris Wren <cwren@android.com> | 2013-10-29 10:39:25 -0700 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2013-10-29 10:39:25 -0700 |
commit | f535a6aef04b9673a0f6748da0018b962833dd9e (patch) | |
tree | bb2493955605abd1c7ed7be7a14d3ce865f9acd2 /packages/Keyguard | |
parent | a4e1f4352149b15fa64e9b85928f0b1ba00486fb (diff) | |
parent | 5ab93d873f95256fdcddb8a78fa3c4a6697ec01a (diff) | |
download | frameworks_base-f535a6aef04b9673a0f6748da0018b962833dd9e.zip frameworks_base-f535a6aef04b9673a0f6748da0018b962833dd9e.tar.gz frameworks_base-f535a6aef04b9673a0f6748da0018b962833dd9e.tar.bz2 |
am 5ab93d87: Merge "reduce garbage generation in KeyguardTransportControlView." into klp-dev
* commit '5ab93d873f95256fdcddb8a78fa3c4a6697ec01a':
reduce garbage generation in KeyguardTransportControlView.
Diffstat (limited to 'packages/Keyguard')
-rw-r--r-- | packages/Keyguard/src/com/android/keyguard/KeyguardTransportControlView.java | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/packages/Keyguard/src/com/android/keyguard/KeyguardTransportControlView.java b/packages/Keyguard/src/com/android/keyguard/KeyguardTransportControlView.java index de26efb..8095ecf 100644 --- a/packages/Keyguard/src/com/android/keyguard/KeyguardTransportControlView.java +++ b/packages/Keyguard/src/com/android/keyguard/KeyguardTransportControlView.java @@ -92,6 +92,9 @@ public class KeyguardTransportControlView extends FrameLayout { private boolean mUserSeeking; private java.text.DateFormat mFormat; + private Date mTimeElapsed; + private Date mTimeRemaining; + /** * The metadata which should be populated into the view once we've been attached */ @@ -452,15 +455,19 @@ public class KeyguardTransportControlView extends FrameLayout { void updateSeekDisplay() { if (mMetadata != null && mRemoteController != null && mFormat != null) { - final long timeElapsed = mRemoteController.getEstimatedMediaPosition(); - final long duration = mMetadata.duration; - final long remaining = duration - timeElapsed; - - mTransientSeekTimeElapsed.setText(mFormat.format(new Date(timeElapsed))); - mTransientSeekTimeRemaining.setText(mFormat.format(new Date(remaining))); + if (mTimeElapsed == null) { + mTimeElapsed = new Date(); + } + if (mTimeRemaining == null) { + mTimeRemaining = new Date(); + } + mTimeElapsed.setTime(mRemoteController.getEstimatedMediaPosition()); + mTimeRemaining.setTime(mMetadata.duration - mTimeElapsed.getTime()); + mTransientSeekTimeElapsed.setText(mFormat.format(mTimeElapsed)); + mTransientSeekTimeRemaining.setText(mFormat.format(mTimeRemaining)); - if (DEBUG) Log.d(TAG, "updateSeekDisplay timeElapsed=" + timeElapsed + - " duration=" + duration + " remaining=" + remaining); + if (DEBUG) Log.d(TAG, "updateSeekDisplay timeElapsed=" + mTimeElapsed + + " duration=" + mMetadata.duration + " remaining=" + mTimeRemaining); } } |