Exemplo n.º 1
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            View view = inflater.Inflate(Resource.Layout.HomeFragment, null);

            ((AppCompatActivity)Activity).SupportActionBar.SetTitle(Resource.String.frag1Title);
            var ignored = base.OnCreateView(inflater, container, savedInstanceState);

            //Get the data needed to show the favorite playlists
            favoriteImages = new FavoriteImages();

            Favorites[] favorites = { new Favorites {
                                          itemId = Resource.Drawable.ic_playlist_play_black_48dp, favoriteNames = db.getPlaylistFavorites(), sectionTitle = "Favorite Playlists"
                                      },
                                      new Favorites {
                                          itemId = Resource.Drawable.ic_playlist_play_black_48dp, favoriteNames = db.getUpperBodyPlaylists(), sectionTitle = "Upper Body Playlists"
                                      },
                                      new Favorites {
                                          itemId = Resource.Drawable.ic_playlist_play_black_48dp, favoriteNames = db.getLowerBodyPlaylists(), sectionTitle = "Lower Body Playlists"
                                      } };

            favoriteImages.setFavorites(favorites);
            //Get the recyclerview layout
            homeRecyclerView = view.FindViewById <RecyclerView>(Resource.Id.recyclerView);

            //setup the layout manager
            homeLayoutManager = new LinearLayoutManager(Activity);
            homeRecyclerView.SetLayoutManager(homeLayoutManager);

            //setup the favorite Album adapter
            nameAdapter = new FavoritesAlbumAdapter(favoriteImages, Activity);

            //register item click handler
            nameAdapter.ItemClick += OnItemClick;

            homeRecyclerView.SetAdapter(nameAdapter);


            return(view);
        }
Exemplo n.º 2
0
 public FavoritesAlbumAdapter(FavoriteImages favImages, Android.Support.V4.App.FragmentActivity activity)
 {
     favoriteImages = favImages;
     this.activity  = activity;
 }