Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fdf53779 authored by Yorke Lee's avatar Yorke Lee
Browse files

Hide end call button when video upgrade glowpad is showing

Bug: 20090411
Change-Id: I25bca70e2e2a40bbd88b55ba386d39cd796cb414
parent 55576e52
Loading
Loading
Loading
Loading
+16 −4
Original line number Diff line number Diff line
@@ -251,11 +251,9 @@ public class CallCardPresenter extends Presenter<CallCardPresenter.CallCardUi>
        maybeShowManageConferenceCallButton();
        maybeShowProgressSpinner();

        final boolean enableEndCallButton = Call.State.isConnectingOrConnected(callState) &&
                callState != Call.State.INCOMING && mPrimary != null;
        // Hide the end call button instantly if we're receiving an incoming call.
        getUi().setEndCallButtonEnabled(
                enableEndCallButton, callState != Call.State.INCOMING /* animate */);
        getUi().setEndCallButtonEnabled(shouldShowEndCallButton(mPrimary, callState),
                callState != Call.State.INCOMING /* animate */);
    }

    @Override
@@ -741,6 +739,20 @@ public class CallCardPresenter extends Presenter<CallCardPresenter.CallCardUi>
        return photo;
    }

    private boolean shouldShowEndCallButton(Call primary, int callState) {
        if (primary == null) {
            return false;
        }
        if (!Call.State.isConnectingOrConnected(callState) || callState == Call.State.INCOMING) {
            return false;
        }
        if (mPrimary.getSessionModificationState()
                == Call.SessionModificationState.RECEIVED_UPGRADE_TO_VIDEO_REQUEST) {
            return false;
        }
        return true;
    }

    public interface CallCardUi extends Ui {
        void setVisible(boolean on);
        void setCallCardVisible(boolean visible);