protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.artistDetailActivity); // Ophalen van de ArtistId uit de Intent var selectedArtistId = Intent.GetIntExtra(ExtraKey, -1); // Initialize viewmodel _artistsViewModel = App.Container.Resolve <ArtistsViewModel>(); _artistsViewModel.Initialize(); _songsAdapter = new SongsAdapter(_artistsViewModel.GetSongsFromArtist(selectedArtistId)); _artistSongsRecyclerview = FindViewById <RecyclerView>(Resource.Id.ArtistSongs); _artistSongsRecyclerview.SetLayoutManager(new LinearLayoutManager(this)); _artistSongsRecyclerview.SetItemAnimator(new DefaultItemAnimator()); _artistSongsRecyclerview.SetAdapter(_songsAdapter); _artistName = FindViewById <TextView>(Resource.Id.artistName); _artistName.Text = _artistsViewModel.GetArtist(selectedArtistId).Name; SupportActionBar.Title = Resources.GetString(Resource.String.artist_activity_title); SupportActionBar.SetDisplayHomeAsUpEnabled(true); SupportActionBar.SetHomeButtonEnabled(true); }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.Inflate(Resource.Layout.artistsOverviewFragment, container, false); // Initialize viewmodel _artistsViewModel = App.Container.Resolve <ArtistsViewModel>(); _artistsViewModel.Initialize(); _artistSearchView = view.FindViewById <SearchView>(Resource.Id.searchView); _artistRecyclerview = view.FindViewById <RecyclerView>(Resource.Id.artistRecyclerView); _artistRecyclerview.SetLayoutManager(new LinearLayoutManager(this.Context)); _artistRecyclerview.SetItemAnimator(new DefaultItemAnimator()); _artistSearchView.QueryTextChange += ArtistSearchTextChanged; _artistAdapter = new ArtistAdapter(_artistsViewModel); _artistAdapter._itemClick += OnItemClick; return(view); }