Example usage for android.telecom DisconnectCause toString

List of usage examples for android.telecom DisconnectCause toString

Introduction

In this page you can find the example usage for android.telecom DisconnectCause toString.

Prototype

@Override
    public String toString() 

Source Link

Usage

From source file:com.android.incallui.CallCardFragment.java

@Override
public void setCallState(int state, int videoState, int sessionModificationState,
        DisconnectCause disconnectCause, String connectionLabel, Drawable callStateIcon, String gatewayNumber,
        boolean isWifi, boolean isConference, boolean isWorkCall) {
    boolean isGatewayCall = !TextUtils.isEmpty(gatewayNumber);
    CallStateLabel callStateLabel = getCallStateLabelFromState(state, videoState, sessionModificationState,
            disconnectCause, connectionLabel, isGatewayCall, isWifi, isConference, isWorkCall);

    Log.v(this, "setCallState " + callStateLabel.getCallStateLabel());
    Log.v(this, "AutoDismiss " + callStateLabel.isAutoDismissing());
    Log.v(this, "DisconnectCause " + disconnectCause.toString());
    Log.v(this, "gateway " + connectionLabel + gatewayNumber);

    // Check for video state change and update the visibility of the contact photo.  The contact
    // photo is hidden when the incoming video surface is shown.
    // The contact photo visibility can also change in setPrimary().
    boolean showContactPhoto = !VideoCallPresenter.showIncomingVideo(videoState, state);
    mPhotoLarge.setVisibility(showContactPhoto ? View.VISIBLE : View.GONE);

    // Check if the call subject is showing -- if it is, we want to bypass showing the call
    // state.//from   w w w .j  ava 2s.c  o m
    boolean isSubjectShowing = mCallSubject.getVisibility() == View.VISIBLE;

    if (TextUtils.equals(callStateLabel.getCallStateLabel(), mCallStateLabel.getText()) && !isSubjectShowing) {
        // Nothing to do if the labels are the same
        if (state == Call.State.ACTIVE || state == Call.State.CONFERENCED) {
            mCallStateLabel.clearAnimation();
            mCallStateIcon.clearAnimation();
        }
        return;
    }

    if (isSubjectShowing) {
        changeCallStateLabel(null);
        callStateIcon = null;
    } else {
        // Update the call state label and icon.
        setCallStateLabel(callStateLabel);
    }

    if (!TextUtils.isEmpty(callStateLabel.getCallStateLabel())) {
        if (state == Call.State.ACTIVE || state == Call.State.CONFERENCED) {
            mCallStateLabel.clearAnimation();
        } else {
            mCallStateLabel.startAnimation(mPulseAnimation);
        }
    } else {
        mCallStateLabel.clearAnimation();
    }

    if (callStateIcon != null) {
        mCallStateIcon.setVisibility(View.VISIBLE);
        // Invoke setAlpha(float) instead of setAlpha(int) to set the view's alpha. This is
        // needed because the pulse animation operates on the view alpha.
        mCallStateIcon.setAlpha(1.0f);
        mCallStateIcon.setImageDrawable(callStateIcon);

        if (state == Call.State.ACTIVE || state == Call.State.CONFERENCED
                || TextUtils.isEmpty(callStateLabel.getCallStateLabel())) {
            mCallStateIcon.clearAnimation();
        } else {
            mCallStateIcon.startAnimation(mPulseAnimation);
        }

        if (callStateIcon instanceof AnimationDrawable) {
            ((AnimationDrawable) callStateIcon).start();
        }
    } else {
        mCallStateIcon.clearAnimation();

        // Invoke setAlpha(float) instead of setAlpha(int) to set the view's alpha. This is
        // needed because the pulse animation operates on the view alpha.
        mCallStateIcon.setAlpha(0.0f);
        mCallStateIcon.setVisibility(View.GONE);
    }

    if (VideoUtils.isVideoCall(videoState) || (state == Call.State.ACTIVE
            && sessionModificationState == Call.SessionModificationState.WAITING_FOR_RESPONSE)) {
        mCallStateVideoCallIcon.setVisibility(View.VISIBLE);
    } else {
        mCallStateVideoCallIcon.setVisibility(View.GONE);
    }
}