本文整理汇总了Java中com.mopub.nativeads.NativeImageHelper.loadImageView方法的典型用法代码示例。如果您正苦于以下问题:Java NativeImageHelper.loadImageView方法的具体用法?Java NativeImageHelper.loadImageView怎么用?Java NativeImageHelper.loadImageView使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.mopub.nativeads.NativeImageHelper
的用法示例。
在下文中一共展示了NativeImageHelper.loadImageView方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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());
}
示例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());
}
示例3: 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