summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--assets/quantum/res/drawable/quantum_ic_swap_calls_vd_theme_24.xml25
-rw-r--r--java/com/android/incallui/hold/res/layout/incall_on_hold_banner.xml3
-rw-r--r--java/com/android/incallui/rtt/impl/RttChatFragment.java50
-rw-r--r--java/com/android/incallui/rtt/impl/RttOverflowMenu.java38
-rw-r--r--java/com/android/incallui/rtt/impl/res/layout/frag_rtt_chat.xml6
-rw-r--r--java/com/android/incallui/rtt/impl/res/layout/overflow_menu.xml6
-rw-r--r--java/com/android/incallui/rtt/impl/res/layout/rtt_banner.xml126
-rw-r--r--java/com/android/incallui/rtt/impl/res/values/ids.xml19
8 files changed, 200 insertions, 73 deletions
diff --git a/assets/quantum/res/drawable/quantum_ic_swap_calls_vd_theme_24.xml b/assets/quantum/res/drawable/quantum_ic_swap_calls_vd_theme_24.xml
new file mode 100644
index 000000000..e05fb1baa
--- /dev/null
+++ b/assets/quantum/res/drawable/quantum_ic_swap_calls_vd_theme_24.xml
@@ -0,0 +1,25 @@
+<!--
+ ~ Copyright (C) 2018 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
+ -->
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="24dp"
+ android:height="24dp"
+ android:viewportWidth="24.0"
+ android:viewportHeight="24.0"
+ android:tint="?attr/colorControlNormal">
+ <path
+ android:fillColor="@android:color/white"
+ android:pathData="M18,4l-4,4h3v7c0,1.1 -0.9,2 -2,2s-2,-0.9 -2,-2V8c0,-2.21 -1.79,-4 -4,-4S5,5.79 5,8v7H2l4,4 4,-4H7V8c0,-1.1 0.9,-2 2,-2s2,0.9 2,2v7c0,2.21 1.79,4 4,4s4,-1.79 4,-4V8h3l-4,-4z"/>
+</vector>
diff --git a/java/com/android/incallui/hold/res/layout/incall_on_hold_banner.xml b/java/com/android/incallui/hold/res/layout/incall_on_hold_banner.xml
index 728cce2bc..c5c455362 100644
--- a/java/com/android/incallui/hold/res/layout/incall_on_hold_banner.xml
+++ b/java/com/android/incallui/hold/res/layout/incall_on_hold_banner.xml
@@ -19,8 +19,7 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:background="#CC212121"
- android:fitsSystemWindows="true">
+ android:background="#CC212121">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
diff --git a/java/com/android/incallui/rtt/impl/RttChatFragment.java b/java/com/android/incallui/rtt/impl/RttChatFragment.java
index 3b943c431..c6eef9ca2 100644
--- a/java/com/android/incallui/rtt/impl/RttChatFragment.java
+++ b/java/com/android/incallui/rtt/impl/RttChatFragment.java
@@ -17,11 +17,13 @@
package com.android.incallui.rtt.impl;
import android.app.Activity;
+import android.content.Context;
import android.os.Bundle;
import android.os.SystemClock;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
+import android.support.v4.app.FragmentTransaction;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.RecyclerView.OnScrollListener;
@@ -49,6 +51,8 @@ import com.android.dialer.common.UiUtil;
import com.android.incallui.audioroute.AudioRouteSelectorDialogFragment;
import com.android.incallui.audioroute.AudioRouteSelectorDialogFragment.AudioRouteSelectorPresenter;
import com.android.incallui.call.DialerCall.State;
+import com.android.incallui.hold.OnHoldFragment;
+import com.android.incallui.incall.protocol.InCallButtonIds;
import com.android.incallui.incall.protocol.InCallButtonUi;
import com.android.incallui.incall.protocol.InCallButtonUiDelegate;
import com.android.incallui.incall.protocol.InCallButtonUiDelegateFactory;
@@ -99,6 +103,7 @@ public class RttChatFragment extends Fragment
private Chronometer chronometer;
private boolean isTimerStarted;
private RttOverflowMenu overflowMenu;
+ private SecondaryInfo savedSecondaryInfo;
/**
* Create a new instance of RttChatFragment.
@@ -124,6 +129,9 @@ public class RttChatFragment extends Fragment
if (savedInstanceState != null) {
inCallButtonUiDelegate.onRestoreInstanceState(savedInstanceState);
}
+ inCallScreenDelegate =
+ FragmentUtils.getParentUnsafe(this, InCallScreenDelegateFactory.class)
+ .newInCallScreenDelegate();
// Prevent updating local message until UI is ready.
isClearingInput = true;
}
@@ -133,9 +141,6 @@ public class RttChatFragment extends Fragment
super.onViewCreated(view, bundle);
LogUtil.i("RttChatFragment.onViewCreated", null);
- inCallScreenDelegate =
- FragmentUtils.getParentUnsafe(this, InCallScreenDelegateFactory.class)
- .newInCallScreenDelegate();
rttCallScreenDelegate =
FragmentUtils.getParentUnsafe(this, RttCallScreenDelegateFactory.class)
.newRttCallScreenDelegate(this);
@@ -185,7 +190,7 @@ public class RttChatFragment extends Fragment
inCallButtonUiDelegate.onEndCallClicked();
});
- overflowMenu = new RttOverflowMenu(getContext(), inCallButtonUiDelegate);
+ overflowMenu = new RttOverflowMenu(getContext(), inCallButtonUiDelegate, inCallScreenDelegate);
view.findViewById(R.id.rtt_overflow_button)
.setOnClickListener(
v -> {
@@ -311,7 +316,36 @@ public class RttChatFragment extends Fragment
}
@Override
- public void setSecondary(@NonNull SecondaryInfo secondaryInfo) {}
+ public void onAttach(Context context) {
+ super.onAttach(context);
+ if (savedSecondaryInfo != null) {
+ setSecondary(savedSecondaryInfo);
+ }
+ }
+
+ @Override
+ public void setSecondary(@NonNull SecondaryInfo secondaryInfo) {
+ LogUtil.i("RttChatFragment.setSecondary", secondaryInfo.toString());
+ if (!isAdded()) {
+ savedSecondaryInfo = secondaryInfo;
+ return;
+ }
+ savedSecondaryInfo = null;
+ FragmentTransaction transaction = getChildFragmentManager().beginTransaction();
+ Fragment oldBanner = getChildFragmentManager().findFragmentById(R.id.rtt_on_hold_banner);
+ if (secondaryInfo.shouldShow()) {
+ OnHoldFragment onHoldFragment = OnHoldFragment.newInstance(secondaryInfo);
+ onHoldFragment.setPadTopInset(false);
+ transaction.replace(R.id.rtt_on_hold_banner, onHoldFragment);
+ } else {
+ if (oldBanner != null) {
+ transaction.remove(oldBanner);
+ }
+ }
+ transaction.setCustomAnimations(R.anim.abc_slide_in_top, R.anim.abc_slide_out_top);
+ transaction.commitNowAllowingStateLoss();
+ overflowMenu.enableSwitchToSecondaryButton(secondaryInfo.shouldShow());
+ }
@Override
public void setCallState(@NonNull PrimaryCallState primaryCallState) {
@@ -372,7 +406,11 @@ public class RttChatFragment extends Fragment
}
@Override
- public void showButton(int buttonId, boolean show) {}
+ public void showButton(int buttonId, boolean show) {
+ if (buttonId == InCallButtonIds.BUTTON_SWAP) {
+ overflowMenu.enableSwapCallButton(show);
+ }
+ }
@Override
public void enableButton(int buttonId, boolean enable) {}
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);
+ }
}
diff --git a/java/com/android/incallui/rtt/impl/res/layout/frag_rtt_chat.xml b/java/com/android/incallui/rtt/impl/res/layout/frag_rtt_chat.xml
index 6940569a3..753117904 100644
--- a/java/com/android/incallui/rtt/impl/res/layout/frag_rtt_chat.xml
+++ b/java/com/android/incallui/rtt/impl/res/layout/frag_rtt_chat.xml
@@ -19,8 +19,6 @@
android:layout_height="match_parent"
android:fitsSystemWindows="true">
- <include layout="@layout/rtt_banner"/>
-
<android.support.v7.widget.RecyclerView
android:id="@+id/rtt_recycler_view"
android:layout_width="match_parent"
@@ -28,6 +26,8 @@
android:paddingBottom="70dp"
android:clipToPadding="false"/>
+ <include layout="@layout/rtt_banner"/>
+
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
@@ -75,4 +75,4 @@
android:layout_gravity="bottom"
android:clipChildren="false"
android:clipToPadding="false"/>
-</FrameLayout> \ No newline at end of file
+</FrameLayout>
diff --git a/java/com/android/incallui/rtt/impl/res/layout/overflow_menu.xml b/java/com/android/incallui/rtt/impl/res/layout/overflow_menu.xml
index a29fad5f1..eb7e38691 100644
--- a/java/com/android/incallui/rtt/impl/res/layout/overflow_menu.xml
+++ b/java/com/android/incallui/rtt/impl/res/layout/overflow_menu.xml
@@ -46,4 +46,10 @@
style="@style/RttButton"
android:drawableStart="@drawable/quantum_ic_add_call_vd_theme_24"
android:text="@string/incall_label_add_call"/>
+ <com.android.incallui.rtt.impl.RttCheckableButton
+ android:id="@+id/menu_swap_call"
+ style="@style/RttButton"
+ android:drawableStart="@drawable/quantum_ic_swap_calls_vd_theme_24"
+ android:text="@string/incall_label_swap"
+ android:visibility="gone"/>
</LinearLayout> \ No newline at end of file
diff --git a/java/com/android/incallui/rtt/impl/res/layout/rtt_banner.xml b/java/com/android/incallui/rtt/impl/res/layout/rtt_banner.xml
index f1938056f..c4d3a4290 100644
--- a/java/com/android/incallui/rtt/impl/res/layout/rtt_banner.xml
+++ b/java/com/android/incallui/rtt/impl/res/layout/rtt_banner.xml
@@ -14,64 +14,74 @@
~ See the License for the specific language governing permissions and
~ limitations under the License
-->
-<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
- android:layout_height="?attr/actionBarSize"
- android:background="#F305228F"
- android:elevation="3dp">
- <ImageButton
- android:id="@+id/rtt_end_call_button"
- android:layout_width="32dp"
- android:layout_height="32dp"
- android:layout_marginStart="16dp"
- android:layout_alignParentStart="true"
- android:layout_centerVertical="true"
- android:background="@android:color/transparent"
- android:contentDescription="@string/incall_content_description_end_call"
- android:scaleType="fitXY"
- android:src="@drawable/quantum_ic_call_end_vd_theme_24"
- android:tint="#FFDF0000"/>
- <LinearLayout
- android:layout_width="260dp"
- android:layout_height="match_parent"
- android:layout_marginTop="8dp"
- android:layout_marginBottom="8dp"
- android:layout_marginStart="32dp"
- android:layout_toEndOf="@id/rtt_end_call_button"
- android:orientation="vertical">
- <TextView
- android:id="@+id/rtt_name_or_number"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="center_horizontal"
- android:fontFamily="sans-serif-medium"
- android:includeFontPadding="false"
- android:textColor="#FFFFFF"
- android:textSize="20sp"
- tools:text="Bruce Graham"/>
- <Chronometer
- android:id="@+id/rtt_timer"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="center_horizontal"
- android:fontFamily="sans-serif-medium"
- android:includeFontPadding="false"
- android:textColor="#FFFFFF"
- android:textSize="14sp"
- tools:text="00:09"/>
- </LinearLayout>
- <ImageButton
- android:id="@+id/rtt_overflow_button"
- android:layout_width="32dp"
- android:layout_height="32dp"
- android:layout_marginEnd="12dp"
- android:layout_alignParentEnd="true"
- android:layout_centerVertical="true"
- android:background="@android:color/transparent"
- android:contentDescription="@string/content_description_overflow"
- android:scaleType="fitXY"
- android:src="@drawable/quantum_ic_more_vert_vd_theme_24"
- android:tint="#FFFFFF"/>
+ android:layout_height="wrap_content"
+ android:orientation="vertical">
+ <RelativeLayout
+ android:layout_width="match_parent"
+ android:layout_height="?attr/actionBarSize"
+ android:background="#F305228F"
+ android:elevation="3dp">
+ <ImageButton
+ android:id="@+id/rtt_end_call_button"
+ android:layout_width="32dp"
+ android:layout_height="32dp"
+ android:layout_marginStart="16dp"
+ android:layout_alignParentStart="true"
+ android:layout_centerVertical="true"
+ android:background="@android:color/transparent"
+ android:contentDescription="@string/incall_content_description_end_call"
+ android:scaleType="fitXY"
+ android:src="@drawable/quantum_ic_call_end_vd_theme_24"
+ android:tint="#FFDF0000"/>
+ <LinearLayout
+ android:layout_width="260dp"
+ android:layout_height="match_parent"
+ android:layout_marginTop="8dp"
+ android:layout_marginBottom="8dp"
+ android:layout_marginStart="32dp"
+ android:layout_toEndOf="@id/rtt_end_call_button"
+ android:orientation="vertical">
+ <TextView
+ android:id="@+id/rtt_name_or_number"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center_horizontal"
+ android:fontFamily="sans-serif-medium"
+ android:includeFontPadding="false"
+ android:textColor="#FFFFFF"
+ android:textSize="20sp"
+ tools:text="Bruce Graham"/>
+ <Chronometer
+ android:id="@+id/rtt_timer"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center_horizontal"
+ android:fontFamily="sans-serif-medium"
+ android:includeFontPadding="false"
+ android:textColor="#FFFFFF"
+ android:textSize="14sp"
+ tools:text="00:09"/>
+ </LinearLayout>
+ <ImageButton
+ android:id="@+id/rtt_overflow_button"
+ android:layout_width="32dp"
+ android:layout_height="32dp"
+ android:layout_marginEnd="12dp"
+ android:layout_alignParentEnd="true"
+ android:layout_centerVertical="true"
+ android:background="@android:color/transparent"
+ android:contentDescription="@string/content_description_overflow"
+ android:scaleType="fitXY"
+ android:src="@drawable/quantum_ic_more_vert_vd_theme_24"
+ android:tint="#FFFFFF"/>
-</RelativeLayout> \ No newline at end of file
+ </RelativeLayout>
+ <FrameLayout
+ android:id="@id/rtt_on_hold_banner"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"/>
+
+</LinearLayout> \ No newline at end of file
diff --git a/java/com/android/incallui/rtt/impl/res/values/ids.xml b/java/com/android/incallui/rtt/impl/res/values/ids.xml
new file mode 100644
index 000000000..3e4755b7c
--- /dev/null
+++ b/java/com/android/incallui/rtt/impl/res/values/ids.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ Copyright (C) 2018 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
+ -->
+<resources>
+ <item name="rtt_on_hold_banner" type="id"/>
+</resources>