From 744d8c28c0e642c6c8c0f274be61513dea18748b Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Fri, 2 Mar 2018 17:53:05 +0100 Subject: [PATCH] Force hide keyboard when resuming ChatCreate & ChatInfo fragments --- .../org/linphone/chat/ChatCreationFragment.java | 11 +++++++++++ src/android/org/linphone/chat/GroupInfoFragment.java | 11 +++++++++++ 2 files changed, 22 insertions(+) diff --git a/src/android/org/linphone/chat/ChatCreationFragment.java b/src/android/org/linphone/chat/ChatCreationFragment.java index 7764524eb..e99972bfa 100644 --- a/src/android/org/linphone/chat/ChatCreationFragment.java +++ b/src/android/org/linphone/chat/ChatCreationFragment.java @@ -26,6 +26,7 @@ import android.text.TextWatcher; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; +import android.view.inputmethod.InputMethodManager; import android.widget.AdapterView; import android.widget.EditText; import android.widget.HorizontalScrollView; @@ -53,6 +54,8 @@ import org.linphone.R; import java.util.ArrayList; import java.util.List; +import static android.content.Context.INPUT_METHOD_SERVICE; + public class ChatCreationFragment extends Fragment implements View.OnClickListener, AdapterView.OnItemClickListener, ContactsUpdatedListener { private LayoutInflater mInflater; private ListView mContactsList; @@ -180,6 +183,14 @@ public class ChatCreationFragment extends Fragment implements View.OnClickListen return view; } + @Override + public void onResume() { + super.onResume(); + + InputMethodManager inputMethodManager = (InputMethodManager) getActivity().getSystemService(INPUT_METHOD_SERVICE); + inputMethodManager.hideSoftInputFromWindow(getActivity().getCurrentFocus().getWindowToken(), 0); + } + @Override public void onPause() { if (mChatRoom != null) { diff --git a/src/android/org/linphone/chat/GroupInfoFragment.java b/src/android/org/linphone/chat/GroupInfoFragment.java index 27b4ba292..c10cc4c46 100644 --- a/src/android/org/linphone/chat/GroupInfoFragment.java +++ b/src/android/org/linphone/chat/GroupInfoFragment.java @@ -27,6 +27,7 @@ import android.text.TextWatcher; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; +import android.view.inputmethod.InputMethodManager; import android.widget.Button; import android.widget.EditText; import android.widget.ImageView; @@ -52,6 +53,8 @@ import org.linphone.mediastream.Log; import java.util.ArrayList; +import static android.content.Context.INPUT_METHOD_SERVICE; + public class GroupInfoFragment extends Fragment implements ChatRoomListener { private ImageView mBackButton, mConfirmButton, mAddParticipantsButton; private RelativeLayout mAddParticipantsLayout; @@ -299,6 +302,14 @@ public class GroupInfoFragment extends Fragment implements ChatRoomListener { return view; } + @Override + public void onResume() { + super.onResume(); + + InputMethodManager inputMethodManager = (InputMethodManager) getActivity().getSystemService(INPUT_METHOD_SERVICE); + inputMethodManager.hideSoftInputFromWindow(getActivity().getCurrentFocus().getWindowToken(), 0); + } + @Override public void onPause() { if (mTempChatRoom != null) {