|
|
@ -20,8 +20,7 @@ class ChangeSourceDialog(val name: String, val author: String) : DialogFragment( |
|
|
|
override fun onViewCreated(view: View, savedInstanceState: Bundle?) { |
|
|
|
override fun onViewCreated(view: View, savedInstanceState: Bundle?) { |
|
|
|
super.onViewCreated(view, savedInstanceState) |
|
|
|
super.onViewCreated(view, savedInstanceState) |
|
|
|
tool_bar.inflateMenu(R.menu.search_view) |
|
|
|
tool_bar.inflateMenu(R.menu.search_view) |
|
|
|
tool_bar.title = name |
|
|
|
showTitle() |
|
|
|
tool_bar.subtitle = getString(R.string.author_show, author) |
|
|
|
|
|
|
|
initRecyclerView() |
|
|
|
initRecyclerView() |
|
|
|
initSearchView() |
|
|
|
initSearchView() |
|
|
|
} |
|
|
|
} |
|
|
@ -31,12 +30,25 @@ class ChangeSourceDialog(val name: String, val author: String) : DialogFragment( |
|
|
|
dialog?.window?.setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT) |
|
|
|
dialog?.window?.setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private fun showTitle() { |
|
|
|
|
|
|
|
tool_bar.title = name |
|
|
|
|
|
|
|
tool_bar.subtitle = getString(R.string.author_show, author) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private fun initRecyclerView() { |
|
|
|
private fun initRecyclerView() { |
|
|
|
recycler_view.layoutManager = LinearLayoutManager(context) |
|
|
|
recycler_view.layoutManager = LinearLayoutManager(context) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private fun initSearchView() { |
|
|
|
private fun initSearchView() { |
|
|
|
val searchView = tool_bar.menu.findItem(R.id.menu_search).actionView as SearchView |
|
|
|
val searchView = tool_bar.menu.findItem(R.id.menu_search).actionView as SearchView |
|
|
|
|
|
|
|
searchView.setOnCloseListener { |
|
|
|
|
|
|
|
showTitle() |
|
|
|
|
|
|
|
false |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
searchView.setOnSearchClickListener { |
|
|
|
|
|
|
|
tool_bar.title = "" |
|
|
|
|
|
|
|
tool_bar.subtitle = "" |
|
|
|
|
|
|
|
} |
|
|
|
searchView.setOnQueryTextListener(object : SearchView.OnQueryTextListener { |
|
|
|
searchView.setOnQueryTextListener(object : SearchView.OnQueryTextListener { |
|
|
|
override fun onQueryTextSubmit(query: String?): Boolean { |
|
|
|
override fun onQueryTextSubmit(query: String?): Boolean { |
|
|
|
return false |
|
|
|
return false |
|
|
|