From 25f9bef74ce0083007fe73d63503e5d10dd4c21f Mon Sep 17 00:00:00 2001 From: Veeti Paananen Date: Thu, 12 Jan 2017 21:18:03 +0200 Subject: [PATCH] Display elapsed voice recording time in user language Closes #6011 // FREEBIE --- src/org/thoughtcrime/securesms/components/InputPanel.java | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/org/thoughtcrime/securesms/components/InputPanel.java b/src/org/thoughtcrime/securesms/components/InputPanel.java index eff26a35f8..cd5d501b8e 100644 --- a/src/org/thoughtcrime/securesms/components/InputPanel.java +++ b/src/org/thoughtcrime/securesms/components/InputPanel.java @@ -8,6 +8,7 @@ import android.os.Handler; import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.support.v4.view.ViewCompat; +import android.text.format.DateUtils; import android.util.AttributeSet; import android.util.Log; import android.view.KeyEvent; @@ -293,7 +294,7 @@ public class InputPanel extends LinearLayout public void display() { this.startTime.set(System.currentTimeMillis()); - this.recordTimeView.setText("00:00"); + this.recordTimeView.setText(DateUtils.formatElapsedTime(0)); ViewUtil.fadeIn(this.recordTimeView, FADE_TIME); handler.postDelayed(this, TimeUnit.SECONDS.toMillis(1)); } @@ -310,10 +311,7 @@ public class InputPanel extends LinearLayout long localStartTime = startTime.get(); if (localStartTime > 0) { long elapsedTime = System.currentTimeMillis() - localStartTime; - recordTimeView.setText(String.format("%02d:%02d", - TimeUnit.MILLISECONDS.toMinutes(elapsedTime), - TimeUnit.MILLISECONDS.toSeconds(elapsedTime) - - TimeUnit.MINUTES.toSeconds(TimeUnit.MILLISECONDS.toMinutes(elapsedTime)))); + recordTimeView.setText(DateUtils.formatElapsedTime(TimeUnit.MILLISECONDS.toSeconds(elapsedTime)); handler.postDelayed(this, TimeUnit.SECONDS.toMillis(1)); } }