Browse Source

#28: Create adapter after repo initialization

housekeeping/mavenCentral
Ryan Harg 3 years ago
parent
commit
2891214eac
No known key found for this signature in database
GPG Key ID: 89106F3A84E6958C
  1. 22
      app/src/main/java/audio/funkwhale/ffa/activities/SearchActivity.kt

22
app/src/main/java/audio/funkwhale/ffa/activities/SearchActivity.kt

@ -52,17 +52,6 @@ class SearchActivity : AppCompatActivity() { @@ -52,17 +52,6 @@ class SearchActivity : AppCompatActivity() {
setContentView(binding.root)
adapter =
SearchAdapter(
layoutInflater,
this,
SearchResultClickListener(),
FavoriteListener(favoritesRepository)
).also {
binding.results.layoutManager = LinearLayoutManager(this)
binding.results.adapter = it
}
binding.search.requestFocus()
}
@ -97,6 +86,17 @@ class SearchActivity : AppCompatActivity() { @@ -97,6 +86,17 @@ class SearchActivity : AppCompatActivity() {
tracksRepository = TracksSearchRepository(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 {
override fun onQueryTextSubmit(rawQuery: String?): Boolean {

Loading…
Cancel
Save