am 5ab93d87: Merge "reduce garbage generation in KeyguardTransportControlView." into klp-dev
* commit '5ab93d873f95256fdcddb8a78fa3c4a6697ec01a': reduce garbage generation in KeyguardTransportControlView.
This commit is contained in:
@@ -92,6 +92,9 @@ public class KeyguardTransportControlView extends FrameLayout {
|
|||||||
private boolean mUserSeeking;
|
private boolean mUserSeeking;
|
||||||
private java.text.DateFormat mFormat;
|
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
|
* 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() {
|
void updateSeekDisplay() {
|
||||||
if (mMetadata != null && mRemoteController != null && mFormat != null) {
|
if (mMetadata != null && mRemoteController != null && mFormat != null) {
|
||||||
final long timeElapsed = mRemoteController.getEstimatedMediaPosition();
|
if (mTimeElapsed == null) {
|
||||||
final long duration = mMetadata.duration;
|
mTimeElapsed = new Date();
|
||||||
final long remaining = duration - timeElapsed;
|
}
|
||||||
|
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));
|
||||||
|
|
||||||
mTransientSeekTimeElapsed.setText(mFormat.format(new Date(timeElapsed)));
|
if (DEBUG) Log.d(TAG, "updateSeekDisplay timeElapsed=" + mTimeElapsed +
|
||||||
mTransientSeekTimeRemaining.setText(mFormat.format(new Date(remaining)));
|
" duration=" + mMetadata.duration + " remaining=" + mTimeRemaining);
|
||||||
|
|
||||||
if (DEBUG) Log.d(TAG, "updateSeekDisplay timeElapsed=" + timeElapsed +
|
|
||||||
" duration=" + duration + " remaining=" + remaining);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user