当前位置: 首页>>代码示例>>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;未经允许,请勿转载。