diff --git a/android/res/layout/catalog_promo_container.xml b/android/res/layout/catalog_promo_container.xml index 9dbef9d04d..ad3a2f3801 100644 --- a/android/res/layout/catalog_promo_container.xml +++ b/android/res/layout/catalog_promo_container.xml @@ -1,6 +1,7 @@ + diff --git a/android/src/com/mapswithme/maps/widget/placepage/PlacePageView.java b/android/src/com/mapswithme/maps/widget/placepage/PlacePageView.java index c63792826e..4d4d27037d 100644 --- a/android/src/com/mapswithme/maps/widget/placepage/PlacePageView.java +++ b/android/src/com/mapswithme/maps/widget/placepage/PlacePageView.java @@ -66,7 +66,6 @@ import com.mapswithme.maps.gallery.Constants; import com.mapswithme.maps.gallery.FullScreenGalleryActivity; import com.mapswithme.maps.gallery.GalleryActivity; import com.mapswithme.maps.gallery.Items; -import com.mapswithme.maps.gallery.impl.BaseItemSelectedListener; import com.mapswithme.maps.gallery.impl.Factory; import com.mapswithme.maps.gallery.impl.RegularCatalogPromoListener; import com.mapswithme.maps.location.LocationHelper; @@ -886,8 +885,8 @@ public class PlacePageView extends NestedScrollView false); mCatalogPromoRecycler.setLayoutManager(layoutManager); RecyclerView.ItemDecoration decor = - ItemDecoratorFactory.createSponsoredGalleryDecorator(getContext(), - LinearLayoutManager.HORIZONTAL); + ItemDecoratorFactory.createPlacePagePromoGalleryDecorator(getContext(), + LinearLayoutManager.HORIZONTAL); mCatalogPromoRecycler.addItemDecoration(decor); mCatalogPromoRecycler.setAdapter(mCatalogPromoLoadingAdapter); } @@ -2176,8 +2175,7 @@ public class PlacePageView extends NestedScrollView public void toggleCatalogPromoGallery(boolean enabled) { - UiUtils.showIf(enabled, mCatalogPromoRecycler); - UiUtils.showIf(enabled, mCatalogPromoTitleView); + UiUtils.showIf(enabled, this, R.id.catalog_promo_container); } @NonNull diff --git a/android/src/com/mapswithme/maps/widget/recycler/ItemDecoratorFactory.java b/android/src/com/mapswithme/maps/widget/recycler/ItemDecoratorFactory.java index ee0f1b32b4..12f3403f4f 100644 --- a/android/src/com/mapswithme/maps/widget/recycler/ItemDecoratorFactory.java +++ b/android/src/com/mapswithme/maps/widget/recycler/ItemDecoratorFactory.java @@ -9,6 +9,8 @@ import android.support.v7.widget.RecyclerView; import com.mapswithme.maps.R; +import java.util.Objects; + public class ItemDecoratorFactory { @NonNull @@ -16,7 +18,9 @@ public class ItemDecoratorFactory int orientation) { DividerItemDecoration decoration = new HotelDividerItemDecoration(context, orientation); - decoration.setDrawable(ContextCompat.getDrawable(context, R.drawable.divider_transparent_quarter)); + @DrawableRes + int dividerId = R.drawable.divider_transparent_quarter; + decoration.setDrawable(Objects.requireNonNull(ContextCompat.getDrawable(context, dividerId))); return decoration; } @@ -25,7 +29,19 @@ public class ItemDecoratorFactory int orientation) { DividerItemDecoration decoration = new SponsoredDividerItemDecoration(context, orientation); - decoration.setDrawable(ContextCompat.getDrawable(context, R.drawable.divider_transparent_half)); + @DrawableRes + int dividerId = R.drawable.divider_transparent_half; + decoration.setDrawable(Objects.requireNonNull(ContextCompat.getDrawable(context, dividerId))); + return decoration; + } + + public static RecyclerView.ItemDecoration createPlacePagePromoGalleryDecorator(@NonNull Context context, + int orientation) + { + DividerItemDecoration decoration = new SponsoredDividerItemDecoration(context, orientation); + @DrawableRes + int dividerId = R.drawable.divider_transparent_quarter; + decoration.setDrawable(Objects.requireNonNull(ContextCompat.getDrawable(context, dividerId))); return decoration; } @@ -35,7 +51,7 @@ public class ItemDecoratorFactory @DrawableRes int dividerResId) { DividerItemDecoration decoration = new DividerItemDecoration(context, orientation); - decoration.setDrawable(ContextCompat.getDrawable(context, dividerResId)); + decoration.setDrawable(Objects.requireNonNull(ContextCompat.getDrawable(context, dividerResId))); return decoration; }