當前位置: 首頁>>代碼示例>>Java>>正文


Java Playlist類代碼示例

本文整理匯總了Java中kaaes.spotify.webapi.android.models.Playlist的典型用法代碼示例。如果您正苦於以下問題:Java Playlist類的具體用法?Java Playlist怎麽用?Java Playlist使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Playlist類屬於kaaes.spotify.webapi.android.models包,在下文中一共展示了Playlist類的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: PlaylistListData

import kaaes.spotify.webapi.android.models.Playlist; //導入依賴的package包/類
public PlaylistListData(Playlist playlist, UserPrivate me) {
    playlistName = playlist.name;
    playlistId = playlist.id;
    tracks = playlist.tracks.total;
    playlistOwnerName = playlist.owner.display_name;
    playlistOwnerId = playlist.owner.id;
    editable = playlist.owner.id.matches(me.id);
    playlistPublic = playlist.is_public;

    try {
        playlistImage = playlist.images.get(playlist.images.size() / 2).url;
    } catch (IndexOutOfBoundsException e) {
        return;
    }

    playlistImageLarge = "";
    int res = 0;
    for (Image image : playlist.images) {
        if (image.height * image.width > res) {
            playlistImageLarge = image.url;
            res = image.height * image.width;
        }
    }
}
 
開發者ID:TheAndroidMaster,項目名稱:Pasta-for-Spotify,代碼行數:25,代碼來源:PlaylistListData.java

示例2: loadPlaylistFromUri

import kaaes.spotify.webapi.android.models.Playlist; //導入依賴的package包/類
private static void loadPlaylistFromUri(SpotifyService service, String uri, final SpotifyObjectLoaderCallback callback) {
    String[] uriParts = uri.split(USER_PLAYLIST_URI);
    if (uriParts.length == 2) {
        String userId = uriParts[0].replace(USER_URI, "");
        String playlistId = uriParts[1];
        SpotifyTvApplication.getInstance().getSpotifyService().getPlaylist(userId, playlistId, new Callback<Playlist>() {
            @Override
            public void success(Playlist playlist, Response response) {
                if (callback != null) {
                    callback.success(playlist, response);
                }
            }

            @Override
            public void failure(RetrofitError error) {
                if (callback != null) {
                    callback.failure(error);
                }
            }
        });
    }
}
 
開發者ID:sregg,項目名稱:spotify-tv,代碼行數:23,代碼來源:SpotifyUriLoader.java

示例3: loadPlaylist

import kaaes.spotify.webapi.android.models.Playlist; //導入依賴的package包/類
private void loadPlaylist() {
    // load artist from API to get their image
    SpotifyTvApplication.getInstance().getSpotifyService().getPlaylist(mUserId, mPlaylistId, new Callback<Playlist>() {
        @Override
        public void success(final Playlist playlist, Response response) {
            if (!isAdded()) {
                return;
            }
            mPlaylist = playlist;

            mPlaylistTracks = new ArrayList<>(playlist.tracks.items.size());
            mPlaylistTrackUris = new ArrayList<>(playlist.tracks.items.size());
            for (PlaylistTrack playlistTrack : playlist.tracks.items) {
                mPlaylistTracks.add(playlistTrack.track);
                mPlaylistTrackUris.add(playlistTrack.track.uri);
            }

            onContentLoaded();
            scrollToCurrentTrack();
        }

        @Override
        public void failure(RetrofitError error) {

        }
    });
}
 
開發者ID:sregg,項目名稱:spotify-tv,代碼行數:28,代碼來源:PlaylistDetailsFragment.java

示例4: getUriFromSpotiyObject

import kaaes.spotify.webapi.android.models.Playlist; //導入依賴的package包/類
public static String getUriFromSpotiyObject(Object spotifyObject) {
    String uri = null;
    if (spotifyObject instanceof TrackSimple) {
        uri = ((TrackSimple) spotifyObject).uri;
    } else if (spotifyObject instanceof Playlist) {
        uri = ((Playlist) spotifyObject).uri;
    } else if (spotifyObject instanceof PlaylistSimple) {
        uri = ((PlaylistSimple) spotifyObject).uri;
    } else if (spotifyObject instanceof AlbumSimple) {
        uri = ((AlbumSimple) spotifyObject).uri;
    } else if (spotifyObject instanceof ArtistSimple) {
        uri = ((ArtistSimple) spotifyObject).uri;
    }
    return uri;
}
 
開發者ID:sregg,項目名稱:spotify-tv,代碼行數:16,代碼來源:Utils.java

示例5: loadRecommendationsData

import kaaes.spotify.webapi.android.models.Playlist; //導入依賴的package包/類
private void loadRecommendationsData() throws RetrofitError {
    SpotifyTvApplication app = SpotifyTvApplication.getInstance();
    SpotifyService spotifyService = app.getSpotifyService();
    UserPrivate user = spotifyService.getMe();

    if (user == null) {
        return;
    }

    Map<String, Object> options = new HashMap<>();
    options.put(SpotifyService.COUNTRY, user.country);
    options.put("timestamp", DateFormat.format("yyyy-MM-dd'T'hh:mm:ss", new Date()));
    FeaturedPlaylists featuredPlaylists = spotifyService.getFeaturedPlaylists(options);

    if (featuredPlaylists == null) {
        return;
    }

    int count = 0;

    for (PlaylistSimple playlistSimple : featuredPlaylists.playlists.items) {
        Playlist playlist = spotifyService.getPlaylist(playlistSimple.owner.id, playlistSimple.id);

        Log.d(TAG, "Recommendation - Featured Playlist - " + playlist.name);

        mNotificationManager.notify(playlist.id.hashCode(), buildNotification(playlist));

        if (++count >= MAX_RECOMMENDATIONS) {
            break;
        }
    }
}
 
開發者ID:sregg,項目名稱:spotify-tv,代碼行數:33,代碼來源:RecommendationsService.java

示例6: buildNotification

import kaaes.spotify.webapi.android.models.Playlist; //導入依賴的package包/類
private Notification buildNotification(Playlist playlist) {
    Bitmap image = null;
    if (playlist.images.size() > 0) {
        try {
            image = Picasso.with(getApplicationContext())
                    .load(playlist.images.get(0).url)
                    .resize(CARD_WIDTH, CARD_HEIGHT)
                    .centerCrop()
                    .get();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    return new NotificationCompat.BigPictureStyle(
            new NotificationCompat.Builder(getApplicationContext())
                    .setContentTitle(playlist.name)
                    .setContentText(playlist.description)
                    .setPriority(NotificationCompat.PRIORITY_DEFAULT)
                    .setLocalOnly(true)
                    .setOngoing(true)
                    .setColor(getResources().getColor(R.color.fastlane_background))
                    .setCategory(Notification.CATEGORY_RECOMMENDATION)
                    .setLargeIcon(image)
                    .setSmallIcon(R.drawable.ic_launcher)
                    .setContentIntent(buildPendingIntent(playlist.id, playlist.uri))
                    .setExtras(null))
            .build();
}
 
開發者ID:sregg,項目名稱:spotify-tv,代碼行數:30,代碼來源:RecommendationsService.java

示例7: onBindDescription

import kaaes.spotify.webapi.android.models.Playlist; //導入依賴的package包/類
@Override
protected void onBindDescription(ViewHolder viewHolder, Object item) {
    if (!(item instanceof Playlist)){
        return;
    }

    Playlist playlist = (Playlist) item;

    if (playlist != null) {
        viewHolder.getTitle().setText(playlist.name);
        viewHolder.getSubtitle().setText(playlist.description);
    }
}
 
開發者ID:sregg,項目名稱:spotify-tv,代碼行數:14,代碼來源:PlaylistDetailsPresenter.java


注:本文中的kaaes.spotify.webapi.android.models.Playlist類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。