blob: 18414624084500152e5804fa365b3579fe2d4b02 (
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
|
package com.mapswithme.maps.ads;
import android.support.annotation.NonNull;
import android.view.View;
import com.mapswithme.maps.R;
import com.mapswithme.util.UiUtils;
import com.mapswithme.util.log.Logger;
import com.mapswithme.util.log.LoggerFactory;
abstract class BaseMwmNativeAd implements MwmNativeAd
{
private static final Logger LOGGER = LoggerFactory.INSTANCE.getLogger(LoggerFactory.Type.MISC);
private static final String TAG = BaseMwmNativeAd.class.getSimpleName();
@Override
public void registerView(@NonNull View view)
{
View largeAction = view.findViewById(R.id.tv__action_large);
if (UiUtils.isVisible(largeAction))
{
LOGGER.d(TAG, "Register the large action button for '" + getBannerId() + "'");
register(largeAction);
return;
}
View smallAction = view.findViewById(R.id.tv__action_small);
if (UiUtils.isVisible(smallAction))
{
LOGGER.d(TAG, "Register the small action button for '" + getBannerId() + "'");
register(smallAction);
}
}
@Override
public void unregisterView(@NonNull View bannerView)
{
View largeAction = bannerView.findViewById(R.id.tv__action_large);
if (UiUtils.isVisible(largeAction))
{
LOGGER.d(TAG, "Unregister the large action button for '" + getBannerId() + "'");
unregister(largeAction);
return;
}
View smallAction = bannerView.findViewById(R.id.tv__action_small);
if (UiUtils.isVisible(smallAction))
{
LOGGER.d(TAG, "Unregister the small action button for '" + getBannerId() + "'");
unregister(smallAction);
}
}
abstract void register(@NonNull View view);
abstract void unregister(@NonNull View view);
@Override
public String toString()
{
return "Ad title: " + getTitle();
}
}
|