• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java NativeImageHelper类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.mopub.nativeads.NativeImageHelper的典型用法代码示例。如果您正苦于以下问题:Java NativeImageHelper类的具体用法?Java NativeImageHelper怎么用?Java NativeImageHelper使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



NativeImageHelper类属于com.mopub.nativeads包,在下文中一共展示了NativeImageHelper类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: update

import com.mopub.nativeads.NativeImageHelper; //导入依赖的package包/类
private void update(@NonNull final VM5MediaViewHolder mediaViewHolder,
                    @NonNull final VideoNativeAd videoNativeAd) {
    NativeRendererHelper.addTextView(mediaViewHolder.titleView,
            videoNativeAd.getTitle());
    NativeRendererHelper.addTextView(mediaViewHolder.textView, videoNativeAd.getText());
    NativeRendererHelper.addCtaButton(mediaViewHolder.callToActionView,
            mediaViewHolder.mainView, videoNativeAd.getCallToAction()
    );
    if (mediaViewHolder.mediaLayout != null) {
        NativeImageHelper.loadImageView(videoNativeAd.getMainImageUrl(),
                mediaViewHolder.mediaLayout.getMainImageView());
    }
    NativeImageHelper.loadImageView(videoNativeAd.getIconImageUrl(),
            mediaViewHolder.iconImageView);
    NativeRendererHelper.addPrivacyInformationIcon(
            mediaViewHolder.privacyInformationIconImageView,
            videoNativeAd.getPrivacyInformationIconImageUrl(),
            videoNativeAd.getPrivacyInformationIconClickThroughUrl());
}
 
开发者ID:VMFive,项目名称:android-sdk-3.0,代码行数:20,代码来源:VM5MoPubVideoNativeAdRenderer.java


示例2: update

import com.mopub.nativeads.NativeImageHelper; //导入依赖的package包/类
private void update(final TwitterStaticNativeAd staticNativeView,
        final StaticNativeAd staticNativeAd) {
    NativeRendererHelper.addTextView(staticNativeView.adTitleView,
            staticNativeAd.getTitle());
    NativeRendererHelper.addTextView(staticNativeView.adTextView, staticNativeAd.getText());
    NativeRendererHelper.addTextView(staticNativeView.callToActionView,
            staticNativeAd.getCallToAction());
    NativeImageHelper.loadImageView(staticNativeAd.getMainImageUrl(),
            staticNativeView.mainImageView);
    NativeImageHelper.loadImageView(staticNativeAd.getIconImageUrl(),
            staticNativeView.adIconView);
    NativeRendererHelper.addPrivacyInformationIcon(
            staticNativeView.privacyInfoView,
            staticNativeAd.getPrivacyInformationIconImageUrl(),
            staticNativeAd.getPrivacyInformationIconClickThroughUrl());
}
 
开发者ID:twitter,项目名称:twitter-kit-android,代码行数:17,代码来源:TwitterStaticNativeAdRenderer.java


示例3: onNativeAdsLoaded

import com.mopub.nativeads.NativeImageHelper; //导入依赖的package包/类
@Override
public void onNativeAdsLoaded(final List nativeAds)
{
    final AppLovinNativeAd nativeAd = (AppLovinNativeAd) nativeAds.get( 0 );

    log( DEBUG, "Native ad did load ad: " + nativeAd.getAdId() );

    final List<String> imageUrls = new ArrayList<>( 2 );

    if ( nativeAd.getIconUrl() != null ) imageUrls.add( nativeAd.getIconUrl() );
    if ( nativeAd.getImageUrl() != null ) imageUrls.add( nativeAd.getImageUrl() );

    // Please note: If/when we add support for videos, we must use AppLovin SDK's built-in precaching mechanism

    runOnUiThread( new Runnable()
    {
        @Override
        public void run()
        {
            NativeImageHelper.preCacheImages( context, imageUrls, new NativeImageHelper.ImageListener()
            {
                @Override
                public void onImagesCached()
                {
                    handleNativeAdFinishedCaching( nativeAd );
                }

                @Override
                public void onImagesFailedToCache(NativeErrorCode nativeErrorCode)
                {
                    handleNativeAdFinishedCaching( nativeAd );
                }
            } );
        }
    } );
}
 
开发者ID:AppLovin,项目名称:SDK-Network-Adaptors,代码行数:37,代码来源:AppLovinCustomEventNative.java


示例4: onAdLoaded

import com.mopub.nativeads.NativeImageHelper; //导入依赖的package包/类
@Override
public void onAdLoaded(AdObject adObject) {
    Log.d(TAG, "Native ad loaded successfully.");

    if (mAdDelegator == null) {
        mCustomEventNativeListener.onNativeAdFailed(NativeErrorCode.NETWORK_INVALID_STATE);
        return;
    }

    if (adObject.getAdTitle() != null && !adObject.getAdTitle().equals("")) {
        setTitle(adObject.getAdTitle());
    } else {
        setTitle("title");
    }
    if (adObject.getAdDescription() != null && !adObject.getAdDescription().equals("")) {
        setText(adObject.getAdDescription());
    } else {
        setText("description");
    }

    if (adObject.getImageUrl() != null) {
        setMainImageUrl(adObject.getImageUrl());
    }

    if (adObject.getIconUrl() != null) {
        setIconImageUrl(adObject.getIconUrl());
    }

    setClickDestinationUrl(adObject.getAdTrigger().getActionUrl());
    if (adObject.getAdCtaText() != null && !adObject.getAdCtaText().equals("")) {
        setCallToAction(adObject.getAdCtaText());
    } else {
        setCallToAction("More");
    }

    setStarRating(1.0);
    setImpressionMinTimeViewed(IMPRESSION_MIN_TIME_VIEWED);

    final List<String> imageUrls = new ArrayList<String>();
    final String mainImageUrl = getMainImageUrl();
    if (mainImageUrl != null) {
        imageUrls.add(mainImageUrl);
    }

    final String iconUrl = getIconImageUrl();
    if (iconUrl != null) {
        imageUrls.add(iconUrl);
    }

    preCacheImages(mContext, imageUrls, new NativeImageHelper.ImageListener() {
        @Override
        public void onImagesCached() {
            mCustomEventNativeListener.onNativeAdLoaded(VM5StaticNativeAd.this);
        }

        @Override
        public void onImagesFailedToCache(NativeErrorCode errorCode) {
            mCustomEventNativeListener.onNativeAdFailed(errorCode);
        }
    });
    onDestroy();
}
 
开发者ID:VMFive,项目名称:android-sdk-3.0,代码行数:63,代码来源:VM5NativeStatic.java


示例5: PMMoPubNativeAdAdapter

import com.mopub.nativeads.NativeImageHelper; //导入依赖的package包/类
public PMMoPubNativeAdAdapter(@NonNull NativeAd ad, final Context context, final CustomEventNative.CustomEventNativeListener customEventNativeListener) {
        this.customEventNativeListener = customEventNativeListener;
        this.ad = ad;
        this.context = context;

        NativeAdImages images = ad.getImages();

        setIconImageUrl(ad.getCampaignImage());
        if(images.getBanner() != null) {
            setMainImageUrl(images.getBanner().getUrl());
        }

        setTitle(ad.getCampaignName());
        setCallToAction(ad.getActionText());
        setText(ad.getCampaignDescription());

        setClickDestinationUrl(ad.getClickURL());

//        setPrivacyInformationIconClickThroughUrl(ad.getRedirectionUrl());
//        setPrivacyInformationIconImageUrl(ad.getIconUrl());

        final List<String> imageUrls = new ArrayList<String>();
        final String mainImageUrl = getMainImageUrl();
        if (mainImageUrl != null) {
            imageUrls.add(getMainImageUrl());
        }
        final String iconUrl = getIconImageUrl();
        if (iconUrl != null) {
            imageUrls.add(getIconImageUrl());
        }

        NativeImageHelper.preCacheImages(context, imageUrls, new NativeImageHelper.ImageListener() {
            @Override
            public void onImagesCached() {
                customEventNativeListener.onNativeAdLoaded(PMMoPubNativeAdAdapter.this);
            }

            @Override
            public void onImagesFailedToCache(NativeErrorCode errorCode) {
                customEventNativeListener.onNativeAdFailed(errorCode);
            }
        });

    }
 
开发者ID:Pocketbrain,项目名称:androidnativeadslib,代码行数:45,代码来源:PMMoPubNativeAdAdapter.java


示例6: trackView

import com.mopub.nativeads.NativeImageHelper; //导入依赖的package包/类
public void trackView(View view) {

        mMopubNativeAdData.prepare(view);

        if (!(view instanceof ViewGroup)) {
            return;
        }

        ViewGroup adView = (ViewGroup) view;

        View overlayView = adView.getChildAt(adView.getChildCount() - 1);
        if (overlayView instanceof FrameLayout) {

            final Context context = view.getContext();
            if (context == null) {
                return;
            }

            privacyInformationIconImageView = new ImageView(context);
            String privacyInformationImageUrl =
                    mMopubNativeAdData.getPrivacyInformationIconImageUrl();
            final String privacyInformationClickthroughUrl = mMopubNativeAdData
                    .getPrivacyInformationIconClickThroughUrl();

            if (privacyInformationImageUrl == null) {
                privacyInformationIconImageView.setImageDrawable(
                        Drawables.NATIVE_PRIVACY_INFORMATION_ICON.createDrawable(context));
            } else {
                NativeImageHelper.loadImageView(privacyInformationImageUrl,
                        privacyInformationIconImageView);
            }

            privacyInformationIconImageView.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(final View v) {
                    new UrlHandler.Builder()
                            .withSupportedUrlActions(
                                    UrlAction.IGNORE_ABOUT_SCHEME,
                                    UrlAction.OPEN_NATIVE_BROWSER,
                                    UrlAction.OPEN_IN_APP_BROWSER,
                                    UrlAction.HANDLE_SHARE_TWEET,
                                    UrlAction.FOLLOW_DEEP_LINK_WITH_FALLBACK,
                                    UrlAction.FOLLOW_DEEP_LINK)
                            .build().handleUrl(context, privacyInformationClickthroughUrl);
                }
            });
            privacyInformationIconImageView.setVisibility(View.VISIBLE);
            ((ViewGroup) overlayView).addView(privacyInformationIconImageView);

            float scale = context.getResources().getDisplayMetrics().density;
            int icon_size_px = (int) (mPrivacyIconSize * scale + 0.5);
            FrameLayout.LayoutParams params =
                    new FrameLayout.LayoutParams(icon_size_px, icon_size_px);

            switch (privacyIconPlacement) {
                case NativeAdOptions.ADCHOICES_TOP_LEFT:
                    params.gravity = Gravity.TOP | Gravity.LEFT;
                    break;
                case NativeAdOptions.ADCHOICES_BOTTOM_RIGHT:
                    params.gravity = Gravity.BOTTOM | Gravity.RIGHT;
                    break;
                case NativeAdOptions.ADCHOICES_BOTTOM_LEFT:
                    params.gravity = Gravity.BOTTOM | Gravity.LEFT;
                    break;
                case NativeAdOptions.ADCHOICES_TOP_RIGHT:
                    params.gravity = Gravity.TOP | Gravity.RIGHT;
                    break;
                default:
                    params.gravity = Gravity.TOP | Gravity.RIGHT;
            }
            privacyInformationIconImageView.setLayoutParams(params);
            adView.requestLayout();
        } else {
            Log.d(MoPubAdapter.TAG, "Failed to show AdChoices icon.");
        }


    }
 
开发者ID:googleads,项目名称:googleads-mobile-android-mediation,代码行数:79,代码来源:MoPubNativeAppInstallAdMapper.java


示例7: preCacheImages

import com.mopub.nativeads.NativeImageHelper; //导入依赖的package包/类
/**
* Helper method to pre-cache ad images.
* @param imageUrls A list of images to cache.
*/
protected void preCacheImages(@NonNull final List<String> imageUrls) {
    NativeImageHelper.preCacheImages(this.context, imageUrls, this.imageListener);
}
 
开发者ID:ayltai,项目名称:mopub-nativead-adapters,代码行数:8,代码来源:BaseStaticNativeAd.java



注:本文中的com.mopub.nativeads.NativeImageHelper类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java JobPrioritySupported类代码示例发布时间:2022-05-22
下一篇:
Java EastNorth类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap