diff options
author | wangqi <wangqi@google.com> | 2018-03-09 16:33:43 -0800 |
---|---|---|
committer | Copybara-Service <copybara-piper@google.com> | 2018-03-09 16:51:18 -0800 |
commit | d6cb3b9ac4db86cc5d37174a6e6c4d69c8a8a753 (patch) | |
tree | a1e6fdb33da1aca98b2f12133ccfa1e03b7c441d /java/com/android/incallui/rtt/impl/RttChatFragment.java | |
parent | 909073ecd295b7e31965ea9e614673b66e97dbbf (diff) |
Dismiss keyboard when opening overflow menu in RTT call.
This is to prevent dialpad showing with keyboard open.
The alternative way to dismiss keyboard after dialpad shows up doesn't work.
Bug: 67596257
Test: manual
PiperOrigin-RevId: 188556453
Change-Id: I4b917d8ac83246d2002641ae7759261699149c65
Diffstat (limited to 'java/com/android/incallui/rtt/impl/RttChatFragment.java')
-rw-r--r-- | java/com/android/incallui/rtt/impl/RttChatFragment.java | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/java/com/android/incallui/rtt/impl/RttChatFragment.java b/java/com/android/incallui/rtt/impl/RttChatFragment.java index 9e8a24a48..e35ff4d73 100644 --- a/java/com/android/incallui/rtt/impl/RttChatFragment.java +++ b/java/com/android/incallui/rtt/impl/RttChatFragment.java @@ -37,7 +37,6 @@ 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; import android.widget.EditText; import android.widget.ImageButton; @@ -46,6 +45,7 @@ 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.dialer.common.UiUtil; import com.android.incallui.audioroute.AudioRouteSelectorDialogFragment; import com.android.incallui.audioroute.AudioRouteSelectorDialogFragment.AudioRouteSelectorPresenter; import com.android.incallui.call.DialerCall.State; @@ -87,7 +87,7 @@ public class RttChatFragment extends Fragment @Override public void onScrolled(RecyclerView recyclerView, int dx, int dy) { if (dy < 0) { - hideKeyboard(); + UiUtil.hideKeyboardFrom(getContext(), editText); } } }; @@ -182,7 +182,13 @@ public class RttChatFragment extends Fragment overflowMenu = new RttOverflowMenu(getContext(), inCallButtonUiDelegate); view.findViewById(R.id.rtt_overflow_button) - .setOnClickListener(v -> overflowMenu.showAtLocation(v, Gravity.TOP | Gravity.RIGHT, 0, 0)); + .setOnClickListener( + v -> { + // Hide keyboard when opening overflow menu. This is alternative solution since hiding + // keyboard after the menu is open or dialpad is shown doesn't work. + UiUtil.hideKeyboardFrom(getContext(), editText); + overflowMenu.showAtLocation(v, Gravity.TOP | Gravity.RIGHT, 0, 0); + }); nameTextView = view.findViewById(R.id.rtt_name_or_number); chronometer = view.findViewById(R.id.rtt_timer); @@ -265,14 +271,6 @@ public class RttChatFragment extends Fragment onRttScreenStop(); } - private void hideKeyboard() { - InputMethodManager inputMethodManager = getContext().getSystemService(InputMethodManager.class); - if (inputMethodManager.isAcceptingText()) { - inputMethodManager.hideSoftInputFromWindow( - getActivity().getCurrentFocus().getWindowToken(), 0); - } - } - @Override public void onRttScreenStart() { rttCallScreenDelegate.onRttCallScreenUiReady(); |