本文整理汇总了Java中kaaes.spotify.webapi.android.models.ArtistsPager类的典型用法代码示例。如果您正苦于以下问题:Java ArtistsPager类的具体用法?Java ArtistsPager怎么用?Java ArtistsPager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ArtistsPager类属于kaaes.spotify.webapi.android.models包,在下文中一共展示了ArtistsPager类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: searchArtists
import kaaes.spotify.webapi.android.models.ArtistsPager; //导入依赖的package包/类
private void searchArtists(String query) {
SpotifyTvApplication.getInstance().getSpotifyService().searchArtists(query, getSearchOptions(), new Callback<ArtistsPager>() {
@Override
public void success(ArtistsPager artistsPager, Response response) {
ArrayObjectAdapter listRowAdapter = new ArrayObjectAdapter(new ArtistCardPresenter());
for (Artist artist : artistsPager.artists.items) {
listRowAdapter.add(artist);
}
HeaderItem header = new HeaderItem(getString(R.string.artists));
mRowsAdapter.add(new ListRow(header, listRowAdapter));
// TODO next pages ?
}
@Override
public void failure(RetrofitError error) {
}
});
}
开发者ID:sregg,项目名称:spotify-tv,代码行数:21,代码来源:SearchFragment.java
示例2: searchArtists
import kaaes.spotify.webapi.android.models.ArtistsPager; //导入依赖的package包/类
private void searchArtists(String query, MatrixCursor cursor) {
ArtistsPager artistsPager = SpotifyTvApplication.getInstance().getSpotifyService().searchArtists(query, getSearchOptions());
if (artistsPager != null && artistsPager.artists != null) {
for (Artist artist : artistsPager.artists.items) {
MatrixCursor.RowBuilder row = cursor.newRow();
row.add(SearchManager.SUGGEST_COLUMN_TEXT_1, artist.name);
row.add(SearchManager.SUGGEST_COLUMN_CONTENT_TYPE, artist.type);
row.add(SearchManager.SUGGEST_COLUMN_INTENT_DATA, artist.uri);
row.add(SearchManager.SUGGEST_COLUMN_TEXT_2, getContext().getString(R.string.artists));
if (artist.images != null && artist.images.size() > 0) {
row.add(SearchManager.SUGGEST_COLUMN_RESULT_CARD_IMAGE, artist.images.get(0).url);
}
}
}
}
开发者ID:sregg,项目名称:spotify-tv,代码行数:19,代码来源:SearchProvider.java
示例3: getSpotifyArtists
import kaaes.spotify.webapi.android.models.ArtistsPager; //导入依赖的package包/类
/**
* Returns a list of the Spotify artists whose names match a supplied string.
* @param strSearch the string to match against
* @return a list of the Spotify artists whose names match the search string
*/
private List<Artist> getSpotifyArtists(String strSearch) {
try {
ArtistsPager artistsPager = getSpotifyService().searchArtists(strSearch);
if (artistsPager != null) {
Pager<Artist> artistPager = artistsPager.artists;
if (artistPager != null) {
return artistPager.items;
}
}
} catch (RetrofitError e) {
Log.e(LOG_TAG, "RetrofitError while fetching artist list: " + e);
}
return null;
}
开发者ID:edmundjohnson,项目名称:nd-spotify,代码行数:20,代码来源:ArtistListFragment.java
示例4: doInBackground
import kaaes.spotify.webapi.android.models.ArtistsPager; //导入依赖的package包/类
@Override
protected Void doInBackground(Void... strings) {
SpotifyApi api = new SpotifyApi();
SpotifyService service = api.getService();
ArtistsPager results = service.searchArtists("Paul");
List<Artist> artists = results.artists.items;
for (int i = 0; i < artists.size(); i++) {
Artist artist = artists.get(i);
Log.i(LOG_TAG, i + " " + artist.name);
}
return null;
}
开发者ID:udacity,项目名称:android-web-api-sample,代码行数:14,代码来源:MainActivity.java
示例5: doInBackground
import kaaes.spotify.webapi.android.models.ArtistsPager; //导入依赖的package包/类
@Override
protected AsyncTaskResult<List<Artist>> doInBackground(String... params) {
SpotifyService spotifyService = new SpotifyApi().getService();
try {
ArtistsPager results = spotifyService.searchArtists(params[0]);
List<Artist> artistList = new ArrayList<>();
for (kaaes.spotify.webapi.android.models.Artist spotifyWebApiArtist : results.artists.items) {
artistList.add(new Artist(spotifyWebApiArtist));
}
return new AsyncTaskResult<>(artistList);
} catch (RetrofitError error) {
if(error.getResponse() == null) {
return new AsyncTaskResult<>(new NotFoundException());
} else {
switch(error.getResponse().getStatus()) {
case HttpURLConnection.HTTP_BAD_REQUEST:
return new AsyncTaskResult<>(new BadRequestException());
case HttpURLConnection.HTTP_NOT_FOUND:
return new AsyncTaskResult<>(new NotFoundException());
default:
return new AsyncTaskResult<>(error);
}
}
}
}
开发者ID:tassioauad,项目名称:SpotifyStreamer,代码行数:32,代码来源:ArtistFindByNameAsyncTask.java
注:本文中的kaaes.spotify.webapi.android.models.ArtistsPager类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论