/** * 控制表情区和软键盘的显示 * * @param isShowKeyboard * @param isSwitch */ private void controlKeyboardOrExpr(boolean isShowKeyboard, boolean isSwitch) { if (isSwitch) { if (!isShowKeyboard) { mIsExprShow = true; mIsSoftKeyboardShow = false; mImm.hideSoftInputFromWindow(editText.getWindowToken(), 0); mUiHandler.postDelayed( new Runnable() { @Override public void run() { mExpressionWidgt.setVisibility(View.VISIBLE); } }, 100); mExprBtn.setBackgroundResource(R.drawable.selector_s_chat_keyboard); } else { mIsExprShow = false; mIsSoftKeyboardShow = true; mExpressionWidgt.setVisibility(View.GONE); mExprBtn.setBackgroundResource(R.drawable.selector_s_chat_expressions); mImm.toggleSoftInput(0, InputMethodManager.HIDE_NOT_ALWAYS); } } else { if (isShowKeyboard) { mIsExprShow = false; mIsSoftKeyboardShow = true; mExpressionWidgt.setVisibility(View.GONE); mImm.toggleSoftInput(0, InputMethodManager.HIDE_NOT_ALWAYS); } else { if (mIsSoftKeyboardShow) { mIsSoftKeyboardShow = false; mImm.hideSoftInputFromWindow(editText.getWindowToken(), 0); } else { mIsExprShow = false; mExpressionWidgt.setVisibility(View.GONE); } } mExprBtn.setBackgroundResource(R.drawable.selector_s_chat_expressions); } }
@Override public void onHideInputView() { if (!mIsExprShow && mExprBtn != null) { mExprBtn.setBackgroundResource(R.drawable.selector_s_chat_expressions); } }