当前位置: 首页>>代码示例>>Java>>正文


Java Category类代码示例

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


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

示例1: onBindViewHolder

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

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

    Category category = (Category) item;

    imageCardView.setTitleText(category.name);

    if (category.icons.size() > 0) {
        cardViewHolder.updateCardViewImage(URI.create(category.icons.get(0).url));
    } else {
        imageCardView.setMainImage(null);
    }
}
 
开发者ID:sregg,项目名称:spotify-tv,代码行数:18,代码来源:CategoryCardPresenter.java

示例2: CategoryListData

import kaaes.spotify.webapi.android.models.Category; //导入依赖的package包/类
public CategoryListData(Category category) {
    categoryId = category.id;
    categoryName = category.name;
    try {
        categoryImage = category.icons.get(0).url;
    } catch (IndexOutOfBoundsException e) {
        categoryImage = "";
    }
}
 
开发者ID:TheAndroidMaster,项目名称:Pasta-for-Spotify,代码行数:10,代码来源:CategoryListData.java

示例3: launchDetailScreen

import kaaes.spotify.webapi.android.models.Category; //导入依赖的package包/类
public void launchDetailScreen(Activity activity, Object item) {
    if (item instanceof AlbumSimple) {
        AlbumSimple albumSimple = (AlbumSimple) item;
        AlbumActivity.launch(activity, albumSimple.id, albumSimple.name);
    } else if (item instanceof ArtistSimple) {
        ArtistSimple artistSimple = (ArtistSimple) item;
        ArtistsAlbumsActivity.launch(activity, artistSimple.id, artistSimple.name);
    } else if (item instanceof PlaylistBase) {
        PlaylistBase playlist = (PlaylistBase) item;
        PlaylistActivity.launch(activity, playlist.id, playlist.name, playlist.owner.id);
    } else if (item instanceof Category) {
        Category category = (Category) item;
        CategoryActivity.launch(activity, category.id, category.name);
    }
}
 
开发者ID:sregg,项目名称:spotify-tv,代码行数:16,代码来源:SpotifyTvApplication.java

示例4: onCreateView

import kaaes.spotify.webapi.android.models.Category; //导入依赖的package包/类
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.fragment_recycler, container, false);
    unbinder = ButterKnife.bind(this, rootView);

    pasta = (Pasta) getContext().getApplicationContext();

    DisplayMetrics metrics = new DisplayMetrics();
    getActivity().getWindowManager().getDefaultDisplay().getMetrics(metrics);

    recycler.setLayoutManager(new GridLayoutManager(getContext(), PreferenceUtils.getColumnNumber(getContext(), metrics.widthPixels > metrics.heightPixels)));
    adapter = new ListAdapter(new ArrayList<ListData>());
    recycler.setAdapter(adapter);
    recycler.setHasFixedSize(true);

    action = new Action<List<ListData>>() {
        @NonNull
        @Override
        public String id() {
            return "getCategories";
        }

        @Nullable
        @Override
        protected List<ListData> run() throws InterruptedException {
            CategoriesPager categories = null;
            for (int i = 0; categories == null && i < PreferenceUtils.getRetryCount(getContext()); i++) {
                try {
                    categories = pasta.spotifyService.getCategories(null);
                } catch (Exception e) {
                    e.printStackTrace();
                    if (StaticUtils.shouldResendRequest(e)) Thread.sleep(200);
                    else break;
                }
            }
            if (categories == null) return null;

            List<ListData> list = new ArrayList<>();
            for (Category category : categories.categories.items) {
                list.add(new CategoryListData(category));
            }
            return list;
        }

        @Override
        protected void done(@Nullable List<ListData> result) {
            if (spinner != null) spinner.setVisibility(View.GONE);
            if (result == null) {
                pasta.onCriticalError(getActivity(), "categories action");
                return;
            }
            adapter.setList(result);
        }
    };
    action.execute();

    return rootView;
}
 
开发者ID:TheAndroidMaster,项目名称:Pasta-for-Spotify,代码行数:60,代码来源:CategoriesFragment.java


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