diff --git a/app/src/main/java/io/legado/app/ui/main/bookshelf/BookshelfFragment.kt b/app/src/main/java/io/legado/app/ui/main/bookshelf/BookshelfFragment.kt index 6245e599b..45d9b713e 100644 --- a/app/src/main/java/io/legado/app/ui/main/bookshelf/BookshelfFragment.kt +++ b/app/src/main/java/io/legado/app/ui/main/bookshelf/BookshelfFragment.kt @@ -35,6 +35,7 @@ class BookshelfFragment : BaseFragment(R.layout.fragment_bookshelf) { override fun onViewCreated(view: View, savedInstanceState: Bundle?) { setSupportToolbar(toolbar) + initSearchView() initRecyclerView() initBookGroupData() initBookshelfData() @@ -44,6 +45,13 @@ class BookshelfFragment : BaseFragment(R.layout.fragment_bookshelf) { menuInflater.inflate(R.menu.bookshelf, menu) } + private fun initSearchView() { + search_view.visibility = View.VISIBLE + search_view.onActionViewExpanded() + search_view.queryHint = getString(R.string.search_book_key) + search_view.clearFocus() + } + private fun initRecyclerView() { tv_recent_reading.textColor = ThemeStore.accentColor(tv_recent_reading.context) rv_book_group.layoutManager = LinearLayoutManager(context, LinearLayoutManager.HORIZONTAL, false) diff --git a/app/src/main/res/layout/fragment_bookshelf.xml b/app/src/main/res/layout/fragment_bookshelf.xml index 4ded61ede..c03e7560a 100644 --- a/app/src/main/res/layout/fragment_bookshelf.xml +++ b/app/src/main/res/layout/fragment_bookshelf.xml @@ -1,31 +1,39 @@ + xmlns:app="http://schemas.android.com/apk/res-auto" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:orientation="vertical"> + android:id="@+id/title_bar" + android:layout_width="match_parent" + android:layout_height="wrap_content" + app:attachToActivity="false" + app:title="@string/bookshelf"/> + android:id="@+id/rv_book_group" + android:layout_width="match_parent" + android:layout_height="wrap_content"/> + android:id="@+id/tv_recent_reading" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:padding="5dp" + android:text="@string/recent_reading"/> - + + + + + \ No newline at end of file