|
|
@ -52,17 +52,6 @@ class SearchActivity : AppCompatActivity() { |
|
|
|
|
|
|
|
|
|
|
|
setContentView(binding.root) |
|
|
|
setContentView(binding.root) |
|
|
|
|
|
|
|
|
|
|
|
adapter = |
|
|
|
|
|
|
|
SearchAdapter( |
|
|
|
|
|
|
|
layoutInflater, |
|
|
|
|
|
|
|
this, |
|
|
|
|
|
|
|
SearchResultClickListener(), |
|
|
|
|
|
|
|
FavoriteListener(favoritesRepository) |
|
|
|
|
|
|
|
).also { |
|
|
|
|
|
|
|
binding.results.layoutManager = LinearLayoutManager(this) |
|
|
|
|
|
|
|
binding.results.adapter = it |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
binding.search.requestFocus() |
|
|
|
binding.search.requestFocus() |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -97,6 +86,17 @@ class SearchActivity : AppCompatActivity() { |
|
|
|
tracksRepository = TracksSearchRepository(this@SearchActivity, "") |
|
|
|
tracksRepository = TracksSearchRepository(this@SearchActivity, "") |
|
|
|
favoritesRepository = FavoritesRepository(this@SearchActivity) |
|
|
|
favoritesRepository = FavoritesRepository(this@SearchActivity) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
adapter = |
|
|
|
|
|
|
|
SearchAdapter( |
|
|
|
|
|
|
|
layoutInflater, |
|
|
|
|
|
|
|
this, |
|
|
|
|
|
|
|
SearchResultClickListener(), |
|
|
|
|
|
|
|
FavoriteListener(favoritesRepository) |
|
|
|
|
|
|
|
).also { |
|
|
|
|
|
|
|
binding.results.layoutManager = LinearLayoutManager(this) |
|
|
|
|
|
|
|
binding.results.adapter = it |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
binding.search.setOnQueryTextListener(object : SearchView.OnQueryTextListener { |
|
|
|
binding.search.setOnQueryTextListener(object : SearchView.OnQueryTextListener { |
|
|
|
|
|
|
|
|
|
|
|
override fun onQueryTextSubmit(rawQuery: String?): Boolean { |
|
|
|
override fun onQueryTextSubmit(rawQuery: String?): Boolean { |
|
|
|