diff options
author | Treehugger Robot <treehugger-gerrit@google.com> | 2018-03-14 20:35:15 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2018-03-14 20:35:15 +0000 |
commit | ede6377e397f4b4d6f6a46d09c10efc52724531a (patch) | |
tree | 5afc256ca4698d4e03138cd5a315934897cab083 /java/com/android/incallui/rtt/impl/RttOverflowMenu.java | |
parent | c692948f41733a436f90d56da003d30ac7bf56eb (diff) | |
parent | b8d0f5029ebaf8e3a0bd32c8b54b3baee6f2876a (diff) |
Merge "Add swap call button to RTT call."
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); + } } |