use of com.naman14.timber.adapters.AlbumSongsAdapter in project Timber by naman14.
the class AlbumDetailFragment method onCreateView.
@TargetApi(21)
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
final View rootView = inflater.inflate(R.layout.fragment_album_detail, container, false);
albumArt = (ImageView) rootView.findViewById(R.id.album_art);
artistArt = (ImageView) rootView.findViewById(R.id.artist_art);
albumTitle = (TextView) rootView.findViewById(R.id.album_title);
albumDetails = (TextView) rootView.findViewById(R.id.album_details);
toolbar = (Toolbar) rootView.findViewById(R.id.toolbar);
fab = (FloatingActionButton) rootView.findViewById(R.id.fab);
if (getArguments().getBoolean("transition")) {
albumArt.setTransitionName(getArguments().getString("transition_name"));
}
recyclerView = (RecyclerView) rootView.findViewById(R.id.recyclerview);
collapsingToolbarLayout = (CollapsingToolbarLayout) rootView.findViewById(R.id.collapsing_toolbar);
appBarLayout = (AppBarLayout) rootView.findViewById(R.id.app_bar);
recyclerView.setEnabled(false);
recyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
album = AlbumLoader.getAlbum(getActivity(), albumID);
setAlbumart();
setUpEverything();
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Handler handler = new Handler();
handler.postDelayed(new Runnable() {
@Override
public void run() {
AlbumSongsAdapter adapter = (AlbumSongsAdapter) recyclerView.getAdapter();
MusicPlayer.playAll(getActivity(), adapter.getSongIds(), 0, albumID, TimberUtils.IdType.Album, true);
NavigationUtils.navigateToNowplaying(getActivity(), false);
}
}, 150);
}
});
return rootView;
}
use of com.naman14.timber.adapters.AlbumSongsAdapter in project Timber by naman14.
the class AlbumDetailFragment method setUpAlbumSongs.
private void setUpAlbumSongs() {
List<Song> songList = AlbumSongLoader.getSongsForAlbum(getActivity(), albumID);
mAdapter = new AlbumSongsAdapter(getActivity(), songList, albumID);
recyclerView.addItemDecoration(new DividerItemDecoration(getActivity(), DividerItemDecoration.VERTICAL_LIST));
recyclerView.setAdapter(mAdapter);
}
Aggregations