diff --git a/app/src/main/java/protect/card_locker/LoyaltyCardCursorAdapter.java b/app/src/main/java/protect/card_locker/LoyaltyCardCursorAdapter.java
index 8c8968b7f..7950277e2 100644
--- a/app/src/main/java/protect/card_locker/LoyaltyCardCursorAdapter.java
+++ b/app/src/main/java/protect/card_locker/LoyaltyCardCursorAdapter.java
@@ -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);
diff --git a/app/src/main/res/layout/loyalty_card_layout.xml b/app/src/main/res/layout/loyalty_card_layout.xml
index af02b6b4a..7106bc671 100644
--- a/app/src/main/res/layout/loyalty_card_layout.xml
+++ b/app/src/main/res/layout/loyalty_card_layout.xml
@@ -45,12 +45,12 @@
+ android:textSize="@dimen/noteTextSize"/>
diff --git a/app/src/main/res/values/dimens.xml b/app/src/main/res/values/dimens.xml
index e64a497e3..c06dd3997 100644
--- a/app/src/main/res/values/dimens.xml
+++ b/app/src/main/res/values/dimens.xml
@@ -12,6 +12,7 @@
22sp
28sp
+ 14sp
2dip
4dip
diff --git a/app/src/test/java/protect/card_locker/LoyaltyCardCursorAdapterTest.java b/app/src/test/java/protect/card_locker/LoyaltyCardCursorAdapterTest.java
index 995ae3f34..2f4ba1f62 100644
--- a/app/src/test/java/protect/card_locker/LoyaltyCardCursorAdapterTest.java
+++ b/app/src/test/java/protect/card_locker/LoyaltyCardCursorAdapterTest.java
@@ -40,13 +40,21 @@ public class LoyaltyCardCursorAdapterTest
return view;
}
- private void checkView(final View view, final String store, final String cardId)
+ private void checkView(final View view, final String store, final String note)
{
final TextView storeField = (TextView) view.findViewById(R.id.store);
assertEquals(store, storeField.getText().toString());
- final TextView cardIdField = (TextView) view.findViewById(R.id.cardId);
- assertEquals(cardId, cardIdField.getText().toString());
+ final TextView noteField = view.findViewById(R.id.note);
+ if(note.isEmpty() == false)
+ {
+ assertEquals(View.VISIBLE, noteField.getVisibility());
+ assertEquals(note, noteField.getText().toString());
+ }
+ else
+ {
+ assertEquals(View.GONE, noteField.getVisibility());
+ }
}
@@ -61,11 +69,7 @@ public class LoyaltyCardCursorAdapterTest
View view = createView(cursor);
- final String cardIdLabel = activity.getResources().getString(R.string.cardId);
- final String cardIdFormat = activity.getResources().getString(R.string.cardIdFormat);
- String cardIdText = String.format(cardIdFormat, cardIdLabel, card.cardId);
-
- checkView(view, card.store, cardIdText);
+ checkView(view, card.store, card.note);
}
@Test
@@ -79,13 +83,6 @@ public class LoyaltyCardCursorAdapterTest
View view = createView(cursor);
- final String storeNameAndNoteFormat = activity.getResources().getString(R.string.storeNameAndNoteFormat);
- String storeAndNoteText = String.format(storeNameAndNoteFormat, card.store, card.note);
-
- final String cardIdLabel = activity.getResources().getString(R.string.cardId);
- final String cardIdFormat = activity.getResources().getString(R.string.cardIdFormat);
- String cardIdText = String.format(cardIdFormat, cardIdLabel, card.cardId);
-
- checkView(view, storeAndNoteText, cardIdText);
+ checkView(view, card.store, card.note);
}
}