diff --git a/app/src/main/java/io/legado/app/ui/search/SearchActivity.kt b/app/src/main/java/io/legado/app/ui/search/SearchActivity.kt index b2f662875..e09085223 100644 --- a/app/src/main/java/io/legado/app/ui/search/SearchActivity.kt +++ b/app/src/main/java/io/legado/app/ui/search/SearchActivity.kt @@ -1,9 +1,11 @@ package io.legado.app.ui.search import android.os.Bundle +import android.view.View import io.legado.app.R import io.legado.app.base.BaseActivity import io.legado.app.utils.getViewModel +import kotlinx.android.synthetic.main.view_title_bar.* class SearchActivity : BaseActivity() { @@ -14,7 +16,19 @@ class SearchActivity : BaseActivity() { get() = R.layout.activity_search override fun onViewModelCreated(viewModel: SearchViewModel, savedInstanceState: Bundle?) { + initSearchView() viewModel.search() } + private fun initSearchView() { + search_view.visibility = View.VISIBLE + search_view.onActionViewExpanded() + search_view.isSubmitButtonEnabled = true + search_view.queryHint = getString(R.string.search_book_key) + search_view.clearFocus() + intent.getStringExtra("key")?.let { + search_view.setQuery(it, true) + } + } + }