Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoralexzatsepin <az@mapswithme.com>2016-11-22 17:07:28 +0300
committerДобрый Ээх <bukharaev@gmail.com>2016-12-09 20:11:35 +0300
commit5f2b7c90d049a1b5a1ef7d8b8e56a2d21d094fc5 (patch)
treea73a14f744e2cd49947aa78166aea63665d5507c /android
parent6c09259a9de1e504f2dc0e19b4c387df29b879d8 (diff)
[android] Added handling the mytarget banners show
Diffstat (limited to 'android')
-rw-r--r--android/src/com/mapswithme/maps/downloader/DownloaderAdapter.java14
-rw-r--r--android/src/com/mapswithme/util/statistics/MytargetHelper.java13
2 files changed, 22 insertions, 5 deletions
diff --git a/android/src/com/mapswithme/maps/downloader/DownloaderAdapter.java b/android/src/com/mapswithme/maps/downloader/DownloaderAdapter.java
index 5b6433d2c0..6208a15d1f 100644
--- a/android/src/com/mapswithme/maps/downloader/DownloaderAdapter.java
+++ b/android/src/com/mapswithme/maps/downloader/DownloaderAdapter.java
@@ -1010,6 +1010,7 @@ class DownloaderAdapter extends RecyclerView.Adapter<DownloaderAdapter.ViewHolde
{
mHeadersDecoration.invalidateHeaders();
notifyItemRangeInserted(mNearMeCount, mAds.size());
+ handleBannersShow(mAds);
return;
}
@@ -1019,6 +1020,12 @@ class DownloaderAdapter extends RecyclerView.Adapter<DownloaderAdapter.ViewHolde
initMytargetHelper();
}
+ private void handleBannersShow(@NonNull List<NativeAppwallBanner> ads)
+ {
+ if (mMytargetHelper != null)
+ mMytargetHelper.handleBannersShow(ads);
+ }
+
private void initMytargetHelper()
{
mMytargetHelper = new MytargetHelper(new MytargetHelper.Listener<Void>()
@@ -1054,14 +1061,17 @@ class DownloaderAdapter extends RecyclerView.Adapter<DownloaderAdapter.ViewHolde
{
mAdsLoading = false;
mAdsLoaded = true;
-
mAds.clear();
if (banners != null)
- for (NativeAppwallBanner banner: banners)
+ {
+ for (NativeAppwallBanner banner : banners)
if (!banner.isAppInstalled())
mAds.add(banner);
+ handleBannersShow(banners);
+ }
+
mHeadersDecoration.invalidateHeaders();
notifyDataSetChanged();
}
diff --git a/android/src/com/mapswithme/util/statistics/MytargetHelper.java b/android/src/com/mapswithme/util/statistics/MytargetHelper.java
index 97b924d977..88e300b891 100644
--- a/android/src/com/mapswithme/util/statistics/MytargetHelper.java
+++ b/android/src/com/mapswithme/util/statistics/MytargetHelper.java
@@ -35,6 +35,7 @@ public final class MytargetHelper
private static final int TIMEOUT = 1000;
+ @Nullable
private NativeAppwallAd mShowcase;
private boolean mCancelled;
@@ -134,10 +135,15 @@ public final class MytargetHelper
mShowcase = loadAds(listener, activity);
}
+ public void handleBannersShow(@NonNull List<NativeAppwallBanner> banners)
+ {
+ if (mShowcase != null)
+ mShowcase.handleBannersShow(banners);
+ }
+
private NativeAppwallAd loadAds(final @NonNull Listener<List<NativeAppwallBanner>> listener, Activity activity)
{
NativeAppwallAd res = new NativeAppwallAd(PrivateVariables.myTargetSlot(), activity);
- res.setCachePeriod(0);
res.setListener(new NativeAppwallAd.AppwallAdListener()
{
@Override
@@ -169,9 +175,10 @@ public final class MytargetHelper
return res;
}
- public void onBannerClick(NativeAppwallBanner banner)
+ public void onBannerClick(@NonNull NativeAppwallBanner banner)
{
- mShowcase.handleBannerClick(banner);
+ if (mShowcase != null)
+ mShowcase.handleBannerClick(banner);
}
public static boolean isShowcaseSwitchedOnServer()