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

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

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

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

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

Loading…
Cancel
Save