Skip to content

Commit 8009bac

Browse files
Remove unnecessary image load from storage calls
The LoyaltyCard object itself loads the images itself
1 parent e078659 commit 8009bac

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

app/src/main/java/protect/card_locker/CardsOnPowerScreenService.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ public Flow.Publisher<Control> createPublisherFor(@NonNull List<String> controlI
9999
}
100100

101101
private Bitmap getIcon(Context context, LoyaltyCard loyaltyCard) {
102-
Bitmap cardIcon = Utils.retrieveCardImage(context, loyaltyCard.id, ImageLocationType.icon);
102+
Bitmap cardIcon = loyaltyCard.getImageThumbnail(context);
103103

104104
if (cardIcon != null) {
105105
return cardIcon;

app/src/main/java/protect/card_locker/LoyaltyCardCursorAdapter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ public void onBindViewHolder(LoyaltyCardListItemViewHolder inputHolder, Cursor i
8989
inputHolder.mDivider.setVisibility(View.GONE);
9090

9191
LoyaltyCard loyaltyCard = LoyaltyCard.fromCursor(mContext, inputCursor);
92-
Bitmap icon = Utils.retrieveCardImage(mContext, loyaltyCard.id, ImageLocationType.icon);
92+
Bitmap icon = loyaltyCard.getImageThumbnail(mContext);
9393

9494
if (mLoyaltyCardListDisplayOptions.showingNameBelowThumbnail() && icon != null) {
9595
showDivider = true;

app/src/main/java/protect/card_locker/LoyaltyCardViewActivity.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@ public void onStopTrackingTouch(SeekBar seekBar) {
329329
binding.bottomAppBarUpdateBalanceButton.setOnClickListener(view -> showBalanceUpdateDialog());
330330

331331
binding.iconContainer.setOnClickListener(view -> {
332-
if (Utils.retrieveCardImage(this, loyaltyCard.id, ImageLocationType.icon) != null) {
332+
if (loyaltyCard.getImageThumbnail(this) != null) {
333333
openImageInGallery(ImageType.ICON);
334334
} else {
335335
Toast.makeText(LoyaltyCardViewActivity.this, R.string.icon_header_click_text, Toast.LENGTH_LONG).show();
@@ -719,7 +719,7 @@ protected void onResume() {
719719
editButtonIcon.setTint(Utils.needsDarkForeground(complementaryColor) ? Color.BLACK : Color.WHITE);
720720
binding.fabEdit.setImageDrawable(editButtonIcon);
721721

722-
Bitmap icon = Utils.retrieveCardImage(this, loyaltyCard.id, ImageLocationType.icon);
722+
Bitmap icon = loyaltyCard.getImageThumbnail(this);
723723
Utils.setIconOrTextWithBackground(this, loyaltyCard, icon, binding.iconImage, binding.iconText, 1);
724724

725725
// If the background is very bright, we should use dark icons
@@ -748,12 +748,12 @@ protected void onResume() {
748748
imageTypes.add(ImageType.BARCODE);
749749
}
750750

751-
frontImageBitmap = Utils.retrieveCardImage(this, loyaltyCard.id, ImageLocationType.front);
751+
frontImageBitmap = loyaltyCard.getImageFront(this);
752752
if (frontImageBitmap != null) {
753753
imageTypes.add(ImageType.IMAGE_FRONT);
754754
}
755755

756-
backImageBitmap = Utils.retrieveCardImage(this, loyaltyCard.id, ImageLocationType.back);
756+
backImageBitmap = loyaltyCard.getImageBack(this);
757757
if (backImageBitmap != null) {
758758
imageTypes.add(ImageType.IMAGE_BACK);
759759
}

app/src/main/java/protect/card_locker/ShortcutHelper.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ static ShortcutInfoCompat.Builder createShortcutBuilder(Context context, Loyalty
135135
bundle.putInt(LoyaltyCardViewActivity.BUNDLE_ID, loyaltyCard.id);
136136
intent.putExtras(bundle);
137137

138-
Bitmap iconBitmap = Utils.retrieveCardImage(context, loyaltyCard.id, ImageLocationType.icon);
138+
Bitmap iconBitmap = loyaltyCard.getImageThumbnail(context);
139139
if (iconBitmap == null) {
140140
iconBitmap = Utils.generateIcon(context, loyaltyCard, true).getLetterTile();
141141
} else {

0 commit comments

Comments
 (0)