From f9ebd4ac8d497108a0ae8a64be87d5a9ea70b8e3 Mon Sep 17 00:00:00 2001 From: kunfei Date: Thu, 25 Jul 2019 21:53:49 +0800 Subject: [PATCH] up --- .../java/io/legado/app/ui/search/SearchActivity.kt | 14 ++++++++++++++ 1 file changed, 14 insertions(+) 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) + } + } + }