public GameDetailUserListItem(final ComponentActivity context, final User user) { super( context, context.getResources().getDrawable(R.drawable.sl_icon_user), user.getDisplayName(), null, user); }
public GameItemListItem( final ComponentActivity activity, final GameItem target, final boolean isPending) { super(activity, null, null); _target = target; _isPending = isPending; if (target.isCoinPack()) { setDrawable(activity.getResources().getDrawable(R.drawable.sl_button_add_coins)); } else { setDrawable(activity.getResources().getDrawable(R.drawable.sl_icon_market)); } setTitle(target.getName()); setSubTitle(target.getDescription()); int buttonDrawableId = R.drawable.sl_button_buy; if (_isPending) { setPriceText(""); setPriceTextSmall(R.string.sl_pending_payment); buttonDrawableId = R.drawable.sl_button_buy_disabled; } else if ((target.getPurchaseDate() != null) && !target.isCollectable()) { setPriceText(""); setPriceTextSmall(R.string.sl_purchased_item); buttonDrawableId = R.drawable.sl_button_buy_disabled; } else if (target.isFree()) { setPriceTextSmall(""); setPriceText(R.string.sl_free_item); } else { final List<Money> lowestPrices = target.getLowestPrices(); if (lowestPrices.size() > 0) { final Money preferedLowestPrice = Money.getPreferred(lowestPrices, Locale.getDefault(), "USD"); final String lowestPricesString = StringFormatter.formatMoney(preferedLowestPrice, activity.getConfiguration()); setPriceTextSmall(R.string.sl_price_from); setPriceText(lowestPricesString); } else { setPriceTextSmall(""); setPriceText(R.string.sl_purchasable_item); } } buttonDrawable = activity.getResources().getDrawable(buttonDrawableId); }