summaryrefslogtreecommitdiff
path: root/java/com/android/incallui/rtt/impl
diff options
context:
space:
mode:
Diffstat (limited to 'java/com/android/incallui/rtt/impl')
-rw-r--r--java/com/android/incallui/rtt/impl/AndroidManifest.xml11
-rw-r--r--java/com/android/incallui/rtt/impl/RttChatActivity.java41
-rw-r--r--java/com/android/incallui/rtt/impl/RttChatFragment.java223
-rw-r--r--java/com/android/incallui/rtt/impl/res/layout/activity_rtt.xml26
-rw-r--r--java/com/android/incallui/rtt/impl/res/layout/frag_rtt_chat.xml5
-rw-r--r--java/com/android/incallui/rtt/impl/res/layout/rtt_banner.xml64
-rw-r--r--java/com/android/incallui/rtt/impl/res/values/colors.xml3
-rw-r--r--java/com/android/incallui/rtt/impl/res/values/strings.xml3
8 files changed, 233 insertions, 143 deletions
diff --git a/java/com/android/incallui/rtt/impl/AndroidManifest.xml b/java/com/android/incallui/rtt/impl/AndroidManifest.xml
index fc0705d7e..7f58f71e5 100644
--- a/java/com/android/incallui/rtt/impl/AndroidManifest.xml
+++ b/java/com/android/incallui/rtt/impl/AndroidManifest.xml
@@ -13,14 +13,5 @@
~ See the License for the specific language governing permissions and
~ limitations under the License
-->
-<manifest
- package="com.android.incallui.rtt.impl"
- xmlns:android="http://schemas.android.com/apk/res/android">
- <application android:theme="@style/Theme.AppCompat">
- <activity
- android:name=".RttChatActivity"
- android:exported="false"
- android:theme="@style/DialerThemeBase.NoActionBar"
- android:windowSoftInputMode="adjustResize"/>
- </application>
+<manifest package="com.android.incallui.rtt.impl">
</manifest>
diff --git a/java/com/android/incallui/rtt/impl/RttChatActivity.java b/java/com/android/incallui/rtt/impl/RttChatActivity.java
deleted file mode 100644
index 96056f746..000000000
--- a/java/com/android/incallui/rtt/impl/RttChatActivity.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * 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
- */
-
-package com.android.incallui.rtt.impl;
-
-import android.os.Bundle;
-import android.os.SystemClock;
-import android.support.annotation.Nullable;
-import android.support.v4.app.FragmentActivity;
-import android.view.View;
-
-/** Activity to for RTT chat window. */
-public class RttChatActivity extends FragmentActivity {
-
- @Override
- protected void onCreate(@Nullable Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_rtt);
- getSupportFragmentManager()
- .beginTransaction()
- .add(
- R.id.fragment_rtt,
- RttChatFragment.newInstance("", "Jane Williamson", SystemClock.elapsedRealtime()))
- .commit();
- getWindow().setStatusBarColor(getColor(R.color.rtt_status_bar_color));
- getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
- }
-}
diff --git a/java/com/android/incallui/rtt/impl/RttChatFragment.java b/java/com/android/incallui/rtt/impl/RttChatFragment.java
index 0b0ad2a8e..82dce3ed4 100644
--- a/java/com/android/incallui/rtt/impl/RttChatFragment.java
+++ b/java/com/android/incallui/rtt/impl/RttChatFragment.java
@@ -16,21 +16,25 @@
package com.android.incallui.rtt.impl;
+import android.app.Activity;
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.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.RecyclerView.OnScrollListener;
+import android.telecom.CallAudioState;
import android.text.Editable;
import android.text.TextUtils;
import android.text.TextWatcher;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.View;
-import android.view.View.OnClickListener;
import android.view.ViewGroup;
+import android.view.Window;
+import android.view.accessibility.AccessibilityEvent;
import android.view.inputmethod.EditorInfo;
import android.view.inputmethod.InputMethodManager;
import android.widget.Chronometer;
@@ -38,11 +42,31 @@ import android.widget.EditText;
import android.widget.ImageButton;
import android.widget.TextView;
import android.widget.TextView.OnEditorActionListener;
+import com.android.dialer.common.Assert;
+import com.android.dialer.common.FragmentUtils;
+import com.android.dialer.common.LogUtil;
+import com.android.incallui.incall.protocol.InCallButtonUi;
+import com.android.incallui.incall.protocol.InCallButtonUiDelegate;
+import com.android.incallui.incall.protocol.InCallButtonUiDelegateFactory;
+import com.android.incallui.incall.protocol.InCallScreen;
+import com.android.incallui.incall.protocol.InCallScreenDelegate;
+import com.android.incallui.incall.protocol.InCallScreenDelegateFactory;
+import com.android.incallui.incall.protocol.PrimaryCallState;
+import com.android.incallui.incall.protocol.PrimaryInfo;
+import com.android.incallui.incall.protocol.SecondaryInfo;
import com.android.incallui.rtt.impl.RttChatAdapter.MessageListener;
+import com.android.incallui.rtt.protocol.RttCallScreen;
+import com.android.incallui.rtt.protocol.RttCallScreenDelegate;
+import com.android.incallui.rtt.protocol.RttCallScreenDelegateFactory;
/** RTT chat fragment to show chat bubbles. */
public class RttChatFragment extends Fragment
- implements OnClickListener, OnEditorActionListener, TextWatcher, MessageListener {
+ implements OnEditorActionListener,
+ TextWatcher,
+ MessageListener,
+ RttCallScreen,
+ InCallScreen,
+ InCallButtonUi {
private static final String ARG_CALL_ID = "call_id";
private static final String ARG_NAME_OR_NUMBER = "name_or_number";
@@ -63,27 +87,58 @@ public class RttChatFragment extends Fragment
}
}
};
+ private InCallScreenDelegate inCallScreenDelegate;
+ private RttCallScreenDelegate rttCallScreenDelegate;
+ private InCallButtonUiDelegate inCallButtonUiDelegate;
+ private View endCallButton;
/**
* Create a new instance of RttChatFragment.
*
* @param callId call id of the RTT call.
- * @param nameOrNumber name or number of the caller to be displayed
- * @param sessionStartTimeMillis start time of RTT session in terms of {@link
- * SystemClock#elapsedRealtime}.
* @return new RttChatFragment
*/
- public static RttChatFragment newInstance(
- String callId, String nameOrNumber, long sessionStartTimeMillis) {
+ public static RttChatFragment newInstance(String callId) {
Bundle bundle = new Bundle();
bundle.putString(ARG_CALL_ID, callId);
- bundle.putString(ARG_NAME_OR_NUMBER, nameOrNumber);
- bundle.putLong(ARG_SESSION_START_TIME, sessionStartTimeMillis);
+ bundle.putString(ARG_NAME_OR_NUMBER, "Jane Williamson");
+ bundle.putLong(ARG_SESSION_START_TIME, SystemClock.elapsedRealtime());
RttChatFragment instance = new RttChatFragment();
instance.setArguments(bundle);
return instance;
}
+ @Override
+ public void onCreate(@Nullable Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ LogUtil.i("RttChatFragment.onCreate", null);
+ inCallButtonUiDelegate =
+ FragmentUtils.getParent(this, InCallButtonUiDelegateFactory.class)
+ .newInCallButtonUiDelegate();
+ if (savedInstanceState != null) {
+ inCallButtonUiDelegate.onRestoreInstanceState(savedInstanceState);
+ }
+ }
+
+ @Override
+ public void onViewCreated(@NonNull View view, @Nullable Bundle bundle) {
+ super.onViewCreated(view, bundle);
+ LogUtil.i("RttChatFragment.onViewCreated", null);
+
+ inCallScreenDelegate =
+ FragmentUtils.getParentUnsafe(this, InCallScreenDelegateFactory.class)
+ .newInCallScreenDelegate();
+ rttCallScreenDelegate =
+ FragmentUtils.getParentUnsafe(this, RttCallScreenDelegateFactory.class)
+ .newRttCallScreenDelegate(this);
+
+ rttCallScreenDelegate.initRttCallScreenDelegate(getContext(), this);
+
+ inCallScreenDelegate.onInCallScreenDelegateInit(this);
+ inCallScreenDelegate.onInCallScreenReady();
+ inCallButtonUiDelegate.onInCallButtonUiReady(this);
+ }
+
@Nullable
@Override
public View onCreateView(
@@ -101,8 +156,20 @@ public class RttChatFragment extends Fragment
recyclerView.setAdapter(adapter);
recyclerView.addOnScrollListener(onScrollListener);
submitButton = view.findViewById(R.id.rtt_chat_submit_button);
- submitButton.setOnClickListener(this);
+ submitButton.setOnClickListener(
+ v -> {
+ adapter.submitLocalMessage();
+ isClearingInput = true;
+ editText.setText("");
+ isClearingInput = false;
+ });
submitButton.setEnabled(false);
+ endCallButton = view.findViewById(R.id.rtt_end_call_button);
+ endCallButton.setOnClickListener(
+ v -> {
+ LogUtil.i("RttChatFragment.onClick", "end call button clicked");
+ inCallButtonUiDelegate.onEndCallClicked();
+ });
String nameOrNumber = null;
Bundle bundle = getArguments();
@@ -123,16 +190,6 @@ public class RttChatFragment extends Fragment
}
@Override
- public void onClick(View v) {
- if (v.getId() == R.id.rtt_chat_submit_button) {
- adapter.submitLocalMessage();
- isClearingInput = true;
- editText.setText("");
- isClearingInput = false;
- }
- }
-
- @Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
if (actionId == EditorInfo.IME_ACTION_DONE) {
submitButton.performClick();
@@ -166,6 +223,20 @@ public class RttChatFragment extends Fragment
recyclerView.smoothScrollToPosition(adapter.getItemCount());
}
+ @Override
+ public void onStart() {
+ LogUtil.enterBlock("RttChatFragment.onStart");
+ super.onStart();
+ onRttScreenStart();
+ }
+
+ @Override
+ public void onStop() {
+ LogUtil.enterBlock("RttChatFragment.onStop");
+ super.onStop();
+ onRttScreenStop();
+ }
+
private void hideKeyboard() {
InputMethodManager inputMethodManager = getContext().getSystemService(InputMethodManager.class);
if (inputMethodManager.isAcceptingText()) {
@@ -173,4 +244,116 @@ public class RttChatFragment extends Fragment
getActivity().getCurrentFocus().getWindowToken(), 0);
}
}
+
+ @Override
+ public void onRttScreenStart() {
+ rttCallScreenDelegate.onRttCallScreenUiReady();
+ Activity activity = getActivity();
+ Window window = getActivity().getWindow();
+ window.setStatusBarColor(activity.getColor(R.color.rtt_status_bar_color));
+ window.setNavigationBarColor(activity.getColor(R.color.rtt_navigation_bar_color));
+ window.getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR);
+ }
+
+ @Override
+ public void onRttScreenStop() {
+ rttCallScreenDelegate.onRttCallScreenUiUnready();
+ }
+
+ @Override
+ public Fragment getRttCallScreenFragment() {
+ return this;
+ }
+
+ @Override
+ public String getCallId() {
+ return Assert.isNotNull(getArguments().getString(ARG_CALL_ID));
+ }
+
+ @Override
+ public void setPrimary(@NonNull PrimaryInfo primaryInfo) {
+ LogUtil.i("RttChatFragment.setPrimary", primaryInfo.toString());
+ }
+
+ @Override
+ public void setSecondary(@NonNull SecondaryInfo secondaryInfo) {}
+
+ @Override
+ public void setCallState(@NonNull PrimaryCallState primaryCallState) {}
+
+ @Override
+ public void setEndCallButtonEnabled(boolean enabled, boolean animate) {}
+
+ @Override
+ public void showManageConferenceCallButton(boolean visible) {}
+
+ @Override
+ public boolean isManageConferenceVisible() {
+ return false;
+ }
+
+ @Override
+ public void dispatchPopulateAccessibilityEvent(AccessibilityEvent event) {}
+
+ @Override
+ public void showNoteSentToast() {}
+
+ @Override
+ public void updateInCallScreenColors() {}
+
+ @Override
+ public void onInCallScreenDialpadVisibilityChange(boolean isShowing) {}
+
+ @Override
+ public int getAnswerAndDialpadContainerResourceId() {
+ return 0;
+ }
+
+ @Override
+ public void showLocationUi(Fragment locationUi) {}
+
+ @Override
+ public boolean isShowingLocationUi() {
+ return false;
+ }
+
+ @Override
+ public Fragment getInCallScreenFragment() {
+ return this;
+ }
+
+ @Override
+ public void showButton(int buttonId, boolean show) {}
+
+ @Override
+ public void enableButton(int buttonId, boolean enable) {}
+
+ @Override
+ public void setEnabled(boolean on) {}
+
+ @Override
+ public void setHold(boolean on) {}
+
+ @Override
+ public void setCameraSwitched(boolean isBackFacingCamera) {}
+
+ @Override
+ public void setVideoPaused(boolean isPaused) {}
+
+ @Override
+ public void setAudioState(CallAudioState audioState) {}
+
+ @Override
+ public void updateButtonStates() {}
+
+ @Override
+ public void updateInCallButtonUiColors(int color) {}
+
+ @Override
+ public Fragment getInCallButtonUiFragment() {
+ return this;
+ }
+
+ @Override
+ public void showAudioRouteSelector() {}
}
diff --git a/java/com/android/incallui/rtt/impl/res/layout/activity_rtt.xml b/java/com/android/incallui/rtt/impl/res/layout/activity_rtt.xml
deleted file mode 100644
index b48e8d43f..000000000
--- a/java/com/android/incallui/rtt/impl/res/layout/activity_rtt.xml
+++ /dev/null
@@ -1,26 +0,0 @@
-<?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
- -->
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:orientation="vertical"
- android:layout_width="match_parent"
- android:layout_height="match_parent">
- <FrameLayout
- android:id="@+id/fragment_rtt"
- android:layout_width="match_parent"
- android:layout_height="match_parent"/>
-
-</LinearLayout> \ No newline at end of file
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 7ba6a09e3..5ba9f4ee8 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
@@ -17,7 +17,8 @@
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
- android:background="@color/dialer_theme_color">
+ android:background="@color/dialer_theme_color"
+ android:fitsSystemWindows="true">
<include layout="@layout/rtt_banner"/>
@@ -52,6 +53,8 @@
android:inputType="textMultiLine|text"
android:maxLines="4"
android:minHeight="53dp"
+ android:textColor="#DD000000"
+ android:textColorHint="#757575"
android:textSize="16sp"/>
<ImageButton
android:id="@+id/rtt_chat_submit_button"
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 4ce94f9fb..f1938056f 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
@@ -17,79 +17,61 @@
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
- android:layout_height="56dp"
- android:background="#FAFAFA"
+ android:layout_height="?attr/actionBarSize"
+ android:background="#F305228F"
android:elevation="3dp">
<ImageButton
- android:id="@+id/rtt_back"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
+ 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/content_description_rtt_back_button"
- android:src="@drawable/quantum_ic_arrow_back_vd_theme_24"
- android:tint="#DF000000"/>
+ 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="wrap_content"
+ 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_back"
+ 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="#DD000000"
+ 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="#DD000000"
+ android:textColor="#FFFFFF"
android:textSize="14sp"
tools:text="00:09"/>
</LinearLayout>
<ImageButton
- android:id="@+id/rtt_hang_up_button"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_marginEnd="16dp"
+ 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/incall_content_description_end_call"
- android:src="@drawable/quantum_ic_call_end_vd_theme_24"
- android:tint="#FFDF0000"/>
- <ImageButton
- android:id="@+id/rtt_speaker_button"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_marginEnd="24dp"
- android:layout_centerVertical="true"
- android:layout_toStartOf="@id/rtt_hang_up_button"
- android:background="@android:color/transparent"
- android:contentDescription="@string/incall_content_description_speaker"
- android:src="@drawable/quantum_ic_volume_up_vd_theme_24"
- android:tint="#DD000000"/>
- <ImageButton
- android:id="@+id/rtt_mic_button"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_marginEnd="24dp"
- android:layout_centerVertical="true"
- android:layout_toStartOf="@id/rtt_speaker_button"
- android:background="@android:color/transparent"
- android:contentDescription="@string/incall_content_description_unmuted"
- android:src="@drawable/quantum_ic_mic_off_vd_theme_24"
- android:tint="#DD000000"/>
+ 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
diff --git a/java/com/android/incallui/rtt/impl/res/values/colors.xml b/java/com/android/incallui/rtt/impl/res/values/colors.xml
index 402cac4a0..c25ad21f2 100644
--- a/java/com/android/incallui/rtt/impl/res/values/colors.xml
+++ b/java/com/android/incallui/rtt/impl/res/values/colors.xml
@@ -15,5 +15,6 @@
~ limitations under the License
-->
<resources>
- <color name="rtt_status_bar_color">#E0E0E0</color>
+ <color name="rtt_status_bar_color">#03165C</color>
+ <color name="rtt_navigation_bar_color">#FAFAFA</color>
</resources> \ No newline at end of file
diff --git a/java/com/android/incallui/rtt/impl/res/values/strings.xml b/java/com/android/incallui/rtt/impl/res/values/strings.xml
index 523abdcbc..0b9eb71f4 100644
--- a/java/com/android/incallui/rtt/impl/res/values/strings.xml
+++ b/java/com/android/incallui/rtt/impl/res/values/strings.xml
@@ -18,9 +18,6 @@
<!-- Content description for submit chat input button. [CHAR LIMIT=NONE] -->
<string name="content_description_rtt_check_button">Go ahead</string>
- <!-- Content description for navigate back button on RTT chat window. [CHAR LIMIT=NONE] -->
- <string name="content_description_rtt_back_button">Back</string>
-
<!-- Hint text for input box. [CHAR LIMIT=NONE] -->
<string name="rtt_input_hint">Type a message</string>