Browse Source

#99: Initialize repository before using it

technical/update-jvmTarget-version
Ryan Harg 3 years ago committed by Ryan Harg
parent
commit
25ec60b1e5
  1. 10
      app/src/main/java/audio/funkwhale/ffa/activities/SearchActivity.kt
  2. 3
      app/src/main/java/audio/funkwhale/ffa/fragments/LandscapeQueueFragment.kt
  3. 5
      app/src/main/java/audio/funkwhale/ffa/fragments/PlaylistTracksFragment.kt

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

@ -48,6 +48,11 @@ class SearchActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
artistsRepository = ArtistsSearchRepository(this@SearchActivity, "")
albumsRepository = AlbumsSearchRepository(this@SearchActivity, "")
tracksRepository = TracksSearchRepository(this@SearchActivity, "")
favoritesRepository = FavoritesRepository(this@SearchActivity)
binding = ActivitySearchBinding.inflate(layoutInflater) binding = ActivitySearchBinding.inflate(layoutInflater)
setContentView(binding.root) setContentView(binding.root)
@ -81,11 +86,6 @@ class SearchActivity : AppCompatActivity() {
} }
} }
artistsRepository = ArtistsSearchRepository(this@SearchActivity, "")
albumsRepository = AlbumsSearchRepository(this@SearchActivity, "")
tracksRepository = TracksSearchRepository(this@SearchActivity, "")
favoritesRepository = FavoritesRepository(this@SearchActivity)
adapter = adapter =
SearchAdapter( SearchAdapter(
layoutInflater, layoutInflater,

3
app/src/main/java/audio/funkwhale/ffa/fragments/LandscapeQueueFragment.kt

@ -35,6 +35,8 @@ class LandscapeQueueFragment : Fragment() {
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
favoritesRepository = FavoritesRepository(context)
watchEventBus() watchEventBus()
} }
@ -44,6 +46,7 @@ class LandscapeQueueFragment : Fragment() {
savedInstanceState: Bundle? savedInstanceState: Bundle?
): View { ): View {
_binding = PartialQueueBinding.inflate(inflater) _binding = PartialQueueBinding.inflate(inflater)
return binding.root.apply { return binding.root.apply {
adapter = TracksAdapter( adapter = TracksAdapter(
layoutInflater, layoutInflater,

5
app/src/main/java/audio/funkwhale/ffa/fragments/PlaylistTracksFragment.kt

@ -72,11 +72,12 @@ class PlaylistTracksFragment : FFAFragment<PlaylistTrack, PlaylistTracksAdapter>
albumCover = getString("albumCover") ?: "" albumCover = getString("albumCover") ?: ""
} }
adapter = PlaylistTracksAdapter(layoutInflater, context, FavoriteListener(favoritesRepository), PlaylistListener())
repository = PlaylistTracksRepository(context, albumId)
favoritesRepository = FavoritesRepository(context) favoritesRepository = FavoritesRepository(context)
playlistsRepository = ManagementPlaylistsRepository(context) playlistsRepository = ManagementPlaylistsRepository(context)
adapter = PlaylistTracksAdapter(layoutInflater, context, FavoriteListener(favoritesRepository), PlaylistListener())
repository = PlaylistTracksRepository(context, albumId)
watchEventBus() watchEventBus()
} }

Loading…
Cancel
Save