/* * Copyright (C) 2015 Naman Dwivedi * * Licensed under the GNU General Public License v3 * * This is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU General Public License for more details. */ package com.naman14.timber.fragments; import android.os.Bundle; import android.support.v4.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import com.naman14.timber.R; import com.naman14.timber.dataloaders.ArtistLoader; import com.naman14.timber.lastfmapi.LastFmClient; import com.naman14.timber.lastfmapi.callbacks.ArtistInfoListener; import com.naman14.timber.lastfmapi.models.ArtistQuery; import com.naman14.timber.lastfmapi.models.LastfmArtist; import com.naman14.timber.models.Artist; import com.naman14.timber.utils.Constants; public class SimilarArtistFragment extends Fragment { long artistID = -1; public static SimilarArtistFragment newInstance(long id) { SimilarArtistFragment fragment = new SimilarArtistFragment(); Bundle args = new Bundle(); args.putLong(Constants.ARTIST_ID, id); fragment.setArguments(args); return fragment; } @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (getArguments() != null) { artistID = getArguments().getLong(Constants.ARTIST_ID); } } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate( R.layout.fragment_similar_artists, container, false); Artist artist = ArtistLoader.getArtist(getActivity(), artistID); LastFmClient.getInstance(getActivity()).getArtistInfo(new ArtistQuery(artist.name), new ArtistInfoListener() { @Override public void artistInfoSucess(LastfmArtist artist) { } @Override public void artistInfoFailed() { } }); return rootView; } }