diff --git a/android/res/drawable-hdpi/ic_ad_dark.png b/android/res/drawable-hdpi/ic_ad_dark.png
new file mode 100644
index 0000000000..04f912a4ea
Binary files /dev/null and b/android/res/drawable-hdpi/ic_ad_dark.png differ
diff --git a/android/res/drawable-hdpi/ic_ad_light.png b/android/res/drawable-hdpi/ic_ad_light.png
new file mode 100644
index 0000000000..ebbafc27d3
Binary files /dev/null and b/android/res/drawable-hdpi/ic_ad_light.png differ
diff --git a/android/res/drawable-hdpi/ic_ads_fb.png b/android/res/drawable-hdpi/ic_ads_fb.png
new file mode 100644
index 0000000000..ca42023980
Binary files /dev/null and b/android/res/drawable-hdpi/ic_ads_fb.png differ
diff --git a/android/res/drawable-mdpi/ic_ad_dark.png b/android/res/drawable-mdpi/ic_ad_dark.png
new file mode 100644
index 0000000000..6a50bdc447
Binary files /dev/null and b/android/res/drawable-mdpi/ic_ad_dark.png differ
diff --git a/android/res/drawable-mdpi/ic_ad_light.png b/android/res/drawable-mdpi/ic_ad_light.png
new file mode 100644
index 0000000000..b3e3a9564a
Binary files /dev/null and b/android/res/drawable-mdpi/ic_ad_light.png differ
diff --git a/android/res/drawable-mdpi/ic_ads_fb.png b/android/res/drawable-mdpi/ic_ads_fb.png
new file mode 100644
index 0000000000..e05f1efd70
Binary files /dev/null and b/android/res/drawable-mdpi/ic_ads_fb.png differ
diff --git a/android/res/drawable-xhdpi/ic_ad_dark.png b/android/res/drawable-xhdpi/ic_ad_dark.png
new file mode 100644
index 0000000000..597cd597fe
Binary files /dev/null and b/android/res/drawable-xhdpi/ic_ad_dark.png differ
diff --git a/android/res/drawable-xhdpi/ic_ad_light.png b/android/res/drawable-xhdpi/ic_ad_light.png
new file mode 100644
index 0000000000..04f9af706b
Binary files /dev/null and b/android/res/drawable-xhdpi/ic_ad_light.png differ
diff --git a/android/res/drawable-xhdpi/ic_ads_fb.png b/android/res/drawable-xhdpi/ic_ads_fb.png
new file mode 100644
index 0000000000..d9af4bf007
Binary files /dev/null and b/android/res/drawable-xhdpi/ic_ads_fb.png differ
diff --git a/android/res/drawable-xxhdpi/ic_ad_dark.png b/android/res/drawable-xxhdpi/ic_ad_dark.png
new file mode 100644
index 0000000000..f071a54dd2
Binary files /dev/null and b/android/res/drawable-xxhdpi/ic_ad_dark.png differ
diff --git a/android/res/drawable-xxhdpi/ic_ad_light.png b/android/res/drawable-xxhdpi/ic_ad_light.png
new file mode 100644
index 0000000000..9ccb3ebeed
Binary files /dev/null and b/android/res/drawable-xxhdpi/ic_ad_light.png differ
diff --git a/android/res/drawable-xxhdpi/ic_ads_fb.png b/android/res/drawable-xxhdpi/ic_ads_fb.png
new file mode 100644
index 0000000000..2fae0821b4
Binary files /dev/null and b/android/res/drawable-xxhdpi/ic_ads_fb.png differ
diff --git a/android/res/drawable-xxxhdpi/ic_ad_dark.png b/android/res/drawable-xxxhdpi/ic_ad_dark.png
new file mode 100644
index 0000000000..c27807276c
Binary files /dev/null and b/android/res/drawable-xxxhdpi/ic_ad_dark.png differ
diff --git a/android/res/drawable-xxxhdpi/ic_ad_light.png b/android/res/drawable-xxxhdpi/ic_ad_light.png
new file mode 100644
index 0000000000..04a0ed230e
Binary files /dev/null and b/android/res/drawable-xxxhdpi/ic_ad_light.png differ
diff --git a/android/res/drawable-xxxhdpi/ic_ads_fb.png b/android/res/drawable-xxxhdpi/ic_ads_fb.png
new file mode 100644
index 0000000000..3929534205
Binary files /dev/null and b/android/res/drawable-xxxhdpi/ic_ads_fb.png differ
diff --git a/android/res/layout/place_page_banner.xml b/android/res/layout/place_page_banner.xml
index 54c20def0e..015d6239ba 100644
--- a/android/res/layout/place_page_banner.xml
+++ b/android/res/layout/place_page_banner.xml
@@ -60,20 +60,13 @@
android:layout_toEndOf="@id/iv__banner_icon"
android:layout_toRightOf="@id/iv__banner_icon"
android:gravity="center_vertical">
-
+ android:visibility="gone"/>
+
diff --git a/android/res/values/themes-base.xml b/android/res/values/themes-base.xml
index d4883ac2f2..a38dd3729c 100644
--- a/android/res/values/themes-base.xml
+++ b/android/res/values/themes-base.xml
@@ -122,6 +122,7 @@
- @color/black_4
- @drawable/dot_divider
- @drawable/button_with_border
+ - @drawable/ic_ad_light
@@ -246,5 +247,6 @@
- @color/white_4
- @drawable/dot_divider_night
- @drawable/button_with_border_night
+ - @drawable/ic_ad_dark
diff --git a/android/src/com/mapswithme/maps/ads/FacebookNativeAd.java b/android/src/com/mapswithme/maps/ads/FacebookNativeAd.java
index 5c765f95e0..2319c28e92 100644
--- a/android/src/com/mapswithme/maps/ads/FacebookNativeAd.java
+++ b/android/src/com/mapswithme/maps/ads/FacebookNativeAd.java
@@ -99,4 +99,11 @@ class FacebookNativeAd extends CachedMwmNativeAd
"AdListener class! Not '" + listener.getClass() + "'!");
mAd.setAdListener((AdListener) listener);
}
+
+ @NonNull
+ @Override
+ public NetworkType getNetworkType()
+ {
+ return NetworkType.FACEBOOK;
+ }
}
diff --git a/android/src/com/mapswithme/maps/ads/MopubNativeAd.java b/android/src/com/mapswithme/maps/ads/MopubNativeAd.java
index 88be1d5d27..acc3f71fb3 100644
--- a/android/src/com/mapswithme/maps/ads/MopubNativeAd.java
+++ b/android/src/com/mapswithme/maps/ads/MopubNativeAd.java
@@ -14,6 +14,7 @@ class MopubNativeAd extends CachedMwmNativeAd
{
@NonNull
private final NativeAd mNativeAd;
+ @NonNull
private final StaticNativeAd mAd;
MopubNativeAd(@NonNull NativeAd ad, long timestamp)
@@ -98,4 +99,16 @@ class MopubNativeAd extends CachedMwmNativeAd
+ listener.getClass() + "'!");
mNativeAd.setMoPubNativeEventListener((NativeAd.MoPubNativeEventListener) listener);
}
+
+ @NonNull
+ @Override
+ public NetworkType getNetworkType()
+ {
+ // There is no more elegant way to detect the type of the native ad when it's hidden under the
+ // Mopub architecture(classes).
+ String className = mAd.getClass().toString().toLowerCase();
+ if (className.contains("facebook"))
+ return NetworkType.FACEBOOK;
+ return NetworkType.UKNOWN;
+ }
}
diff --git a/android/src/com/mapswithme/maps/ads/MwmNativeAd.java b/android/src/com/mapswithme/maps/ads/MwmNativeAd.java
index 3ebeb6715c..2375fcf908 100644
--- a/android/src/com/mapswithme/maps/ads/MwmNativeAd.java
+++ b/android/src/com/mapswithme/maps/ads/MwmNativeAd.java
@@ -10,6 +10,10 @@ import android.view.View;
*/
public interface MwmNativeAd
{
+ enum NetworkType{
+ UNKNOWN, FACEBOOK, MYTARGET, GOOGLE;
+ }
+
@NonNull
String getBannerId();
@@ -51,4 +55,10 @@ public interface MwmNativeAd
*/
@Nullable
String getPrivacyInfoUrl();
+
+ /**
+ * Returns a network type which the native ad belongs to.
+ */
+ @NonNull
+ NetworkType getNetworkType();
}
diff --git a/android/src/com/mapswithme/maps/ads/MyTargetNativeAd.java b/android/src/com/mapswithme/maps/ads/MyTargetNativeAd.java
index 6a94af7beb..2ffa51b214 100644
--- a/android/src/com/mapswithme/maps/ads/MyTargetNativeAd.java
+++ b/android/src/com/mapswithme/maps/ads/MyTargetNativeAd.java
@@ -105,4 +105,11 @@ class MyTargetNativeAd extends CachedMwmNativeAd
"NativeAd.NativeAdListener class! Not '" + listener.getClass() + "'!");
mAd.setListener((NativeAd.NativeAdListener) listener);
}
+
+ @NonNull
+ @Override
+ public NetworkType getNetworkType()
+ {
+ return NetworkType.MYTARGET;
+ }
}
diff --git a/android/src/com/mapswithme/maps/widget/placepage/BannerController.java b/android/src/com/mapswithme/maps/widget/placepage/BannerController.java
index 1cf43e84c4..67e07b2405 100644
--- a/android/src/com/mapswithme/maps/widget/placepage/BannerController.java
+++ b/android/src/com/mapswithme/maps/widget/placepage/BannerController.java
@@ -13,7 +13,6 @@ import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
-import com.mapswithme.maps.MwmApplication;
import com.mapswithme.maps.R;
import com.mapswithme.maps.ads.AdTracker;
import com.mapswithme.maps.ads.Banner;
@@ -70,7 +69,7 @@ final class BannerController
@NonNull
private final TextView mActionLarge;
@NonNull
- private final View mAds;
+ private final ImageView mAdChoices;
private final float mCloseFrameHeight;
@@ -96,32 +95,18 @@ final class BannerController
mListener = listener;
Resources resources = mFrame.getResources();
mCloseFrameHeight = resources.getDimension(R.dimen.placepage_banner_height);
- mIcon = (ImageView) bannerView.findViewById(R.id.iv__banner_icon);
- mTitle = (TextView) bannerView.findViewById(R.id.tv__banner_title);
- mMessage = (TextView) bannerView.findViewById(R.id.tv__banner_message);
- mActionSmall = (TextView) bannerView.findViewById(R.id.tv__action_small);
- mActionLarge = (TextView) bannerView.findViewById(R.id.tv__action_large);
- mAds = bannerView.findViewById(R.id.tv__ads);
- mAds.setOnClickListener(new View.OnClickListener()
- {
- @Override
- public void onClick(View v)
- {
- handlePrivacyInfoUrl();
- }
- });
+ mIcon = bannerView.findViewById(R.id.iv__banner_icon);
+ mTitle = bannerView.findViewById(R.id.tv__banner_title);
+ mMessage = bannerView.findViewById(R.id.tv__banner_message);
+ mActionSmall = bannerView.findViewById(R.id.tv__action_small);
+ mActionLarge = bannerView.findViewById(R.id.tv__action_large);
+ mAdChoices = bannerView.findViewById(R.id.ad_choices);
+ mAdChoices.setOnClickListener(v -> handlePrivacyInfoUrl());
Resources res = mFrame.getResources();
- UiUtils.expandTouchAreaForView(mAds, (int) res.getDimension(R.dimen.margin_quarter_plus));
+ UiUtils.expandTouchAreaForView(mAdChoices, (int) res.getDimension(R.dimen.margin_quarter_plus));
mAdsLoader = loader;
mAdTracker = tracker;
- mFrame.setOnClickListener(new View.OnClickListener()
- {
- @Override
- public void onClick(View v)
- {
- animateActionButton();
- }
- });
+ mFrame.setOnClickListener(v -> animateActionButton());
}
private void handlePrivacyInfoUrl()
@@ -155,11 +140,11 @@ final class BannerController
if ((mAdsLoader.isAdLoading() || hasErrorOccurred())
&& mCurrentAd == null)
{
- UiUtils.hide(mIcon, mTitle, mMessage, mActionSmall, mActionLarge, mAds);
+ UiUtils.hide(mIcon, mTitle, mMessage, mActionSmall, mActionLarge, mAdChoices);
}
else
{
- UiUtils.show(mIcon, mTitle, mMessage, mActionSmall, mActionLarge, mAds);
+ UiUtils.show(mIcon, mTitle, mMessage, mActionSmall, mActionLarge, mAdChoices);
if (mOpened)
UiUtils.hide(mActionSmall);
else
@@ -292,6 +277,16 @@ final class BannerController
mMessage.setText(data.getDescription());
mActionSmall.setText(data.getAction());
mActionLarge.setText(data.getAction());
+ fillAdChoicesIcon(data);
+ }
+
+ private void fillAdChoicesIcon(@NonNull MwmNativeAd data)
+ {
+ MwmNativeAd.NetworkType type = data.getNetworkType();
+ if (type == MwmNativeAd.NetworkType.FACEBOOK)
+ mAdChoices.setImageResource(R.drawable.ic_ads_fb);
+ else
+ mAdChoices.setImageResource(ThemeUtils.getResource(mFrame.getContext(), R.attr.adChoicesIcon));
}
private void loadIconAndOpenIfNeeded(@NonNull MwmNativeAd data)