blob: 96eeb7d2f2730e83e2bd6b1e115c1cf7a22a2919 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
|
package com.mapswithme.maps.ads;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.view.View;
import android.widget.ImageView;
import com.my.target.common.CustomParams;
import com.my.target.common.models.ImageData;
import com.my.target.nativeads.NativeAd;
import com.my.target.nativeads.banners.NativePromoBanner;
import java.util.Map;
class MyTargetNativeAd extends CachedMwmNativeAd
{
@NonNull
private final NativeAd mAd;
@NonNull
private final String mBannerId;
MyTargetNativeAd(@NonNull NativeAd ad, long timestamp)
{
super(timestamp);
mAd = ad;
CustomParams params = mAd.getCustomParams();
Map<String, String> data = params.getData();
mBannerId = data.get(MyTargetAdsLoader.ZONE_KEY_PARAMETER);
}
@NonNull
@Override
public String getBannerId()
{
return mBannerId;
}
@NonNull
@Override
public String getTitle()
{
return mAd.getBanner().getTitle();
}
@NonNull
@Override
public String getDescription()
{
return mAd.getBanner().getDescription();
}
@NonNull
@Override
public String getAction()
{
return mAd.getBanner().getCtaText();
}
@Override
public void loadIcon(@NonNull View view)
{
NativePromoBanner banner = mAd.getBanner();
ImageData icon = banner.getIcon();
if (icon != null)
NativeAd.loadImageToView(icon, (ImageView) view);
}
@Override
public void unregister(@NonNull View view)
{
mAd.unregisterView();
}
@Override
void register(@NonNull View view)
{
mAd.registerView(view);
}
@NonNull
@Override
public String getProvider()
{
return Providers.MY_TARGET;
}
@Nullable
@Override
public String getPrivacyInfoUrl()
{
return null;
}
@Override
void detachAdListener()
{
mAd.setListener(null);
}
@Override
void attachAdListener(@NonNull Object listener)
{
if (!(listener instanceof NativeAd.NativeAdListener))
throw new AssertionError("A listener for myTarget ad must be instance of " +
"NativeAd.NativeAdListener class! Not '" + listener.getClass() + "'!");
mAd.setListener((NativeAd.NativeAdListener) listener);
}
@NonNull
@Override
public NetworkType getNetworkType()
{
return NetworkType.MYTARGET;
}
}
|