mirror of
https://github.com/CatimaLoyalty/Android.git
synced 2026-03-30 21:31:50 -04:00
display store and note on card summary view
Dutch translation provided by PanderMusubi Related issues: https://github.com/brarcher/loyalty-card-locker/issues/23 https://github.com/brarcher/loyalty-card-locker/issues/24
This commit is contained in:
@@ -36,7 +36,14 @@ class LoyaltyCardCursorAdapter extends CursorAdapter
|
||||
LoyaltyCard loyaltyCard = LoyaltyCard.toLoyaltyCard(cursor);
|
||||
|
||||
// Populate fields with extracted properties
|
||||
storeField.setText(loyaltyCard.store);
|
||||
String storeAndNote = loyaltyCard.store;
|
||||
if(loyaltyCard.note.isEmpty() == false)
|
||||
{
|
||||
String storeNameAndNoteFormat = view.getResources().getString(R.string.storeNameAndNoteFormat);
|
||||
storeAndNote = String.format(storeNameAndNoteFormat, loyaltyCard.store, loyaltyCard.note);
|
||||
}
|
||||
|
||||
storeField.setText(storeAndNote);
|
||||
|
||||
String cardIdFormat = view.getResources().getString(R.string.cardIdFormat);
|
||||
String cardIdLabel = view.getResources().getString(R.string.cardId);
|
||||
|
||||
@@ -13,7 +13,8 @@
|
||||
android:id="@+id/store"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1.0"/>
|
||||
android:layout_weight="1.0"
|
||||
android:maxLines="1"/>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout android:orientation="horizontal"
|
||||
|
||||
@@ -25,4 +25,5 @@
|
||||
<string name="noCardIdError">Nessun codice carta inserito</string>
|
||||
|
||||
<string name="cardIdFormat">%1$s: %2$s</string>
|
||||
<string name="note">Nota</string>
|
||||
</resources>
|
||||
|
||||
@@ -25,4 +25,5 @@
|
||||
<string name="noCardIdError">Geen kaart-ID toegevoegd</string>
|
||||
|
||||
<string name="cardIdFormat">%1$s: %2$s</string>
|
||||
<string name="note">Notitie</string>
|
||||
</resources>
|
||||
|
||||
@@ -26,4 +26,5 @@
|
||||
<string name="noCardIdError">No Card ID entered</string>
|
||||
|
||||
<string name="cardIdFormat">%1$s: %2$s</string>
|
||||
<string name="storeNameAndNoteFormat" translatable="false">%1$s - %2$s</string>
|
||||
</resources>
|
||||
@@ -51,7 +51,7 @@ public class LoyaltyCardCursorAdapterTest
|
||||
|
||||
|
||||
@Test
|
||||
public void TestCursorAdapter()
|
||||
public void TestCursorAdapterEmptyNote()
|
||||
{
|
||||
db.insertLoyaltyCard("store", "", "cardId", BarcodeFormat.UPC_A.toString());
|
||||
LoyaltyCard card = db.getLoyaltyCard(1);
|
||||
@@ -67,4 +67,25 @@ public class LoyaltyCardCursorAdapterTest
|
||||
|
||||
checkView(view, card.store, cardIdText);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void TestCursorAdapterWithNote()
|
||||
{
|
||||
db.insertLoyaltyCard("store", "note", "cardId", BarcodeFormat.UPC_A.toString());
|
||||
LoyaltyCard card = db.getLoyaltyCard(1);
|
||||
|
||||
Cursor cursor = db.getLoyaltyCardCursor();
|
||||
cursor.moveToFirst();
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user