use of im.actor.sdk.controllers.calls.view.TimerActor in project actor-platform by actorapp.
the class CallFragment method startTimer.
protected void startTimer() {
final DateFormat formatter = new SimpleDateFormat("HH:mm:ss");
formatter.setTimeZone(TimeZone.getTimeZone("UTC"));
if (timer == null) {
timer = ActorSystem.system().actorOf(Props.create(() -> new TimerActor(300)), "calls/timer");
timer.send(new TimerActor.Register((currentTime, timeFromRegister) -> {
if (getActivity() != null) {
getActivity().runOnUiThread(() -> {
if (currentState == CallState.IN_PROGRESS) {
statusTV.setText(formatter.format(new Date(timeFromRegister)));
}
});
}
}, TIMER_ID));
}
}
Aggregations