diff options
author | wangqi <wangqi@google.com> | 2018-03-14 12:12:32 -0700 |
---|---|---|
committer | Copybara-Service <copybara-piper@google.com> | 2018-03-14 12:13:38 -0700 |
commit | b8d0f5029ebaf8e3a0bd32c8b54b3baee6f2876a (patch) | |
tree | 5afc256ca4698d4e03138cd5a315934897cab083 /java/com/android/incallui/rtt/impl/RttOverflowMenu.java | |
parent | c692948f41733a436f90d56da003d30ac7bf56eb (diff) |
Add swap call button to RTT call.
Bug: 67596257
Test: manual
PiperOrigin-RevId: 189064976
Change-Id: I3265881114baceb4d63fcc3d55d1c904cd3216dc
Diffstat (limited to 'java/com/android/incallui/rtt/impl/RttOverflowMenu.java')
-rw-r--r-- | java/com/android/incallui/rtt/impl/RttOverflowMenu.java | 38 |
1 files changed, 34 insertions, 4 deletions
diff --git a/java/com/android/incallui/rtt/impl/RttOverflowMenu.java b/java/com/android/incallui/rtt/impl/RttOverflowMenu.java index cca36318e..2a061c546 100644 --- a/java/com/android/incallui/rtt/impl/RttOverflowMenu.java +++ b/java/com/android/incallui/rtt/impl/RttOverflowMenu.java @@ -21,6 +21,7 @@ import android.telecom.CallAudioState; import android.view.View; import android.widget.PopupWindow; import com.android.incallui.incall.protocol.InCallButtonUiDelegate; +import com.android.incallui.incall.protocol.InCallScreenDelegate; import com.android.incallui.rtt.impl.RttCheckableButton.OnCheckedChangeListener; import com.android.incallui.speakerbuttonlogic.SpeakerButtonInfo; import com.android.incallui.speakerbuttonlogic.SpeakerButtonInfo.IconSize; @@ -32,11 +33,19 @@ public class RttOverflowMenu extends PopupWindow implements OnCheckedChangeListe private final RttCheckableButton speakerButton; private final RttCheckableButton dialpadButton; private final RttCheckableButton addCallButton; + private final RttCheckableButton swapCallButton; private final InCallButtonUiDelegate inCallButtonUiDelegate; + private final InCallScreenDelegate inCallScreenDelegate; + private boolean isSwitchToSecondaryButtonEnabled; + private boolean isSwapCallButtonEnabled; - RttOverflowMenu(Context context, InCallButtonUiDelegate inCallButtonUiDelegate) { + RttOverflowMenu( + Context context, + InCallButtonUiDelegate inCallButtonUiDelegate, + InCallScreenDelegate inCallScreenDelegate) { super(context); this.inCallButtonUiDelegate = inCallButtonUiDelegate; + this.inCallScreenDelegate = inCallScreenDelegate; View view = View.inflate(context, R.layout.overflow_menu, null); setContentView(view); setOnDismissListener(this::dismiss); @@ -49,7 +58,18 @@ public class RttOverflowMenu extends PopupWindow implements OnCheckedChangeListe dialpadButton = view.findViewById(R.id.menu_keypad); dialpadButton.setOnCheckedChangeListener(this); addCallButton = view.findViewById(R.id.menu_add_call); - addCallButton.setOnCheckedChangeListener(this); + addCallButton.setOnClickListener(v -> this.inCallButtonUiDelegate.addCallClicked()); + swapCallButton = view.findViewById(R.id.menu_swap_call); + swapCallButton.setOnClickListener( + v -> { + if (isSwapCallButtonEnabled) { + this.inCallButtonUiDelegate.swapClicked(); + } + if (isSwitchToSecondaryButtonEnabled) { + this.inCallScreenDelegate.onSecondaryInfoClicked(); + } + dismiss(); + }); } @Override @@ -60,8 +80,6 @@ public class RttOverflowMenu extends PopupWindow implements OnCheckedChangeListe inCallButtonUiDelegate.toggleSpeakerphone(); } else if (button == dialpadButton) { inCallButtonUiDelegate.showDialpadClicked(isChecked); - } else if (button == addCallButton) { - inCallButtonUiDelegate.addCallClicked(); } dismiss(); } @@ -91,4 +109,16 @@ public class RttOverflowMenu extends PopupWindow implements OnCheckedChangeListe void setDialpadButtonChecked(boolean isChecked) { dialpadButton.setChecked(isChecked); } + + void enableSwapCallButton(boolean enabled) { + isSwapCallButtonEnabled = enabled; + swapCallButton.setVisibility( + isSwapCallButtonEnabled || isSwitchToSecondaryButtonEnabled ? View.VISIBLE : View.GONE); + } + + void enableSwitchToSecondaryButton(boolean enabled) { + isSwitchToSecondaryButtonEnabled = enabled; + swapCallButton.setVisibility( + isSwapCallButtonEnabled || isSwitchToSecondaryButtonEnabled ? View.VISIBLE : View.GONE); + } } |