use of com.my.target.ads.MyTargetView in project mytarget-android by myTargetSDK.
the class BannerAdActivity method initAd.
private void initAd() {
adView = new MyTargetView(this);
Tools.fillCustomParamsUserData(adView.getCustomParams());
adView.init(slotId);
adView.setListener(adListener);
float density = getResources().getDisplayMetrics().density;
RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, (int) (50 * density));
params.addRule(RelativeLayout.CENTER_HORIZONTAL);
adView.setLayoutParams(params);
layout.addView(adView);
adView.load();
}
use of com.my.target.ads.MyTargetView in project mytarget-android by myTargetSDK.
the class Standard300x250BannerFragment method createView.
private void createView() {
adView = new MyTargetView(getContext());
adView.init(slotId, MyTargetView.AdSize.BANNER_300x250);
Tools.fillCustomParamsUserData(adView.getCustomParams());
adView.setListener(adListener);
LayoutParams layoutParams = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
adView.setLayoutParams(layoutParams);
adView.load();
}
use of com.my.target.ads.MyTargetView in project mytarget-android by myTargetSDK.
the class Standard320x50BannerFragment method initAd.
private void initAd() {
final Context context = getActivity();
if (context == null) {
return;
}
adView = new MyTargetView(context);
adView.init(slotId);
Tools.fillCustomParamsUserData(adView.getCustomParams());
adView.setListener(adListener);
float density = getResources().getDisplayMetrics().density;
RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, (int) (50 * density));
params.addRule(RelativeLayout.CENTER_HORIZONTAL);
adView.setLayoutParams(params);
layout.addView(adView);
adView.load();
}
use of com.my.target.ads.MyTargetView in project mytarget-android by myTargetSDK.
the class Standard728x90BannerFragment method initAd.
private void initAd() {
final Context context = getActivity();
if (context == null) {
return;
}
adView = new MyTargetView(context);
adView.init(slotId, MyTargetView.AdSize.BANNER_728x90);
Tools.fillCustomParamsUserData(adView.getCustomParams());
adView.setListener(adListener);
float density = getResources().getDisplayMetrics().density;
RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, (int) (90 * density));
params.addRule(RelativeLayout.CENTER_HORIZONTAL);
adView.setLayoutParams(params);
layout.addView(adView);
adView.load();
}
use of com.my.target.ads.MyTargetView in project mytarget-android by myTargetSDK.
the class MyTargetMopubCustomEventBanner method loadBanner.
@Override
protected void loadBanner(Context context, CustomEventBannerListener customEventBannerListener, Map<String, Object> stringObjectMap, Map<String, String> stringStringMap) {
int slotId;
if (stringStringMap == null || stringStringMap.size() == 0 || !stringStringMap.containsKey(SLOT_ID_KEY)) {
Tracer.i("Unable to get slotId from parameter json. Probably Mopub mediation misconfiguration.");
if (customEventBannerListener != null) {
customEventBannerListener.onBannerFailed(MoPubErrorCode.NO_FILL);
}
return;
}
slotId = Integer.parseInt(stringStringMap.get(SLOT_ID_KEY));
bannerListener = customEventBannerListener;
if (myTargetView == null) {
myTargetView = new MyTargetView(context);
myTargetView.init(slotId, MyTargetView.AdSize.BANNER_320x50, false);
final CustomParams customParams = myTargetView.getCustomParams();
if (customParams != null) {
MopubCustomParamsUtils.fillCustomParams(customParams, stringObjectMap);
}
myTargetView.setListener(myTargetViewListener);
}
myTargetView.load();
}
Aggregations