コード例 #1
0
  private void renderSingleView() {
    singleCardView = new InlineCarouselCardView(getContext());
    singleCardView.setSdk(sdk);
    singleCardView.setAd(nativeAds.get(0));

    final InlineCarouselCardState singleCardState = new InlineCarouselCardState();
    singleCardState.setCurrentlyActive(true);

    singleCardView.setCardState(singleCardState);
    singleCardView.setUpView();

    singleCardView.setLayoutParams(
        LayoutUtils.createLinearParams(
            LayoutUtils.MATCH_PARENT,
            LayoutUtils.MATCH_PARENT,
            Gravity.CENTER,
            new LayoutUtils.DPMargins(
                getContext(),
                AppLovinCarouselViewSettings.VIEW_PAGER_MARGIN,
                0,
                AppLovinCarouselViewSettings.VIEW_PAGER_MARGIN,
                0)));

    addView(singleCardView);
  }
コード例 #2
0
 private void deactivateCard(int currentItem) {
   final InlineCarouselCardState cardState = getCardState(currentItem);
   if (cardState != null) {
     if (cardState.isCurrentlyActive()) {
       final WeakReference<InlineCarouselCardView> currentCardRef =
           adapter.getExistingCard(currentItem);
       if (currentCardRef != null) {
         final InlineCarouselCardView currentCard = currentCardRef.get();
         if (currentCard != null) {
           currentCard.onCardDeactivated();
         }
       }
     }
   }
 }