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

pull/2410/head
kunfei 2 years ago
parent 44cb7e5644
commit bd2cc750c0
  1. 18
      app/src/main/java/io/legado/app/ui/book/search/SearchActivity.kt
  2. 27
      app/src/main/res/layout/activity_book_search.xml
  3. 2
      app/src/main/res/values-es-rES/strings.xml
  4. 2
      app/src/main/res/values-ja-rJP/strings.xml
  5. 2
      app/src/main/res/values-pt-rBR/strings.xml
  6. 2
      app/src/main/res/values-zh-rHK/strings.xml
  7. 2
      app/src/main/res/values-zh-rTW/strings.xml
  8. 2
      app/src/main/res/values-zh/strings.xml
  9. 2
      app/src/main/res/values/strings.xml

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

@ -36,7 +36,7 @@
</io.legado.app.ui.widget.dynamiclayout.DynamicFrameLayout> </io.legado.app.ui.widget.dynamiclayout.DynamicFrameLayout>
<LinearLayout <LinearLayout
android:id="@+id/ll_history" android:id="@+id/ll_input_help"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="0dp" android:layout_height="0dp"
android:background="@color/background" android:background="@color/background"
@ -47,6 +47,31 @@
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toBottomOf="@id/title_bar"> 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 <TextView
android:id="@+id/tv_book_show" android:id="@+id/tv_book_show"
android:layout_width="match_parent" android:layout_width="match_parent"

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

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

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

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

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

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

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

Loading…
Cancel
Save