This commit is contained in:
kunfei
2023-04-18 10:57:06 +08:00
parent e03b2d7c7e
commit 24e352cccc
5 changed files with 20 additions and 2 deletions
@@ -77,8 +77,8 @@ abstract class BaseActivity<VB : ViewBinding>(
findViewById<TitleBar>(R.id.title_bar)
?.onMultiWindowModeChanged(isInMultiWindowMode, fullScreen)
}
onActivityCreated(savedInstanceState)
observeLiveBus()
onActivityCreated(savedInstanceState)
}
@RequiresApi(Build.VERSION_CODES.O)
@@ -32,8 +32,8 @@ abstract class BaseFragment(@LayoutRes layoutID: Int) : Fragment(layoutID),
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
onMultiWindowModeChanged()
onFragmentCreated(view, savedInstanceState)
observeLiveBus()
onFragmentCreated(view, savedInstanceState)
}
abstract fun onFragmentCreated(view: View, savedInstanceState: Bundle?)
@@ -7,6 +7,7 @@ import android.view.MotionEvent
import android.widget.EditText
import androidx.activity.viewModels
import androidx.appcompat.widget.SearchView
import androidx.core.view.allViews
import io.legado.app.R
import io.legado.app.base.VMBaseActivity
import io.legado.app.constant.AppLog
@@ -119,6 +120,13 @@ class SearchContentActivity :
mLayoutManager.scrollToPositionWithOffset(adapter.itemCount - 1, 0)
}
}
binding.tvCurrentSearchInfo.setOnClickListener {
searchView.allViews.forEach { view ->
if (view is EditText) {
view.showSoftInput()
}
}
}
binding.fbStop.setOnClickListener {
searchJob?.cancel()
}
@@ -10,6 +10,7 @@ import android.os.Build
import android.text.Html
import android.view.View
import android.view.View.*
import android.view.inputmethod.InputMethodManager
import android.widget.*
import androidx.annotation.ColorInt
import androidx.appcompat.app.AppCompatActivity
@@ -41,6 +42,11 @@ fun View.hideSoftInput() = run {
inputMethodManager.hideSoftInputFromWindow(this.windowToken, 0)
}
fun View.showSoftInput() = run {
requestFocus()
inputMethodManager.showSoftInput(this, InputMethodManager.RESULT_SHOWN)
}
fun View.disableAutoFill() = run {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
this.importantForAutofill = IMPORTANT_FOR_AUTOFILL_NO_EXCLUDE_DESCENDANTS