Commit 88f0dbc2 authored by leichao.gao's avatar leichao.gao

收起软键盘

parent bde02d1b
......@@ -58,8 +58,14 @@ class SearchActivity : BaseActivity<ActivitySearchBinding>() {
override val binding: ActivitySearchBinding by lazy {
ActivitySearchBinding.inflate(layoutInflater)
}
fun closeIm() {
val imm = getSystemService(INPUT_METHOD_SERVICE) as InputMethodManager
if (imm != null && currentFocus != null) {
imm.hideSoftInputFromWindow(currentFocus!!.windowToken, 0)
}
}
private fun searchJump(content: String) {
closeIm()
var link = ""
LinkSearchUtils.handleInput(content, loadUrl = {
link = it
......
......@@ -4,6 +4,7 @@ package com.base.browserwhite.ui.activity.webbrowser
import android.animation.AnimatorSet
import android.animation.ObjectAnimator
import android.annotation.SuppressLint
import android.content.Context
import android.content.Intent
import android.graphics.Color
import android.text.Editable
......@@ -375,9 +376,10 @@ class WebBrowserActivity : BaseActivity<ActivityWebBrowserBinding>() {
binding.ivPageSearchClose.setOnClickListener {
binding.editPageSearch.setText("")
binding.editPageSearch.clearFocus()
binding.llPageSearch.visibility = View.GONE
binding.clBottom.visibility = View.VISIBLE
closeIm()
hideKeyboard(this,binding.editPageSearch)
}
......@@ -410,11 +412,9 @@ class WebBrowserActivity : BaseActivity<ActivityWebBrowserBinding>() {
}
}
}
fun closeIm() {
val imm = getSystemService(INPUT_METHOD_SERVICE) as InputMethodManager
if (imm != null && currentFocus != null) {
imm.hideSoftInputFromWindow(currentFocus!!.windowToken, 0)
}
fun hideKeyboard(context: Context, view: View) {
val imm = context.getSystemService(INPUT_METHOD_SERVICE) as InputMethodManager
imm?.hideSoftInputFromWindow(view.windowToken, 0)
}
fun setSearchNum(int: Int, max: Int) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment