From b9b638de455914f66371f3681c0f4c0aafd37bbb Mon Sep 17 00:00:00 2001 From: Sylvia van Os Date: Fri, 27 Aug 2021 23:42:03 +0200 Subject: [PATCH] Initial card layout --- .../card_locker/LoyaltyCardCursorAdapter.java | 50 ++-- .../drawable/ic_baseline_access_time_24.xml | 13 + .../res/drawable/ic_baseline_payments_24.xml | 10 + .../main/res/layout/loyalty_card_layout.xml | 222 ++++++++++-------- .../LoyaltyCardCursorAdapterTest.java | 6 +- 5 files changed, 174 insertions(+), 127 deletions(-) create mode 100644 app/src/main/res/drawable/ic_baseline_access_time_24.xml create mode 100644 app/src/main/res/drawable/ic_baseline_payments_24.xml diff --git a/app/src/main/java/protect/card_locker/LoyaltyCardCursorAdapter.java b/app/src/main/java/protect/card_locker/LoyaltyCardCursorAdapter.java index ddcdccb1d..a9db0eeb9 100644 --- a/app/src/main/java/protect/card_locker/LoyaltyCardCursorAdapter.java +++ b/app/src/main/java/protect/card_locker/LoyaltyCardCursorAdapter.java @@ -4,6 +4,7 @@ import android.content.Context; import android.database.Cursor; import android.graphics.Color; import android.graphics.PorterDuff; +import android.graphics.drawable.Drawable; import android.util.SparseBooleanArray; import android.view.HapticFeedbackConstants; import android.view.LayoutInflater; @@ -14,6 +15,8 @@ import android.widget.LinearLayout; import android.widget.RelativeLayout; import android.widget.TextView; +import com.google.android.material.card.MaterialCardView; + import androidx.cardview.widget.CardView; import androidx.constraintlayout.widget.ConstraintLayout; import androidx.recyclerview.widget.RecyclerView; @@ -83,33 +86,34 @@ public class LoyaltyCardCursorAdapter extends BaseCursorAdapter + + + diff --git a/app/src/main/res/drawable/ic_baseline_payments_24.xml b/app/src/main/res/drawable/ic_baseline_payments_24.xml new file mode 100644 index 000000000..f11f1e781 --- /dev/null +++ b/app/src/main/res/drawable/ic_baseline_payments_24.xml @@ -0,0 +1,10 @@ + + + diff --git a/app/src/main/res/layout/loyalty_card_layout.xml b/app/src/main/res/layout/loyalty_card_layout.xml index 80175c980..2e5553bd2 100644 --- a/app/src/main/res/layout/loyalty_card_layout.xml +++ b/app/src/main/res/layout/loyalty_card_layout.xml @@ -1,118 +1,136 @@ - + android:layout_margin="8dp"> + android:orientation="vertical"> - + android:orientation="vertical" + android:padding="16dp"> - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - \ No newline at end of file + \ No newline at end of file diff --git a/app/src/test/java/protect/card_locker/LoyaltyCardCursorAdapterTest.java b/app/src/test/java/protect/card_locker/LoyaltyCardCursorAdapterTest.java index 2ee875b24..c67aa27ba 100644 --- a/app/src/test/java/protect/card_locker/LoyaltyCardCursorAdapterTest.java +++ b/app/src/test/java/protect/card_locker/LoyaltyCardCursorAdapterTest.java @@ -154,7 +154,7 @@ public class LoyaltyCardCursorAdapterTest { final Context context = activity.getApplicationContext(); Date expiryDate = new Date(); - String dateString = context.getString(R.string.expiryStateSentence, DateFormat.getDateInstance(DateFormat.LONG).format(expiryDate)); + String dateString = DateFormat.getDateInstance(DateFormat.LONG).format(expiryDate); db.insertLoyaltyCard("store", "note", expiryDate, new BigDecimal("0"), null, "cardId", null, BarcodeFormat.UPC_A, Color.BLACK, 0); LoyaltyCard card = db.getLoyaltyCard(1); @@ -260,7 +260,7 @@ public class LoyaltyCardCursorAdapterTest View view = createView(cursor); - checkView(view, card.store, card.note, "", "Balance: 100 points",false); + checkView(view, card.store, card.note, "", "100 points",false); cursor.close(); } @@ -276,7 +276,7 @@ public class LoyaltyCardCursorAdapterTest View view = createView(cursor); - checkView(view, card.store, card.note, "", "Balance: $10.00",false); + checkView(view, card.store, card.note, "", "$10.00",false); cursor.close(); }