@Override public void onValueChanged( final ValueStore valueStore, final String key, final Object oldValue, final Object newValue) { if (valueStore == _opponentValueStore) { if (isValueChangedFor(key, Constant.NUMBER_CHALLENGES_WON, oldValue, newValue)) { getChallengeParticipantsListItem() .setContenderStats(StringFormatter.getChallengesSubTitle(this, _opponentValueStore)); getBaseListAdapter().notifyDataSetChanged(); } } else { if (isValueChangedFor(key, Constant.NUMBER_CHALLENGES_WON, oldValue, newValue)) { getChallengeParticipantsListItem() .setContestantStats(StringFormatter.getChallengesSubTitle(this, valueStore)); getBaseListAdapter().notifyDataSetChanged(); } } }
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); }
@Override public void onValueChanged( final ValueStore valueStore, final String key, final Object oldValue, final Object newValue) { setSubTitle(StringFormatter.getBalanceSubTitle(this, getUserValues(), getConfiguration())); }