• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java Artist类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中kaaes.spotify.webapi.android.models.Artist的典型用法代码示例。如果您正苦于以下问题:Java Artist类的具体用法?Java Artist怎么用?Java Artist使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Artist类属于kaaes.spotify.webapi.android.models包,在下文中一共展示了Artist类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: ArtistListData

import kaaes.spotify.webapi.android.models.Artist; //导入依赖的package包/类
public ArtistListData(Artist artist) {
    artistName = artist.name;
    artistId = artist.id;

    if (artist.images.size() > 1) {
        artistImage = artist.images.get(1).url;
        artistImageLarge = artist.images.get(0).url;
    } else if (artist.images.size() > 0) {
        artistImage = artist.images.get(0).url;
        artistImageLarge = artist.images.get(0).url;
    } else {
        artistImage = "";
        artistImageLarge = "";
    }

    followers = artist.followers.total;
    genres = artist.genres;
}
 
开发者ID:TheAndroidMaster,项目名称:Pasta-for-Spotify,代码行数:19,代码来源:ArtistListData.java


示例2: searchArtists

import kaaes.spotify.webapi.android.models.Artist; //导入依赖的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


示例3: loadArtistFromUri

import kaaes.spotify.webapi.android.models.Artist; //导入依赖的package包/类
private static void loadArtistFromUri(SpotifyService service, String uri, final SpotifyObjectLoaderCallback callback) {
    SpotifyTvApplication.getInstance().getSpotifyService().getArtist(uri.replace(ARTIST_URI, ""), new Callback<Artist>() {
        @Override
        public void success(Artist artist, Response response) {
            if (callback != null) {
                callback.success(artist, response);
            }
        }

        @Override
        public void failure(RetrofitError error) {
            if (callback != null) {
                callback.failure(error);
            }
        }
    });
}
 
开发者ID:sregg,项目名称:spotify-tv,代码行数:18,代码来源:SpotifyUriLoader.java


示例4: searchArtists

import kaaes.spotify.webapi.android.models.Artist; //导入依赖的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


示例5: getArtist

import kaaes.spotify.webapi.android.models.Artist; //导入依赖的package包/类
@Nullable
public ArtistListData getArtist(String id) throws InterruptedException {
    Artist a = null;
    for (int i = 0; a == null && i < PreferenceUtils.getRetryCount(this); i++) {
        try {
            a = spotifyService.getArtist(id);
        } catch (Exception e) {
            e.printStackTrace();
            if (StaticUtils.shouldResendRequest(e)) Thread.sleep(200);
            else break;
        }
    }
    if (a == null) return null;
    return new ArtistListData(a);
}
 
开发者ID:TheAndroidMaster,项目名称:Pasta-for-Spotify,代码行数:16,代码来源:Pasta.java


示例6: getAppArtists

import kaaes.spotify.webapi.android.models.Artist; //导入依赖的package包/类
/**
 * Returns a list of the artists whose names match a supplied string.
 * @param strSearch the string to match against
 * @return a list of the artists whose names match the search string
 */
private List<AppArtist> getAppArtists(String strSearch) {
    List<AppArtist> appArtistList = new ArrayList<>();

    List<Artist> artistList = getSpotifyArtists(strSearch);
    if (artistList != null) {
        for (Artist artist : artistList) {
            AppArtist appArtist = new AppArtist(artist.id, artist.name,
                    SpotifyUtil.getImageUrlSmall(artist.images));
            appArtistList.add(appArtist);
        }
    }
    return appArtistList;
}
 
开发者ID:edmundjohnson,项目名称:nd-spotify,代码行数:19,代码来源:ArtistListFragment.java


示例7: getSpotifyArtists

import kaaes.spotify.webapi.android.models.Artist; //导入依赖的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


示例8: doInBackground

import kaaes.spotify.webapi.android.models.Artist; //导入依赖的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


示例9: setupBackground

import kaaes.spotify.webapi.android.models.Artist; //导入依赖的package包/类
private void setupBackground() {
    mBackgroundManager = BackgroundManager.getInstance(getActivity());
    mBackgroundManager.attach(getActivity().getWindow());
    mMetrics = new DisplayMetrics();
    getActivity().getWindowManager().getDefaultDisplay().getMetrics(mMetrics);

    // load artist from API to get their image
    SpotifyTvApplication.getInstance().getSpotifyService().getArtist(mArtistId, new Callback<Artist>() {
        @Override
        public void success(Artist artist, Response response) {
            if (!isAdded()){
                return;
            }

            if (artist.images != null && !artist.images.isEmpty()) {
                final String imageUrl = artist.images.get(0).url;

                mHandler.post(new Runnable() {
                    @Override
                    public void run() {
                        loadBackgroundImage(imageUrl);
                    }
                });
            }
        }

        @Override
        public void failure(RetrofitError error) {

        }
    });
}
 
开发者ID:sregg,项目名称:spotify-tv,代码行数:33,代码来源:ArtistsDetailsFragment.java


示例10: onBindViewHolder

import kaaes.spotify.webapi.android.models.Artist; //导入依赖的package包/类
@Override
public void onBindViewHolder(final Presenter.ViewHolder viewHolder, Object item) {
    super.onBindViewHolder(viewHolder, item);

    final CardViewHolder cardViewHolder = (CardViewHolder) viewHolder;
    final SpotifyCardView imageCardView = cardViewHolder.getImageCardView();

    ArtistSimple artistSimple = (ArtistSimple) item;

    // name
    imageCardView.setTitleText(artistSimple.name);

    // load real artist (not simple) from API
    SpotifyTvApplication app = SpotifyTvApplication.getInstance();
    app.getSpotifyService().getArtist(artistSimple.id, new Callback<Artist>() {
        @Override
        public void success(final Artist artist, Response response) {
            // TODO nb albums
            //String totalAlbums = mContext.getResources().getQuantityString(R.plurals.playlist_nb_tracks, artist.a, playlist.tracks.total);
            //((ViewHolder) viewHolder).mImageCardView.setContentText(totalAlbums);

            // image
            if (artist.images != null && !artist.images.isEmpty()) {
                imageCardView.post(new Runnable() {
                    @Override
                    public void run() {
                        cardViewHolder.updateCardViewImage(URI.create(artist.images.get(0).url));
                    }
                });
            }
        }

        @Override
        public void failure(RetrofitError error) {

        }
    });
}
 
开发者ID:sregg,项目名称:spotify-tv,代码行数:39,代码来源:ArtistCardPresenter.java



注:本文中的kaaes.spotify.webapi.android.models.Artist类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Axis类代码示例发布时间:2022-05-23
下一篇:
Java ProjectedProcessor类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap