diff --git a/android/src/com/mapswithme/maps/ads/DefaultAdTracker.java b/android/src/com/mapswithme/maps/ads/DefaultAdTracker.java
index c66359510a..6fbfe8298c 100644
--- a/android/src/com/mapswithme/maps/ads/DefaultAdTracker.java
+++ b/android/src/com/mapswithme/maps/ads/DefaultAdTracker.java
@@ -125,6 +125,10 @@ public class DefaultAdTracker implements AdTracker, OnAdCacheModifiedListener
LOGGER.d(TAG, "it's a last time for this ad");
return;
}
+
+ if (mTimestamp == 0)
+ throw new AssertionError("A timestamp mustn't be 0 when ad is hidden!");
+
mShowTime += SystemClock.elapsedRealtime() - mTimestamp;
LOGGER.d(TAG, "A show time = " + mShowTime);
mTimestamp = 0;
diff --git a/android/src/com/mapswithme/maps/ads/FacebookAdsLoader.java b/android/src/com/mapswithme/maps/ads/FacebookAdsLoader.java
index 2a8e27ca93..d0ecce391c 100644
--- a/android/src/com/mapswithme/maps/ads/FacebookAdsLoader.java
+++ b/android/src/com/mapswithme/maps/ads/FacebookAdsLoader.java
@@ -41,8 +41,8 @@ class FacebookAdsLoader extends BaseNativeAdLoader implements AdListener
}
/**
- * Loads an ad for a specified banner id. If there is a cached ad, and it's not expired,
- * the caller will be notified immediately through {@link NativeAdListener#onAdLoaded(MwmNativeAd)}.
+ * Loads an ad for a specified banner id. If there is a cached ad, the caller will be notified
+ * immediately through {@link NativeAdListener#onAdLoaded(MwmNativeAd)}.
* Otherwise, the caller will be notified once an ad is loaded through the mentioned method.
*
*
Important note: if there is a cached ad for the requested banner id, and that ad
@@ -55,7 +55,7 @@ class FacebookAdsLoader extends BaseNativeAdLoader implements AdListener
{
LOGGER.d(TAG, "Load a facebook ad for a banner id '" + bannerId + "'");
- FacebookNativeAd cachedAd = CACHE.get(bannerId);
+ FacebookNativeAd cachedAd = getAdByIdFromCache(bannerId);
if (cachedAd == null)
{
@@ -100,8 +100,8 @@ class FacebookAdsLoader extends BaseNativeAdLoader implements AdListener
@Override
public void onError(Ad ad, AdError adError)
{
- LOGGER.w(TAG, "A error '" + adError + "' is occurred while loading an ad for banner id " +
- "'" + ad.getPlacementId() + "'");
+ LOGGER.w(TAG, "A error '" + adError.getErrorMessage() + "' is occurred while loading " +
+ "an ad for banner id '" + ad.getPlacementId() + "'");
PENDING_REQUESTS.remove(ad.getPlacementId());
if (getAdListener() != null)
getAdListener().onError(new FacebookNativeAd((NativeAd)ad), new FacebookAdError(adError));
diff --git a/android/src/com/mapswithme/maps/widget/placepage/BannerController.java b/android/src/com/mapswithme/maps/widget/placepage/BannerController.java
index df8183ebbc..426454f9a7 100644
--- a/android/src/com/mapswithme/maps/widget/placepage/BannerController.java
+++ b/android/src/com/mapswithme/maps/widget/placepage/BannerController.java
@@ -295,11 +295,11 @@ final class BannerController
if (mBanner == null || TextUtils.isEmpty(mBanner.getId()))
return;
- boolean isCacheEmpty = mCurrentAd != null;
- setErrorStatus(isCacheEmpty);
+ boolean isNotCached = mCurrentAd == null;
+ setErrorStatus(isNotCached);
updateVisibility();
- if (mListener != null && isCacheEmpty)
+ if (mListener != null && isNotCached)
mListener.onSizeChanged();
Statistics.INSTANCE.trackNativeAdError(mBanner.getId(), ad, error, mOpened ? 1 : 0);