Exemple #1
0
 protected void buildView() {
   super.buildView();
   Object obj;
   Object obj1;
   com.amazon.retailsearch.android.ui.results.views.messaging.ConsumableMessagingModel
       consumablemessagingmodel;
   if (TextUtils.isEmpty(product.getByLine())) {
     byLine.setVisibility(8);
   } else {
     byLine.setText(product.getByLine());
     byLine.setVisibility(0);
   }
   if (product.getCoupon() == null) {
     coupon.setVisibility(8);
   } else {
     obj =
         (new com.amazon.retailsearch.android.ui.results.views.messaging.CouponModel.Builder())
             .setBadgeText(product.getCoupon().getBadgeText())
             .setLabel(product.getCoupon().getLabel())
             .build();
     coupon.buildView(
         ((com.amazon.retailsearch.android.ui.results.views.messaging.CouponModel) (obj)),
         resultLayoutType);
     coupon.setVisibility(0);
   }
   obj1 = null;
   consumablemessagingmodel = null;
   obj = null;
   if (product.getPrices() == null || product.getPrices().getBuy() == null) {
     freshPastPurchasesContainer.setVisibility(8);
     freshPastPurchases.setVisibility(8);
     offerMessaging.setVisibility(8);
     exclusivityMessaging.setVisibility(8);
     primeOptionsView.setVisibility(8);
   } else {
     Object obj2 = null;
     obj = obj2;
     if (product.getPrices().getBuy().getShipping() != null) {
       obj = obj2;
       if (product.getPrices().getBuy().getShipping().getMessage() != null) {
         obj =
             (new com.amazon.retailsearch.android.ui.results.views.messaging
                     .ConsumableMessagingModel.Builder())
                 .setStyledBadgeMessage(product.getPrices().getBuy().getShipping().getMessage())
                 .build(product.getPrices().getBuy().getShipping());
       }
     }
     exclusivityMessaging.buildView(
         ((com.amazon.retailsearch.android.ui.results.views.messaging.ConsumableMessagingModel)
             (obj)),
         resultLayoutType);
     if ("amazonfresh".equals(model.getStore())) {
       primeOptionsView.setVisibility(8);
       if (hasPastPurchases()
           && ((StyledText) product.getHeaderBadge().getBadgeText().get(0)).getText() != null) {
         freshPastPurchases.setText(
             ((StyledText) product.getHeaderBadge().getBadgeText().get(0)).getText());
         freshPastPurchasesContainer.setVisibility(0);
         freshPastPurchases.setVisibility(0);
       } else {
         freshPastPurchasesContainer.setVisibility(8);
         freshPastPurchases.setVisibility(8);
       }
       if (product.getPrices().getBuy().getShipping() != null) {
         obj = product.getPrices().getBuy().getShipping().getMessage();
       } else {
         obj = null;
       }
       consumablemessagingmodel =
           (new com.amazon.retailsearch.android.ui.results.views.messaging.ConsumableMessagingModel
                   .Builder())
               .setStyledBadgeMessage(((List) (obj)))
               .build(product.getPrices().getBuy().getShipping());
       obj = obj1;
       obj1 = consumablemessagingmodel;
     } else {
       label0:
       {
         freshPastPurchasesContainer.setVisibility(8);
         freshPastPurchases.setVisibility(8);
         obj = consumablemessagingmodel;
         if (product.getPromotions() == null) {
           break label0;
         }
         obj1 = product.getPromotions().iterator();
         do {
           obj = consumablemessagingmodel;
           if (!((Iterator) (obj1)).hasNext()) {
             break label0;
           }
           obj = (Promotion) ((Iterator) (obj1)).next();
         } while (!"PANTRY".equalsIgnoreCase(((Promotion) (obj)).getType()));
         obj = ((Promotion) (obj)).getText();
       }
       obj1 =
           (new com.amazon.retailsearch.android.ui.results.views.messaging.ConsumableMessagingModel
                   .Builder())
               .setBadgeMessage(((String) (obj)))
               .build(product.getPrices().getBuy().getShipping());
       if (Utils.isEmpty(product.getPrices().getEditions())) {
         primeOptionsView.setVisibility(8);
       } else {
         com.amazon.retailsearch.android.ui.results.views.PrimeOptionsViewModel
             primeoptionsviewmodel =
                 (new com.amazon.retailsearch.android.ui.results.views.PrimeOptionsViewModel
                         .Builder(
                         product.getPrices().getEditions(),
                         product.getAsin(),
                         product.getGroup(),
                         gestureListener))
                     .build();
         primeOptionsView.buildView(primeoptionsviewmodel, resultLayoutType);
       }
     }
     offerMessaging.buildView(
         ((com.amazon.retailsearch.android.ui.results.views.messaging.ConsumableMessagingModel)
             (obj1)),
         resultLayoutType);
   }
   if ("C".equals(FeatureStateUtil.getDisableConsumableAddToCartWeblab(featureConfig))) {
     obj1 =
         (new com.amazon.retailsearch.android.ui.buttons.InlineActionsButtonModel.Builder())
             .setOffer(model.getActiveOffer());
     boolean flag;
     if (useOffers && numOffers > 1) {
       flag = true;
     } else {
       flag = false;
     }
     obj1 =
         ((com.amazon.retailsearch.android.ui.buttons.InlineActionsButtonModel.Builder) (obj1))
             .setHasMultipleOffers(flag)
             .setIsQuantitySwitcherEnabled(false)
             .setUseLongText(true)
             .setStyle(InlineActionsButtonStyle.FRESH)
             .setIsEnabledForStore("amazonfresh", model.getStore())
             .setIsEnabledForButtonType("ADD_TO_FRESH_CART", product.getActionButtons())
             .setIsViewOptionsEnabled(false)
             .build(product, model.getVisibleOfferCartState());
     inlineActionsButton.buildView(
         ((com.amazon.retailsearch.android.ui.buttons.InlineActionsButtonModel) (obj1)),
         resultLayoutType);
   } else {
     inlineActionsButton.setVisibility(8);
   }
   obj1 =
       (new com.amazon.retailsearch.android.ui.results.views.messaging.ShippingLineModel.Builder())
           .build(shippingInfo);
   generalShippingLine.buildView(
       ((com.amazon.retailsearch.android.ui.results.views.messaging.ShippingLineModel) (obj1)),
       resultLayoutType);
   obj =
       (new com.amazon.retailsearch.android.ui.results.views.messaging.PromotionsModel.Builder())
           .setHasAutoRip(hasAutoRip)
           .setPromotions(product.getPromotions())
           .setHidePantryPromotion(TextUtils.isEmpty(((CharSequence) (obj))))
           .build();
   promotions.buildView(
       ((com.amazon.retailsearch.android.ui.results.views.messaging.PromotionsModel) (obj)),
       resultLayoutType);
 }
Exemple #2
0
 protected boolean hasPastPurchases() {
   return product.getHeaderBadge() != null
       && !Utils.isEmpty(product.getHeaderBadge().getBadgeText());
 }