本文整理汇总了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;
}
}
}
示例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);
}
}
});
}
}
示例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) {
}
});
}
示例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;
}
示例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;
}
}
}
示例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();
}
示例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);
}
}