diff options
author | Treehugger Robot <treehugger-gerrit@google.com> | 2018-03-09 03:49:25 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2018-03-09 03:49:25 +0000 |
commit | 261cba95c73cdc16b71b0ec1e7cdc6ff5d11a6ad (patch) | |
tree | 229cf7328d1d4d4688749fea4cd871ccbe6fc66b | |
parent | 31fec1d4fbe878d9b28685b8b811f1488edff443 (diff) | |
parent | fd4c9f75aa2eba3e6a896d107f05ff370c2ad2b1 (diff) |
Merge "Add support of dialpad in RTT call."
7 files changed, 46 insertions, 8 deletions
diff --git a/java/com/android/dialer/dialpadview/res/layout/dialpad.xml b/java/com/android/dialer/dialpadview/res/layout/dialpad.xml index 0061d5497..fe4e28664 100644 --- a/java/com/android/dialer/dialpadview/res/layout/dialpad.xml +++ b/java/com/android/dialer/dialpadview/res/layout/dialpad.xml @@ -96,6 +96,7 @@ <Space style="@style/DialpadSpaceStyle"/> </LinearLayout> <Space + android:id="@+id/end_call_space" android:layout_width="match_parent" android:layout_height="?attr/dialpad_end_key_spacing"/> </LinearLayout> diff --git a/java/com/android/incallui/DialpadFragment.java b/java/com/android/incallui/DialpadFragment.java index 44eaf212a..343cb34fd 100644 --- a/java/com/android/incallui/DialpadFragment.java +++ b/java/com/android/incallui/DialpadFragment.java @@ -84,6 +84,8 @@ public class DialpadFragment extends BaseFragment<DialpadPresenter, DialpadUi> private DtmfKeyListener dtmfKeyListener; private DialpadView dialpadView; private int currentTextColor; + private View endCallSpace; + private boolean shouldShowEndCallSpace = true; @Override public void onClick(View v) { @@ -152,6 +154,7 @@ public class DialpadFragment extends BaseFragment<DialpadPresenter, DialpadUi> View backButton = dialpadView.findViewById(R.id.dialpad_back); backButton.setVisibility(View.VISIBLE); backButton.setOnClickListener(this); + endCallSpace = dialpadView.findViewById(R.id.end_call_space); return parent; } @@ -160,6 +163,7 @@ public class DialpadFragment extends BaseFragment<DialpadPresenter, DialpadUi> public void onResume() { super.onResume(); updateColors(); + endCallSpace.setVisibility(shouldShowEndCallSpace ? View.VISIBLE : View.GONE); } public void updateColors() { @@ -268,6 +272,10 @@ public class DialpadFragment extends BaseFragment<DialpadPresenter, DialpadUi> } } + public void setShouldShowEndCallSpace(boolean show) { + shouldShowEndCallSpace = show; + } + /** * LinearLayout with getter and setter methods for the translationY property using floats, for * animation purposes. diff --git a/java/com/android/incallui/InCallActivity.java b/java/com/android/incallui/InCallActivity.java index dee5e7eb1..6f2ad8bf3 100644 --- a/java/com/android/incallui/InCallActivity.java +++ b/java/com/android/incallui/InCallActivity.java @@ -830,7 +830,7 @@ public class InCallActivity extends TransactionSafeFragmentActivity // Note: onInCallScreenDialpadVisibilityChange is called here to ensure that the dialpad FAB // repositions itself. - getInCallScreen().onInCallScreenDialpadVisibilityChange(show); + getInCallOrRttCallScreen().onInCallScreenDialpadVisibilityChange(show); } private void showDialpadFragment() { @@ -842,11 +842,15 @@ public class InCallActivity extends TransactionSafeFragmentActivity FragmentTransaction transaction = dialpadFragmentManager.beginTransaction(); DialpadFragment dialpadFragment = getDialpadFragment(); if (dialpadFragment == null) { - transaction.add(getDialpadContainerId(), new DialpadFragment(), Tags.DIALPAD_FRAGMENT); + dialpadFragment = new DialpadFragment(); + transaction.add(getDialpadContainerId(), dialpadFragment, Tags.DIALPAD_FRAGMENT); } else { transaction.show(dialpadFragment); dialpadFragment.setUserVisibleHint(true); } + // RTT call screen doesn't show end call button inside dialpad, thus the space reserved for end + // call button should be removed. + dialpadFragment.setShouldShowEndCallSpace(didShowInCallScreen); transaction.commitAllowingStateLoss(); dialpadFragmentManager.executePendingTransactions(); @@ -967,7 +971,7 @@ public class InCallActivity extends TransactionSafeFragmentActivity } public boolean getCallCardFragmentVisible() { - return didShowInCallScreen || didShowVideoCallScreen; + return didShowInCallScreen || didShowVideoCallScreen || didShowRttCallScreen; } public void dismissKeyguard(boolean dismiss) { @@ -1100,7 +1104,7 @@ public class InCallActivity extends TransactionSafeFragmentActivity @Nullable public FragmentManager getDialpadFragmentManager() { - InCallScreen inCallScreen = getInCallScreen(); + InCallScreen inCallScreen = getInCallOrRttCallScreen(); if (inCallScreen != null) { return inCallScreen.getInCallScreenFragment().getChildFragmentManager(); } @@ -1108,7 +1112,7 @@ public class InCallActivity extends TransactionSafeFragmentActivity } public int getDialpadContainerId() { - return getInCallScreen().getAnswerAndDialpadContainerResourceId(); + return getInCallOrRttCallScreen().getAnswerAndDialpadContainerResourceId(); } @Override @@ -1586,6 +1590,17 @@ public class InCallActivity extends TransactionSafeFragmentActivity return (RttCallScreen) getSupportFragmentManager().findFragmentByTag(Tags.RTT_CALL_SCREEN); } + private InCallScreen getInCallOrRttCallScreen() { + InCallScreen inCallScreen = null; + if (didShowInCallScreen) { + inCallScreen = getInCallScreen(); + } + if (didShowRttCallScreen) { + inCallScreen = getRttCallScreen(); + } + return inCallScreen; + } + @Override public void onPseudoScreenStateChanged(boolean isOn) { LogUtil.i("InCallActivity.onPseudoScreenStateChanged", "isOn: " + isOn); diff --git a/java/com/android/incallui/rtt/impl/RttChatFragment.java b/java/com/android/incallui/rtt/impl/RttChatFragment.java index 5094c318e..f9c91e5fb 100644 --- a/java/com/android/incallui/rtt/impl/RttChatFragment.java +++ b/java/com/android/incallui/rtt/impl/RttChatFragment.java @@ -333,11 +333,13 @@ public class RttChatFragment extends Fragment public void updateInCallScreenColors() {} @Override - public void onInCallScreenDialpadVisibilityChange(boolean isShowing) {} + public void onInCallScreenDialpadVisibilityChange(boolean isShowing) { + overflowMenu.setDialpadButtonChecked(isShowing); + } @Override public int getAnswerAndDialpadContainerResourceId() { - return 0; + return R.id.incall_dialpad_container; } @Override diff --git a/java/com/android/incallui/rtt/impl/RttOverflowMenu.java b/java/com/android/incallui/rtt/impl/RttOverflowMenu.java index 2b56364be..cca36318e 100644 --- a/java/com/android/incallui/rtt/impl/RttOverflowMenu.java +++ b/java/com/android/incallui/rtt/impl/RttOverflowMenu.java @@ -87,4 +87,8 @@ public class RttOverflowMenu extends PopupWindow implements OnCheckedChangeListe speakerButton.setOnCheckedChangeListener(null); } } + + void setDialpadButtonChecked(boolean isChecked) { + dialpadButton.setChecked(isChecked); + } } 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 d85075106..3194b75bc 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 @@ -67,4 +67,11 @@ android:tint="@color/submit_button_color"/> </LinearLayout> + <FrameLayout + android:id="@+id/incall_dialpad_container" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_gravity="bottom" + android:clipChildren="false" + android:clipToPadding="false"/> </FrameLayout>
\ No newline at end of file diff --git a/java/com/android/incallui/rtt/protocol/RttCallScreen.java b/java/com/android/incallui/rtt/protocol/RttCallScreen.java index 916dfb84d..531b18df6 100644 --- a/java/com/android/incallui/rtt/protocol/RttCallScreen.java +++ b/java/com/android/incallui/rtt/protocol/RttCallScreen.java @@ -17,9 +17,10 @@ package com.android.incallui.rtt.protocol; import android.support.v4.app.Fragment; +import com.android.incallui.incall.protocol.InCallScreen; /** Interface for call RTT call module. */ -public interface RttCallScreen { +public interface RttCallScreen extends InCallScreen { void onRttScreenStart(); |