summaryrefslogtreecommitdiff
path: root/InCallUI/src/com/android/incallui/CallCardFragment.java
blob: 3cebb7fe818198074f6cb44d776e60445e1a2698 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
/*
 * Copyright (C) 2013 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License
 */

package com.android.incallui;

import android.animation.Animator.AnimatorListener;
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.ValueAnimator;
import android.app.Activity;
import android.content.Context;
import android.graphics.Point;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.telephony.DisconnectCause;
import android.text.TextUtils;
import android.view.Display;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.view.ViewGroup.LayoutParams;
import android.view.ViewStub;
import android.view.ViewTreeObserver;
import android.view.ViewTreeObserver.OnGlobalLayoutListener;
import android.view.accessibility.AccessibilityEvent;
import android.view.animation.Animation;
import android.widget.ImageView;
import android.widget.TextView;

import com.android.contacts.common.animation.AnimationListenerAdapter;
import com.android.contacts.common.util.ViewUtil;
import com.android.incallui.animation.ResizeAnimation;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.TextView;

import com.android.contacts.common.util.ViewUtil;

import java.util.List;

/**
 * Fragment for call card.
 */
public class CallCardFragment extends BaseFragment<CallCardPresenter, CallCardPresenter.CallCardUi>
        implements CallCardPresenter.CallCardUi {

    private static final int REVEAL_ANIMATION_DURATION = 800;
    private static final int SLIDE_ANIMATION_DURATION = 400;

    // Primary caller info
    private TextView mPhoneNumber;
    private TextView mNumberLabel;
    private TextView mPrimaryName;
    private TextView mCallStateLabel;
    private TextView mCallTypeLabel;
    private ImageView mPhoto;
    private TextView mElapsedTime;

    // Container view that houses the entire primary call card, including the call buttons
    private View mPrimaryCallCardContainer;
    // Container view that houses the primary call information
    private View mPrimaryCallInfo;
    private View mCallButtonsContainer;

    // Secondary caller info
    private ViewStub mSecondaryCallInfo;
    private TextView mSecondaryCallName;
    private ImageView mSecondaryPhoto;
    private View mSecondaryPhotoOverlay;

    private View mAnimatedScrim;

    private View mEndCallButton;
    private ImageButton mHandoffButton;

    // Cached DisplayMetrics density.
    private float mDensity;

    private final AnimatorListener mAnimatedScrimListener = new AnimatedScrimListener();

    @Override
    CallCardPresenter.CallCardUi getUi() {
        return this;
    }

    @Override
    CallCardPresenter createPresenter() {
        return new CallCardPresenter();
    }

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    }


    @Override
    public void onActivityCreated(Bundle savedInstanceState) {
        super.onActivityCreated(savedInstanceState);

        final CallList calls = CallList.getInstance();
        final Call call = calls.getFirstCall();
        getPresenter().init(getActivity(), call);
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
            Bundle savedInstanceState) {
        super.onCreateView(inflater, container, savedInstanceState);

        mDensity = getResources().getDisplayMetrics().density;

        return inflater.inflate(R.layout.call_card, container, false);
    }

    @Override
    public void onViewCreated(View view, Bundle savedInstanceState) {
        super.onViewCreated(view, savedInstanceState);

        mPhoneNumber = (TextView) view.findViewById(R.id.phoneNumber);
        mPrimaryName = (TextView) view.findViewById(R.id.name);
        mNumberLabel = (TextView) view.findViewById(R.id.label);
        mSecondaryCallInfo = (ViewStub) view.findViewById(R.id.secondary_call_info);
        mPhoto = (ImageView) view.findViewById(R.id.photo);
        mCallStateLabel = (TextView) view.findViewById(R.id.callStateLabel);
        mCallTypeLabel = (TextView) view.findViewById(R.id.callTypeLabel);
        mElapsedTime = (TextView) view.findViewById(R.id.elapsedTime);
        mPrimaryCallCardContainer = view.findViewById(R.id.primary_call_info_container);
        mPrimaryCallInfo = view.findViewById(R.id.primary_call_banner);
        mAnimatedScrim = view.findViewById(R.id.animated_scrim);
        mCallButtonsContainer = view.findViewById(R.id.callButtonFragment);

        mEndCallButton = view.findViewById(R.id.endButton);
        mEndCallButton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                getPresenter().endCallClicked();
            }
        });
        ViewUtil.setupFloatingActionButton(mEndCallButton, getResources());

        mHandoffButton = (ImageButton) view.findViewById(R.id.handoffButton);
        mHandoffButton.setOnClickListener(new View.OnClickListener() {
            @Override public void onClick(View v) {
                getPresenter().connectionHandoffClicked();
            }
        });
        ViewUtil.setupFloatingActionButton(mHandoffButton, getResources());
    }

    @Override
    public void setVisible(boolean on) {
        if (on) {
            getView().setVisibility(View.VISIBLE);
        } else {
            getView().setVisibility(View.INVISIBLE);
        }
    }

    public void setShowConnectionHandoff(boolean showConnectionHandoff) {
        Log.v(this, "setShowConnectionHandoff: " + showConnectionHandoff);
    }

    @Override
    public void setPrimaryName(String name, boolean nameIsNumber) {
        if (TextUtils.isEmpty(name)) {
            mPrimaryName.setText("");
        } else {
            mPrimaryName.setText(name);

            // Set direction of the name field
            int nameDirection = View.TEXT_DIRECTION_INHERIT;
            if (nameIsNumber) {
                nameDirection = View.TEXT_DIRECTION_LTR;
            }
            mPrimaryName.setTextDirection(nameDirection);
        }
    }

    @Override
    public void setPrimaryImage(Drawable image) {
        if (image != null) {
            setDrawableToImageView(mPhoto, image);
        }
    }

    @Override
    public void setPrimaryPhoneNumber(String number) {
        // Set the number
        if (TextUtils.isEmpty(number)) {
            mPhoneNumber.setText("");
            mPhoneNumber.setVisibility(View.GONE);
        } else {
            mPhoneNumber.setText(number);
            mPhoneNumber.setVisibility(View.VISIBLE);
            mPhoneNumber.setTextDirection(View.TEXT_DIRECTION_LTR);
        }
    }

    @Override
    public void setPrimaryLabel(String label) {
        if (!TextUtils.isEmpty(label)) {
            mNumberLabel.setText(label);
            mNumberLabel.setVisibility(View.VISIBLE);
        } else {
            mNumberLabel.setVisibility(View.GONE);
        }

    }

    @Override
    public void setPrimary(String number, String name, boolean nameIsNumber, String label,
            Drawable photo, boolean isConference, boolean isGeneric, boolean isSipCall) {
        Log.d(this, "Setting primary call");

        if (isConference) {
            name = getConferenceString(isGeneric);
            photo = getConferencePhoto(isGeneric);
            nameIsNumber = false;
        }

        setPrimaryPhoneNumber(number);

        // set the name field.
        setPrimaryName(name, nameIsNumber);

        // Set the label (Mobile, Work, etc)
        setPrimaryLabel(label);

        showInternetCallLabel(isSipCall);

        setDrawableToImageView(mPhoto, photo);
    }

    @Override
    public void setSecondary(boolean show, String name, boolean nameIsNumber, String label,
            Drawable photo, boolean isConference, boolean isGeneric) {

        if (show) {
            if (isConference) {
                name = getConferenceString(isGeneric);
                photo = getConferencePhoto(isGeneric);
                nameIsNumber = false;
            }

            showAndInitializeSecondaryCallInfo();
            mSecondaryCallName.setText(name);

            int nameDirection = View.TEXT_DIRECTION_INHERIT;
            if (nameIsNumber) {
                nameDirection = View.TEXT_DIRECTION_LTR;
            }
            mSecondaryCallName.setTextDirection(nameDirection);

            setDrawableToImageView(mSecondaryPhoto, photo);
        } else {
            mSecondaryCallInfo.setVisibility(View.GONE);
        }
    }

    @Override
    public void setSecondaryImage(Drawable image) {
        if (image != null) {
            setDrawableToImageView(mSecondaryPhoto, image);
        }
    }

    @Override
    public void setCallState(int state, int cause, boolean bluetoothOn, String gatewayLabel,
            String gatewayNumber, boolean isWiFi, boolean isHandoffCapable,
            boolean isHandoffPending) {
        String callStateLabel = null;

        if (Call.State.isDialing(state) && !TextUtils.isEmpty(gatewayLabel)) {
            // Provider info: (e.g. "Calling via <gatewayLabel>")
            callStateLabel = gatewayLabel;
        } else {
            callStateLabel = getCallStateLabelFromState(state, cause);
        }

        Log.v(this, "setCallState " + callStateLabel);
        Log.v(this, "DisconnectCause " + DisconnectCause.toString(cause));
        Log.v(this, "bluetooth on " + bluetoothOn);
        Log.v(this, "gateway " + gatewayLabel + gatewayNumber);
        Log.v(this, "isWiFi " + isWiFi);
        Log.v(this, "isHandoffCapable " + isHandoffCapable);
        Log.v(this, "isHandoffPending " + isHandoffPending);

        // Update the call state label.
        if (!TextUtils.isEmpty(callStateLabel)) {
            mCallStateLabel.setText(callStateLabel);
            mCallStateLabel.setVisibility(View.VISIBLE);
        } else {
            mCallStateLabel.setVisibility(View.GONE);
        }

        if (Call.State.INCOMING == state) {
            setBluetoothOn(bluetoothOn);
        }

        mHandoffButton.setEnabled(isHandoffCapable && !isHandoffPending);
        mHandoffButton.setVisibility(mHandoffButton.isEnabled() ? View.VISIBLE : View.GONE);
        mHandoffButton.setImageResource(isWiFi ?
                R.drawable.ic_in_call_wifi : R.drawable.ic_in_call_pstn);
    }

    private void showInternetCallLabel(boolean show) {
        if (show) {
            final String label = getView().getContext().getString(
                    R.string.incall_call_type_label_sip);
            mCallTypeLabel.setVisibility(View.VISIBLE);
            mCallTypeLabel.setText(label);
        } else {
            mCallTypeLabel.setVisibility(View.GONE);
        }
    }

    @Override
    public void setPrimaryCallElapsedTime(boolean show, String callTimeElapsed) {
        if (show) {
            if (mElapsedTime.getVisibility() != View.VISIBLE) {
                AnimationUtils.Fade.show(mElapsedTime);
            }
            mElapsedTime.setText(callTimeElapsed);
        } else {
            // hide() animation has no effect if it is already hidden.
            AnimationUtils.Fade.hide(mElapsedTime, View.INVISIBLE);
        }
    }

    private void setDrawableToImageView(ImageView view, Drawable photo) {
        if (photo == null) {
            photo = view.getResources().getDrawable(R.drawable.picture_unknown);
        }

        final Drawable current = view.getDrawable();
        if (current == null) {
            view.setImageDrawable(photo);
            AnimationUtils.Fade.show(view);
        } else {
            AnimationUtils.startCrossFade(view, current, photo);
            view.setVisibility(View.VISIBLE);
        }
    }

    private String getConferenceString(boolean isGeneric) {
        Log.v(this, "isGenericString: " + isGeneric);
        final int resId = isGeneric ? R.string.card_title_in_call : R.string.card_title_conf_call;
        return getView().getResources().getString(resId);
    }

    private Drawable getConferencePhoto(boolean isGeneric) {
        Log.v(this, "isGenericPhoto: " + isGeneric);
        final int resId = isGeneric ? R.drawable.picture_dialing : R.drawable.picture_conference;
        return getView().getResources().getDrawable(resId);
    }

    private void setBluetoothOn(boolean onOff) {
        // Also, display a special icon (alongside the "Incoming call"
        // label) if there's an incoming call and audio will be routed
        // to bluetooth when you answer it.
        final int bluetoothIconId = R.drawable.ic_in_call_bt_dk;

        if (onOff) {
            mCallStateLabel.setCompoundDrawablesWithIntrinsicBounds(bluetoothIconId, 0, 0, 0);
            mCallStateLabel.setCompoundDrawablePadding((int) (mDensity * 5));
        } else {
            // Clear out any icons
            mCallStateLabel.setCompoundDrawablesWithIntrinsicBounds(0, 0, 0, 0);
        }
    }

    /**
     * Gets the call state label based on the state of the call and
     * cause of disconnect
     */
    private String getCallStateLabelFromState(int state, int cause) {
        final Context context = getView().getContext();
        String callStateLabel = null;  // Label to display as part of the call banner

        if (Call.State.IDLE == state) {
            // "Call state" is meaningless in this state.

        } else if (Call.State.ACTIVE == state) {
            // We normally don't show a "call state label" at all in
            // this state (but see below for some special cases).

        } else if (Call.State.ONHOLD == state) {
            callStateLabel = context.getString(R.string.card_title_on_hold);
        } else if (Call.State.DIALING == state) {
            callStateLabel = context.getString(R.string.card_title_dialing);
        } else if (Call.State.REDIALING == state) {
            callStateLabel = context.getString(R.string.card_title_redialing);
        } else if (Call.State.INCOMING == state || Call.State.CALL_WAITING == state) {
            callStateLabel = context.getString(R.string.card_title_incoming_call);

        } else if (Call.State.DISCONNECTING == state) {
            // While in the DISCONNECTING state we display a "Hanging up"
            // message in order to make the UI feel more responsive.  (In
            // GSM it's normal to see a delay of a couple of seconds while
            // negotiating the disconnect with the network, so the "Hanging
            // up" state at least lets the user know that we're doing
            // something.  This state is currently not used with CDMA.)
            callStateLabel = context.getString(R.string.card_title_hanging_up);

        } else if (Call.State.DISCONNECTED == state) {
            callStateLabel = getCallFailedString(cause);

        } else {
            Log.wtf(this, "updateCallStateWidgets: unexpected call: " + state);
        }

        return callStateLabel;
    }

    /**
     * Maps the disconnect cause to a resource string.
     *
     * @param cause disconnect cause as defined in {@link DisconnectCause}
     */
    private String getCallFailedString(int cause) {
        int resID = R.string.card_title_call_ended;

        // TODO: The card *title* should probably be "Call ended" in all
        // cases, but if the DisconnectCause was an error condition we should
        // probably also display the specific failure reason somewhere...

        switch (cause) {
            case DisconnectCause.BUSY:
                resID = R.string.callFailed_userBusy;
                break;

            case DisconnectCause.CONGESTION:
                resID = R.string.callFailed_congestion;
                break;

            case DisconnectCause.TIMED_OUT:
                resID = R.string.callFailed_timedOut;
                break;

            case DisconnectCause.SERVER_UNREACHABLE:
                resID = R.string.callFailed_server_unreachable;
                break;

            case DisconnectCause.NUMBER_UNREACHABLE:
                resID = R.string.callFailed_number_unreachable;
                break;

            case DisconnectCause.INVALID_CREDENTIALS:
                resID = R.string.callFailed_invalid_credentials;
                break;

            case DisconnectCause.SERVER_ERROR:
                resID = R.string.callFailed_server_error;
                break;

            case DisconnectCause.OUT_OF_NETWORK:
                resID = R.string.callFailed_out_of_network;
                break;

            case DisconnectCause.LOST_SIGNAL:
            case DisconnectCause.CDMA_DROP:
                resID = R.string.callFailed_noSignal;
                break;

            case DisconnectCause.LIMIT_EXCEEDED:
                resID = R.string.callFailed_limitExceeded;
                break;

            case DisconnectCause.POWER_OFF:
                resID = R.string.callFailed_powerOff;
                break;

            case DisconnectCause.ICC_ERROR:
                resID = R.string.callFailed_simError;
                break;

            case DisconnectCause.OUT_OF_SERVICE:
                resID = R.string.callFailed_outOfService;
                break;

            case DisconnectCause.INVALID_NUMBER:
            case DisconnectCause.UNOBTAINABLE_NUMBER:
                resID = R.string.callFailed_unobtainable_number;
                break;

            default:
                resID = R.string.card_title_call_ended;
                break;
        }
        return this.getView().getContext().getString(resID);
    }

    private void showAndInitializeSecondaryCallInfo() {
        mSecondaryCallInfo.setVisibility(View.VISIBLE);

        // mSecondaryCallName is initialized here (vs. onViewCreated) because it is inaccesible
        // until mSecondaryCallInfo is inflated in the call above.
        if (mSecondaryCallName == null) {
            mSecondaryCallName = (TextView) getView().findViewById(R.id.secondaryCallName);
        }
        if (mSecondaryPhoto == null) {
            mSecondaryPhoto = (ImageView) getView().findViewById(R.id.secondaryCallPhoto);
        }

        if (mSecondaryPhotoOverlay == null) {
            mSecondaryPhotoOverlay = getView().findViewById(R.id.dim_effect_for_secondary_photo);
            mSecondaryPhotoOverlay.setOnClickListener(new OnClickListener() {
                @Override
                public void onClick(View v) {
                    getPresenter().secondaryPhotoClicked();
                }
            });
            mSecondaryPhotoOverlay.setOnTouchListener(new SmallerHitTargetTouchListener());
        }
    }

    public void dispatchPopulateAccessibilityEvent(AccessibilityEvent event) {
        if (event.getEventType() == AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED) {
            dispatchPopulateAccessibilityEvent(event, mPrimaryName);
            dispatchPopulateAccessibilityEvent(event, mPhoneNumber);
            return;
        }
        dispatchPopulateAccessibilityEvent(event, mCallStateLabel);
        dispatchPopulateAccessibilityEvent(event, mPrimaryName);
        dispatchPopulateAccessibilityEvent(event, mPhoneNumber);
        dispatchPopulateAccessibilityEvent(event, mCallTypeLabel);
        dispatchPopulateAccessibilityEvent(event, mSecondaryCallName);

        return;
    }

    public void setEndCallButtonEnabled(boolean enabled) {
        mEndCallButton.setVisibility(enabled ? View.VISIBLE : View.GONE);
    }

    private void dispatchPopulateAccessibilityEvent(AccessibilityEvent event, View view) {
        if (view == null) return;
        final List<CharSequence> eventText = event.getText();
        int size = eventText.size();
        view.dispatchPopulateAccessibilityEvent(event);
        // if no text added write null to keep relative position
        if (size == eventText.size()) {
            eventText.add(null);
        }
    }

    public void animateForNewOutgoingCall() {
        final View animatedSpacer = getView().findViewById(R.id.animated_scrim_spacer);

        mAnimatedScrim.setVisibility(View.VISIBLE);
        mAnimatedScrim.getLayoutParams().height = LayoutParams.MATCH_PARENT;
        mAnimatedScrim.requestLayout();

        final ViewTreeObserver observer = getView().getViewTreeObserver();
        observer.addOnGlobalLayoutListener(new OnGlobalLayoutListener() {
            @Override
            public void onGlobalLayout() {
                final ViewTreeObserver observer = getView().getViewTreeObserver();
                if (!observer.isAlive()) {
                    return;
                }
                observer.removeOnGlobalLayoutListener(this);

                // Prepare the state of views before the circular reveal animation
                final int targetHeight = mPrimaryCallCardContainer.getHeight();
                animatedSpacer.getLayoutParams().height = targetHeight;
                animatedSpacer.requestLayout();

                mPrimaryCallInfo.setAlpha(0);
                mCallButtonsContainer.setAlpha(0);

                performAnimatedReveal(mAnimatedScrimListener);
            }
        });
    }

    private void performAnimatedReveal(AnimatorListener listener) {
        final Activity activity = getActivity();
        final View view  = activity.getWindow().getDecorView();
        final Display display = activity.getWindowManager().getDefaultDisplay();
        final Point size = new Point();
        display.getSize(size);

        final ValueAnimator valueAnimator = view.createRevealAnimator(size.x / 2, size.y / 2,
                0, Math.max(size.x, size.y));
        valueAnimator.setDuration(REVEAL_ANIMATION_DURATION);
        valueAnimator.addListener(listener);
        valueAnimator.start();
    }

    private final class AnimatedScrimListener extends AnimatorListenerAdapter {
        @Override
        public void onAnimationEnd(Animator animation) {
            final int width = mAnimatedScrim.getWidth();
            ResizeAnimation resizeAnimation =
                    new ResizeAnimation(mAnimatedScrim, width, width, mAnimatedScrim.getHeight(),
                            0);
            resizeAnimation.setDuration(SLIDE_ANIMATION_DURATION);
            resizeAnimation.setAnimationListener(new AnimationListenerAdapter() {
                @Override
                public void onAnimationStart(Animation animation) {
                    // Prepare the state of views before the scrim's sliding up animation
                    mEndCallButton.setTranslationY(200);
                    mEndCallButton.animate().translationY(0)
                            .setDuration(SLIDE_ANIMATION_DURATION);
                    mPrimaryCallInfo.animate().alpha(1).withLayer()
                            .setDuration(SLIDE_ANIMATION_DURATION);
                    mCallButtonsContainer.animate().alpha(1).withLayer()
                            .setDuration(SLIDE_ANIMATION_DURATION);
                }

                @Override
                public void onAnimationEnd(Animation animation) {
                    mAnimatedScrim.setVisibility(View.GONE);
                }
            });
            mAnimatedScrim.startAnimation(resizeAnimation);
        }
    };
}