mirror of
https://github.com/CatimaLoyalty/Android.git
synced 2026-03-28 12:21:38 -04:00
fix: reset mainImageIndex if it exceeds available image count
This commit is contained in:
@@ -1085,6 +1085,12 @@ public class LoyaltyCardViewActivity extends CatimaAppCompatActivity implements
|
||||
}
|
||||
|
||||
private void setMainImagePreviousNextButtons() {
|
||||
// Ensure the main image index is valid. After a card update, some images (front/back/barcode)
|
||||
// may have been removed, so the index should not exceed the number of available images.
|
||||
if(mainImageIndex > imageTypes.size() - 1){
|
||||
mainImageIndex = 0;
|
||||
}
|
||||
|
||||
if (imageTypes.size() < 2) {
|
||||
binding.mainLeftButton.setVisibility(View.INVISIBLE);
|
||||
binding.mainRightButton.setVisibility(View.INVISIBLE);
|
||||
|
||||
Reference in New Issue
Block a user