diff --git a/CHANGELOG.md b/CHANGELOG.md index f1987cc4b..17d2ef6c8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ Changes: +- Improve card list for landscape and tablet display - Add theming colour support (thanks, Subhashish Anand!) - Don't close scan activity on camera error (so manual entry is still possible) - Add all contributors to the about dialog diff --git a/app/src/main/java/protect/card_locker/LoyaltyCardCursorAdapter.java b/app/src/main/java/protect/card_locker/LoyaltyCardCursorAdapter.java index ddcdccb1d..1a50bde17 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; @@ -27,7 +30,7 @@ import protect.card_locker.preferences.Settings; public class LoyaltyCardCursorAdapter extends BaseCursorAdapter { - private static int mCurrentSelectedIndex = -1; + private int mCurrentSelectedIndex = -1; private Cursor mCursor; Settings mSettings; boolean mDarkModeEnabled; @@ -71,6 +74,9 @@ 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/content_main.xml b/app/src/main/res/layout/content_main.xml index e580804bc..ef2389684 100644 --- a/app/src/main/res/layout/content_main.xml +++ b/app/src/main/res/layout/content_main.xml @@ -38,9 +38,11 @@ + android:visibility="gone"/> diff --git a/app/src/main/res/layout/loyalty_card_layout.xml b/app/src/main/res/layout/loyalty_card_layout.xml index 80175c980..c1f94cb4b 100644 --- a/app/src/main/res/layout/loyalty_card_layout.xml +++ b/app/src/main/res/layout/loyalty_card_layout.xml @@ -1,118 +1,137 @@ - + 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/main/res/values-w600dp/integers.xml b/app/src/main/res/values-w600dp/integers.xml new file mode 100644 index 000000000..f12f93aff --- /dev/null +++ b/app/src/main/res/values-w600dp/integers.xml @@ -0,0 +1,4 @@ + + + 2 + \ No newline at end of file diff --git a/app/src/main/res/values-w820dp/dimens.xml b/app/src/main/res/values-w820dp/dimens.xml deleted file mode 100644 index 63fc81644..000000000 --- a/app/src/main/res/values-w820dp/dimens.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - 64dp - diff --git a/app/src/main/res/values/integers.xml b/app/src/main/res/values/integers.xml new file mode 100644 index 000000000..902c0f7bc --- /dev/null +++ b/app/src/main/res/values/integers.xml @@ -0,0 +1,4 @@ + + + 1 + \ 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(); } diff --git a/app/src/test/java/protect/card_locker/MainActivityTest.java b/app/src/test/java/protect/card_locker/MainActivityTest.java index 5af125eb4..c7df88982 100644 --- a/app/src/test/java/protect/card_locker/MainActivityTest.java +++ b/app/src/test/java/protect/card_locker/MainActivityTest.java @@ -148,6 +148,11 @@ public class MainActivityTest assertEquals(View.VISIBLE, list.getVisibility()); assertEquals(4, list.getAdapter().getItemCount()); + + // Make sure there is enough space to render all + list.measure(0, 0); + list.layout(0, 0, 100, 1000); + assertEquals("storeC", ((TextView) list.findViewHolderForAdapterPosition(0).itemView.findViewById(R.id.store)).getText()); assertEquals("storeD", ((TextView) list.findViewHolderForAdapterPosition(1).itemView.findViewById(R.id.store)).getText()); assertEquals("storeA", ((TextView) list.findViewHolderForAdapterPosition(2).itemView.findViewById(R.id.store)).getText()); diff --git a/fastlane/metadata/android/en-US/images/phoneScreenshots/screenshot-01.png b/fastlane/metadata/android/en-US/images/phoneScreenshots/screenshot-01.png index 94fa43ea4..f93376a70 100644 Binary files a/fastlane/metadata/android/en-US/images/phoneScreenshots/screenshot-01.png and b/fastlane/metadata/android/en-US/images/phoneScreenshots/screenshot-01.png differ diff --git a/fastlane/metadata/android/en-US/images/phoneScreenshots/screenshot-05.png b/fastlane/metadata/android/en-US/images/phoneScreenshots/screenshot-05.png index 580bd51e5..01ef5cc84 100644 Binary files a/fastlane/metadata/android/en-US/images/phoneScreenshots/screenshot-05.png and b/fastlane/metadata/android/en-US/images/phoneScreenshots/screenshot-05.png differ