hide keyboard when stopping ConversationFragment
This commit is contained in:
parent
c1135ad592
commit
b2a9c63568
|
@ -350,9 +350,8 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke
|
||||||
private AtomicBoolean mSendingPgpMessage = new AtomicBoolean(false);
|
private AtomicBoolean mSendingPgpMessage = new AtomicBoolean(false);
|
||||||
private OnEditorActionListener mEditorActionListener = (v, actionId, event) -> {
|
private OnEditorActionListener mEditorActionListener = (v, actionId, event) -> {
|
||||||
if (actionId == EditorInfo.IME_ACTION_SEND) {
|
if (actionId == EditorInfo.IME_ACTION_SEND) {
|
||||||
InputMethodManager imm = (InputMethodManager) v.getContext()
|
InputMethodManager imm = (InputMethodManager) activity.getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||||
.getSystemService(Context.INPUT_METHOD_SERVICE);
|
if (imm != null && imm.isFullscreenMode()) {
|
||||||
if (imm.isFullscreenMode()) {
|
|
||||||
imm.hideSoftInputFromWindow(v.getWindowToken(), 0);
|
imm.hideSoftInputFromWindow(v.getWindowToken(), 0);
|
||||||
}
|
}
|
||||||
sendMessage();
|
sendMessage();
|
||||||
|
@ -963,6 +962,14 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void hideSoftKeyboard(final Activity activity) {
|
||||||
|
InputMethodManager imm = (InputMethodManager) activity.getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||||
|
View view = activity.getCurrentFocus();
|
||||||
|
if (view != null && imm != null) {
|
||||||
|
imm.hideSoftInputFromWindow(view.getWindowToken(),0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void quoteMessage(Message message) {
|
private void quoteMessage(Message message) {
|
||||||
quoteText(MessageUtils.prepareQuote(message));
|
quoteText(MessageUtils.prepareQuote(message));
|
||||||
}
|
}
|
||||||
|
@ -1720,6 +1727,7 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke
|
||||||
super.onStop();
|
super.onStop();
|
||||||
final Activity activity = getActivity();
|
final Activity activity = getActivity();
|
||||||
if (activity == null || !activity.isChangingConfigurations()) {
|
if (activity == null || !activity.isChangingConfigurations()) {
|
||||||
|
hideSoftKeyboard(activity);
|
||||||
messageListAdapter.stopAudioPlayer();
|
messageListAdapter.stopAudioPlayer();
|
||||||
}
|
}
|
||||||
if (this.conversation != null) {
|
if (this.conversation != null) {
|
||||||
|
|
Loading…
Reference in a new issue