diff options
author | Alexander Zatsepin <az@mapswithme.com> | 2018-04-19 18:26:57 +0300 |
---|---|---|
committer | Aleksandr Zatsepin <alexzatsepin@users.noreply.github.com> | 2018-04-25 15:38:50 +0300 |
commit | 5a69bebf8adbf4898b23b2f731c275c599f72a60 (patch) | |
tree | be6b92d8e71f0a52fa756f69c12429664147403a /android/src | |
parent | 11c74d704f9b6341620ac1576648618a7073cc86 (diff) |
[android] Fixed statistics for category shown
Diffstat (limited to 'android/src')
-rw-r--r-- | android/src/com/mapswithme/maps/search/CategoriesAdapter.java | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/android/src/com/mapswithme/maps/search/CategoriesAdapter.java b/android/src/com/mapswithme/maps/search/CategoriesAdapter.java index 39e05c8304..275d80ea63 100644 --- a/android/src/com/mapswithme/maps/search/CategoriesAdapter.java +++ b/android/src/com/mapswithme/maps/search/CategoriesAdapter.java @@ -2,7 +2,6 @@ package com.mapswithme.maps.search; import android.content.res.Resources; import android.support.annotation.DrawableRes; -import android.support.annotation.IdRes; import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.support.annotation.StringRes; @@ -50,21 +49,18 @@ class CategoriesAdapter extends RecyclerView.Adapter<CategoriesAdapter.ViewHolde String key = keys[i]; mCategoryResIds[i] = resources.getIdentifier(key, "string", packageName); - if (mCategoryResIds[i] == 0) + PromoCategory promo = PromoCategory.findByKey(key); + if (promo != null) { - PromoCategory category = PromoCategory.findByKey(key); - if (category != null) - { - Statistics.INSTANCE.trackSponsoredEventForCustomProvider( - Statistics.EventName.SEARCH_SPONSOR_CATEGORY_SHOWN, - category.getStatisticValue()); - mCategoryResIds[i] = category.getStringId(); - } - - if (mCategoryResIds[i] == 0) - throw new IllegalStateException("Can't get string resource id for category:" + key); + Statistics.INSTANCE.trackSponsoredEventForCustomProvider( + Statistics.EventName.SEARCH_SPONSOR_CATEGORY_SHOWN, + promo.getStatisticValue()); + mCategoryResIds[i] = promo.getStringId(); } + if (mCategoryResIds[i] == 0) + throw new IllegalStateException("Can't get string resource id for category:" + key); + String iconId = "ic_category_" + key; if (isNightTheme) iconId = iconId + "_night"; |