Browse Source

Merge branch 'bugfix/28-fix-app-crash-on-search' into 'develop'

#28: Create adapter after repo initialization

See merge request funkwhale/funkwhale-android!106
housekeeping/mavenCentral
Ryan Harg 3 years ago
parent
commit
e67f7a787b
  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() {
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 {

Loading…
Cancel
Save