Search in sources :

Example 1 with TimerActor

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));
    }
}
Also used : BaseFragment(im.actor.sdk.controllers.BaseFragment) ImageButton(android.widget.ImageButton) Ringtone(android.media.Ringtone) PoisonPill(im.actor.runtime.actors.messages.PoisonPill) Bundle(android.os.Bundle) SurfaceViewRenderer(org.webrtc.SurfaceViewRenderer) PackageManager(android.content.pm.PackageManager) ActorSDKMessenger.groups(im.actor.sdk.util.ActorSDKMessenger.groups) Date(java.util.Date) ActorSDKMessenger.messenger(im.actor.sdk.util.ActorSDKMessenger.messenger) Uri(android.net.Uri) WindowManager(android.view.WindowManager) FrameLayout(android.widget.FrameLayout) PendingIntent(android.app.PendingIntent) Screen(im.actor.sdk.util.Screen) CallMember(im.actor.core.viewmodel.CallMember) Manifest(android.Manifest) PowerManager(android.os.PowerManager) RecyclerListView(im.actor.sdk.view.adapters.RecyclerListView) View(android.view.View) DateFormat(java.text.DateFormat) Intents(im.actor.sdk.controllers.Intents) NotificationManager(android.app.NotificationManager) TimeZone(java.util.TimeZone) ValueModel(im.actor.runtime.mvvm.ValueModel) ContextCompat(android.support.v4.content.ContextCompat) ViewGroup(android.view.ViewGroup) ActorBinder(im.actor.sdk.controllers.ActorBinder) TextView(android.widget.TextView) Peer(im.actor.core.entity.Peer) Props(im.actor.runtime.actors.Props) Notification(android.app.Notification) CallState(im.actor.core.viewmodel.CallState) ViewHolder(im.actor.sdk.view.adapters.ViewHolder) Context(android.content.Context) ActorSDKMessenger.myUid(im.actor.sdk.util.ActorSDKMessenger.myUid) AndroidVideoTrack(im.actor.runtime.android.webrtc.AndroidVideoTrack) TintImageView(im.actor.sdk.view.TintImageView) SimpleDateFormat(java.text.SimpleDateFormat) Intent(android.content.Intent) GroupVM(im.actor.core.viewmodel.GroupVM) AudioManager(android.media.AudioManager) MenuItem(android.view.MenuItem) ArrayList(java.util.ArrayList) CallVM(im.actor.core.viewmodel.CallVM) MotionEvent(android.view.MotionEvent) GradientDrawable(android.graphics.drawable.GradientDrawable) ActorSystem(im.actor.runtime.actors.ActorSystem) AvatarView(im.actor.sdk.view.avatar.AvatarView) ActorRef(im.actor.runtime.actors.ActorRef) HolderAdapter(im.actor.sdk.view.adapters.HolderAdapter) PeerType(im.actor.core.entity.PeerType) ActorSDK(im.actor.sdk.ActorSDK) TimerActor(im.actor.sdk.controllers.calls.view.TimerActor) VideoRenderer(org.webrtc.VideoRenderer) LayoutInflater(android.view.LayoutInflater) ActorSDKMessenger.users(im.actor.sdk.util.ActorSDKMessenger.users) Color(android.graphics.Color) Gravity(android.view.Gravity) UserVM(im.actor.core.viewmodel.UserVM) R(im.actor.sdk.R) CallBackgroundAvatarView(im.actor.sdk.view.avatar.CallBackgroundAvatarView) RingtoneManager(android.media.RingtoneManager) NotificationCompat(android.support.v4.app.NotificationCompat) EglBase(org.webrtc.EglBase) VideoTrack(org.webrtc.VideoTrack) Log(im.actor.runtime.Log) Vibrator(android.os.Vibrator) Activity(android.app.Activity) DateFormat(java.text.DateFormat) SimpleDateFormat(java.text.SimpleDateFormat) TimerActor(im.actor.sdk.controllers.calls.view.TimerActor) SimpleDateFormat(java.text.SimpleDateFormat) Date(java.util.Date)

Aggregations

Manifest (android.Manifest)1 Activity (android.app.Activity)1 Notification (android.app.Notification)1 NotificationManager (android.app.NotificationManager)1 PendingIntent (android.app.PendingIntent)1 Context (android.content.Context)1 Intent (android.content.Intent)1 PackageManager (android.content.pm.PackageManager)1 Color (android.graphics.Color)1 GradientDrawable (android.graphics.drawable.GradientDrawable)1 AudioManager (android.media.AudioManager)1 Ringtone (android.media.Ringtone)1 RingtoneManager (android.media.RingtoneManager)1 Uri (android.net.Uri)1 Bundle (android.os.Bundle)1 PowerManager (android.os.PowerManager)1 Vibrator (android.os.Vibrator)1 NotificationCompat (android.support.v4.app.NotificationCompat)1 ContextCompat (android.support.v4.content.ContextCompat)1 Gravity (android.view.Gravity)1