use of tr.bcxip.hummingbird.api.objects.FavoriteAnime in project Hummingbird-for-Android by xiprox.
the class FavoriteAnimeAdapter method getView.
@Override
public View getView(int position, View convertView, ViewGroup parent) {
LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View rootView = inflater.inflate(R.layout.item_favorite_grid, null);
FavoriteAnime fav = mItems.get(position);
final ImageView mCover = (ImageView) rootView.findViewById(R.id.item_favorite_cover);
final TextView mTitle = (TextView) rootView.findViewById(R.id.item_favorite_title);
ViewFlipper mFlipper = (ViewFlipper) rootView.findViewById(R.id.item_favorite_flipper);
Picasso.with(context).load(fav.getCoverImage()).into(mCover, new Callback() {
@Override
public void onSuccess() {
int darkMutedColor;
Bitmap bitmap = ((BitmapDrawable) mCover.getDrawable()).getBitmap();
darkMutedColor = Palette.generate(bitmap).getDarkMutedSwatch().getRgb();
mTitle.setBackgroundDrawable(new ColorDrawable(darkMutedColor));
}
@Override
public void onError() {
}
});
mTitle.setText(fav.getTitle());
if (mFlipper.getDisplayedChild() == 0)
mFlipper.showNext();
return rootView;
}
Aggregations