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