Display note on separate line, omit card id on card list

The card id was of dubious value, because the main screen
is really for selecting the card. The note may have more value,
as it may specify info about the card.
This commit is contained in:
Branden Archer
2018-01-31 21:56:47 -05:00
parent 41c8b78275
commit 2f6516ffb9
4 changed files with 25 additions and 29 deletions

View File

@@ -32,25 +32,23 @@ class LoyaltyCardCursorAdapter extends CursorAdapter
// Find fields to populate in inflated template
ImageView thumbnail = view.findViewById(R.id.thumbnail);
TextView storeField = (TextView) view.findViewById(R.id.store);
TextView cardIdField = (TextView) view.findViewById(R.id.cardId);
TextView noteField = (TextView) view.findViewById(R.id.note);
// Extract properties from cursor
LoyaltyCard loyaltyCard = LoyaltyCard.toLoyaltyCard(cursor);
// Populate fields with extracted properties
String storeAndNote = loyaltyCard.store;
storeField.setText(loyaltyCard.store);
if(loyaltyCard.note.isEmpty() == false)
{
String storeNameAndNoteFormat = view.getResources().getString(R.string.storeNameAndNoteFormat);
storeAndNote = String.format(storeNameAndNoteFormat, loyaltyCard.store, loyaltyCard.note);
noteField.setVisibility(View.VISIBLE);
noteField.setText(loyaltyCard.note);
}
else
{
noteField.setVisibility(View.GONE);
}
storeField.setText(storeAndNote);
String cardIdFormat = view.getResources().getString(R.string.cardIdFormat);
String cardIdLabel = view.getResources().getString(R.string.cardId);
String cardIdText = String.format(cardIdFormat, cardIdLabel, loyaltyCard.cardId);
cardIdField.setText(cardIdText);
int tileLetterFontSize = context.getResources().getDimensionPixelSize(R.dimen.tileLetterFontSize);
int pixelSize = context.getResources().getDimensionPixelSize(R.dimen.cardThumbnailSize);