kaaes.spotify.webapi.android.SpotifyError Java Examples

The following examples show how to use kaaes.spotify.webapi.android.SpotifyError. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SearchPager.java    From android-spotify-demo with MIT License 6 votes vote down vote up
public void getArtist(String id, final ArtistListener listener){

        spotifyService.getArtist(id, new SpotifyCallback<Artist>() {
            @Override
            public void failure(SpotifyError spotifyError) {
                Log.d("SearchPager", spotifyError.toString());
                listener.onError(spotifyError);
            }

            @Override
            public void success(Artist artist, Response response) {
                //Log.d("SearchPager CHECK", artist.images.get(0).url); // img url
                listener.onComplete(artist.images.get(1).url);
            }
        });
    }
 
Example #2
Source File: SearchPager.java    From android-spotify-demo with MIT License 6 votes vote down vote up
public void getMyPlayList(){
    Map<String, Object> options = new HashMap<>();
    options.put(SpotifyService.LIMIT, 30);

    spotifyService.getMyPlaylists(options, new SpotifyCallback<Pager<PlaylistSimple>>() {
        @Override
        public void failure(SpotifyError spotifyError) {
            Log.d("SearchPager", spotifyError.toString());
        }

        @Override
        public void success(Pager<PlaylistSimple> playlistSimplePager, Response response) {
            List<PlaylistSimple> simples = playlistSimplePager.items;

            for(PlaylistSimple simple : simples){
                Log.d("SearchPager", simple.name);
                Log.d("SearchPager", simple.images.get(1).url);
            }

        }
    });
}
 
Example #3
Source File: SearchPager.java    From android-spotify-demo with MIT License 6 votes vote down vote up
public void getFeatured(){

        spotifyService.getFeaturedPlaylists(new SpotifyCallback<FeaturedPlaylists>() {
            @Override
            public void failure(SpotifyError spotifyError) {
                Log.d("SearchPager", spotifyError.toString());
            }

            @Override
            public void success(FeaturedPlaylists featuredPlaylists, Response response) {
                List<PlaylistSimple> mlist = featuredPlaylists.playlists.items;

                for(PlaylistSimple simple : mlist)
                {
                    Log.d("SearchPager Simple", simple.name);
                    Log.d("SearchPager Simple", simple.images.get(0).url);

                    ListManager.getInstance().addSimpleList(new SimplePlaylist(simple.name, simple.images.get(0).url));
                }
            }
        });
    }
 
Example #4
Source File: SearchPager.java    From spotify-web-api-android with MIT License 6 votes vote down vote up
private void getData(String query, int offset, final int limit, final CompleteListener listener) {

        Map<String, Object> options = new HashMap<>();
        options.put(SpotifyService.OFFSET, offset);
        options.put(SpotifyService.LIMIT, limit);

        mSpotifyApi.searchTracks(query, options, new SpotifyCallback<TracksPager>() {
            @Override
            public void success(TracksPager tracksPager, Response response) {
                listener.onComplete(tracksPager.tracks.items);
            }

            @Override
            public void failure(SpotifyError error) {
                listener.onError(error);
            }
        });
    }
 
Example #5
Source File: SearchPager.java    From android-spotify-demo with MIT License 5 votes vote down vote up
private void getData(String query, final CompleteListener listener){

        spotifyService.searchTracks(query, new SpotifyCallback<TracksPager>() {
            @Override
            public void failure(SpotifyError spotifyError) {
                listener.onError(spotifyError);
            }

            @Override
            public void success(TracksPager tracksPager, Response response) {
                listener.onComplete(tracksPager.tracks.items);
            }
        });
    }
 
Example #6
Source File: SearchPager.java    From android-spotify-demo with MIT License 5 votes vote down vote up
public void getMyTopArtist(final onCompleteTopArtistListener listener){

        Map<String, Object> options = new HashMap<>();
        options.put(SpotifyService.LIMIT, 10);

        final ListManager listManager = ListManager.getInstance();

        spotifyService.getTopArtists(options, new SpotifyCallback<Pager<Artist>>() {
            @Override
            public void failure(SpotifyError spotifyError) {
                Log.d("SearchPager", spotifyError.toString());

                if(listener != null)
                    listener.onError(spotifyError);
            }

            @Override
            public void success(Pager<Artist> artistPager, Response response) {
                List<Artist> mList = artistPager.items;

                for(Artist art : mList){
                    Log.d("SearchPager", art.name);
                    Log.d("SearchPager", art.images.get(1).url);

                    listManager.addTopArtist(new TopArtist(art.name, art.images.get(1).url));
                }

                if(listener != null)
                    listener.onComplete();
                else{
                    Log.d("SearchPager", "What is happening?");
                }
            }
        });
    }
 
Example #7
Source File: SearchPager.java    From android-spotify-demo with MIT License 5 votes vote down vote up
public void getMyTopTracks(final onCompleteTopTrackListener listener){
    Map<String, Object> options = new HashMap<>();
    options.put(SpotifyService.LIMIT, 10);

    final ListManager listManager = ListManager.getInstance();

    spotifyService.getTopTracks(options, new SpotifyCallback<Pager<Track>>() {
        @Override
        public void failure(SpotifyError spotifyError) {
            Log.d("SearchPager", spotifyError.toString());

            if(listener != null)
                listener.onError(spotifyError);
        }

        @Override
        public void success(Pager<Track> trackPager, Response response) {
            List<Track> tracks = trackPager.items;

            for(Track track : tracks){
                Log.d("SearchPager", track.album.name);
                Log.d("SearchPager", track.album.images.get(1).url);

                listManager.addTopTrack(new TopTrack(track.album.name, track.album.images.get(1).url));

            }

            if(listener != null)
                listener.onComplete();
        }
    });
}