搜索添加搜索范围可选择单个书源和分组,未完成

This commit is contained in:
kunfei 2022-10-10 23:07:53 +08:00
parent 44cb7e5644
commit bd2cc750c0
9 changed files with 49 additions and 10 deletions

View File

@ -92,7 +92,7 @@ class SearchActivity : VMBaseActivity<ActivityBookSearchBinding, SearchViewModel
}
override fun onActivityCreated(savedInstanceState: Bundle?) {
binding.llHistory.setBackgroundColor(backgroundColor)
binding.llInputHelp.setBackgroundColor(backgroundColor)
viewModel.searchFinishCallback = searchFinishCallback
initRecyclerView()
initSearchView()
@ -158,7 +158,7 @@ class SearchActivity : VMBaseActivity<ActivityBookSearchBinding, SearchViewModel
viewModel.searchKey = ""
viewModel.search(it)
}
openOrCloseHistory(false)
visibleInputHelp(false)
return true
}
@ -172,10 +172,10 @@ class SearchActivity : VMBaseActivity<ActivityBookSearchBinding, SearchViewModel
if (!hasFocus && searchView.query.toString().trim().isEmpty()) {
finish()
} else {
openOrCloseHistory(hasFocus)
visibleInputHelp(hasFocus)
}
}
openOrCloseHistory(true)
visibleInputHelp(true)
}
private fun initRecyclerView() {
@ -275,14 +275,14 @@ class SearchActivity : VMBaseActivity<ActivityBookSearchBinding, SearchViewModel
}
/**
* 打开关闭历史界面
* 打开关闭输入帮助
*/
private fun openOrCloseHistory(open: Boolean) {
if (open) {
private fun visibleInputHelp(visible: Boolean) {
if (visible) {
upHistory(searchView.query.toString())
binding.llHistory.visibility = VISIBLE
binding.llInputHelp.visibility = VISIBLE
} else {
binding.llHistory.visibility = GONE
binding.llInputHelp.visibility = GONE
}
}

View File

@ -36,7 +36,7 @@
</io.legado.app.ui.widget.dynamiclayout.DynamicFrameLayout>
<LinearLayout
android:id="@+id/ll_history"
android:id="@+id/ll_input_help"
android:layout_width="match_parent"
android:layout_height="0dp"
android:background="@color/background"
@ -47,6 +47,31 @@
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toBottomOf="@id/title_bar">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:padding="6dp"
android:text="@string/search_scope" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="6dp"
android:text="@string/toggle_search_scope" />
</LinearLayout>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_search_scope"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<TextView
android:id="@+id/tv_book_show"
android:layout_width="match_parent"

View File

@ -1040,4 +1040,6 @@
<string name="source_edit_text_max_line">源编辑框最大行数</string>
<string name="source_edit_max_line_summary">%s,设置行数小于屏幕可显示的最大行数可以更方便的滑动到其他的字段进行编辑</string>
<string name="restore_last_book_process">是否恢复到跳转前的阅读进度?</string>
<string name="search_scope">搜索范围</string>
<string name="toggle_search_scope">切换</string>
</resources>

View File

@ -1043,4 +1043,6 @@
<string name="source_edit_text_max_line">源编辑框最大行数</string>
<string name="source_edit_max_line_summary">%s,设置行数小于屏幕可显示的最大行数可以更方便的滑动到其他的字段进行编辑</string>
<string name="restore_last_book_process">是否恢复到跳转前的阅读进度?</string>
<string name="search_scope">搜索范围</string>
<string name="toggle_search_scope">切换</string>
</resources>

View File

@ -1043,4 +1043,6 @@
<string name="source_edit_text_max_line">源编辑框最大行数</string>
<string name="source_edit_max_line_summary">%s,设置行数小于屏幕可显示的最大行数可以更方便的滑动到其他的字段进行编辑</string>
<string name="restore_last_book_process">是否恢复到跳转前的阅读进度?</string>
<string name="search_scope">搜索范围</string>
<string name="toggle_search_scope">切换</string>
</resources>

View File

@ -1040,4 +1040,6 @@
<string name="source_edit_text_max_line">源编辑框最大行数</string>
<string name="source_edit_max_line_summary">%s,设置行数小于屏幕可显示的最大行数可以更方便的滑动到其他的字段进行编辑</string>
<string name="restore_last_book_process">是否恢复到跳转前的阅读进度?</string>
<string name="search_scope">搜索范围</string>
<string name="toggle_search_scope">切换</string>
</resources>

View File

@ -1042,4 +1042,6 @@
<string name="source_edit_text_max_line">源编辑框最大行数</string>
<string name="source_edit_max_line_summary">%s,设置行数小于屏幕可显示的最大行数可以更方便的滑动到其他的字段进行编辑</string>
<string name="restore_last_book_process">是否恢复到跳转前的阅读进度?</string>
<string name="search_scope">搜索范围</string>
<string name="toggle_search_scope">切换</string>
</resources>

View File

@ -1042,4 +1042,6 @@
<string name="source_edit_text_max_line">源编辑框最大行数</string>
<string name="source_edit_max_line_summary">%s,设置行数小于屏幕可显示的最大行数可以更方便的滑动到其他的字段进行编辑</string>
<string name="restore_last_book_process">是否恢复到跳转前的阅读进度?</string>
<string name="search_scope">搜索范围</string>
<string name="toggle_search_scope">切换</string>
</resources>

View File

@ -1043,4 +1043,6 @@
<string name="source_edit_text_max_line">源编辑框最大行数</string>
<string name="source_edit_max_line_summary">%s,设置行数小于屏幕可显示的最大行数可以更方便的滑动到其他的字段进行编辑</string>
<string name="restore_last_book_process">是否恢复到跳转前的阅读进度?</string>
<string name="search_scope">搜索范围</string>
<string name="toggle_search_scope">切换</string>
</resources>