mirror of
https://github.com/oxen-io/session-android.git
synced 2024-12-25 01:07:47 +00:00
Display elapsed voice recording time in user language
Closes #6011 // FREEBIE
This commit is contained in:
parent
4dae4444bc
commit
25f9bef74c
@ -8,6 +8,7 @@ import android.os.Handler;
|
|||||||
import android.support.annotation.NonNull;
|
import android.support.annotation.NonNull;
|
||||||
import android.support.annotation.Nullable;
|
import android.support.annotation.Nullable;
|
||||||
import android.support.v4.view.ViewCompat;
|
import android.support.v4.view.ViewCompat;
|
||||||
|
import android.text.format.DateUtils;
|
||||||
import android.util.AttributeSet;
|
import android.util.AttributeSet;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.KeyEvent;
|
import android.view.KeyEvent;
|
||||||
@ -293,7 +294,7 @@ public class InputPanel extends LinearLayout
|
|||||||
|
|
||||||
public void display() {
|
public void display() {
|
||||||
this.startTime.set(System.currentTimeMillis());
|
this.startTime.set(System.currentTimeMillis());
|
||||||
this.recordTimeView.setText("00:00");
|
this.recordTimeView.setText(DateUtils.formatElapsedTime(0));
|
||||||
ViewUtil.fadeIn(this.recordTimeView, FADE_TIME);
|
ViewUtil.fadeIn(this.recordTimeView, FADE_TIME);
|
||||||
handler.postDelayed(this, TimeUnit.SECONDS.toMillis(1));
|
handler.postDelayed(this, TimeUnit.SECONDS.toMillis(1));
|
||||||
}
|
}
|
||||||
@ -310,10 +311,7 @@ public class InputPanel extends LinearLayout
|
|||||||
long localStartTime = startTime.get();
|
long localStartTime = startTime.get();
|
||||||
if (localStartTime > 0) {
|
if (localStartTime > 0) {
|
||||||
long elapsedTime = System.currentTimeMillis() - localStartTime;
|
long elapsedTime = System.currentTimeMillis() - localStartTime;
|
||||||
recordTimeView.setText(String.format("%02d:%02d",
|
recordTimeView.setText(DateUtils.formatElapsedTime(TimeUnit.MILLISECONDS.toSeconds(elapsedTime));
|
||||||
TimeUnit.MILLISECONDS.toMinutes(elapsedTime),
|
|
||||||
TimeUnit.MILLISECONDS.toSeconds(elapsedTime) -
|
|
||||||
TimeUnit.MINUTES.toSeconds(TimeUnit.MILLISECONDS.toMinutes(elapsedTime))));
|
|
||||||
handler.postDelayed(this, TimeUnit.SECONDS.toMillis(1));
|
handler.postDelayed(this, TimeUnit.SECONDS.toMillis(1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user