From 9994dc2104e388cf9975d0d0a5bdd97fce5ad555 Mon Sep 17 00:00:00 2001 From: Dmitry Donskoy Date: Wed, 19 Jun 2019 14:10:56 +0300 Subject: [PATCH] [android] Fixed review notes https://github.com/mapsme/omim/pull/11034#discussion_r294737135 https://github.com/mapsme/omim/pull/11034#discussion_r294745674 https://github.com/mapsme/omim/pull/11034#discussion_r294745870 https://github.com/mapsme/omim/pull/11034#discussion_r294745946 https://github.com/mapsme/omim/pull/11034#discussion_r294749045 https://github.com/mapsme/omim/pull/11034#discussion_r294751382 https://github.com/mapsme/omim/pull/11034#discussion_r294761542 https://github.com/mapsme/omim/pull/11034#discussion_r294754830 https://github.com/mapsme/omim/pull/11034#discussion_r294755861 https://github.com/mapsme/omim/pull/11034#discussion_r294757160 --- .../res/layout/catalog_promo_container.xml | 4 +- .../catalog_promo_container_wrapper.xml | 13 ++-- .../maps/discovery/DiscoveryFragment.java | 23 +++---- .../maps/discovery/DiscoveryManager.java | 2 +- .../gallery/AbstractActionButtonListener.java | 31 ---------- .../com/mapswithme/maps/gallery/Holders.java | 50 ++++++++-------- .../SimpleSingleItemAdapterStrategy.java | 8 ++- .../CatalogPromoErrorAdapterStrategy.java | 19 +----- .../CatalogPromoLoadingAdapterStrategy.java | 5 +- .../mapswithme/maps/gallery/impl/Factory.java | 5 +- .../impl}/RegularCatalogPromoListener.java | 2 +- .../impl/SimpleLoadingAdapterStrategy.java | 8 ++- .../BottomSheetPlacePageController.java | 2 +- .../placepage/CatalogPromoListener.java | 29 --------- .../placepage/ErrorCatalogPromoListener.java | 23 ++++++- .../LoadingCatalogPromoListener.java | 22 ------- .../maps/widget/placepage/PlacePageView.java | 60 ++++++++++--------- 17 files changed, 120 insertions(+), 186 deletions(-) delete mode 100644 android/src/com/mapswithme/maps/gallery/AbstractActionButtonListener.java rename android/src/com/mapswithme/maps/{widget/placepage => gallery/impl}/RegularCatalogPromoListener.java (95%) delete mode 100644 android/src/com/mapswithme/maps/widget/placepage/CatalogPromoListener.java delete mode 100644 android/src/com/mapswithme/maps/widget/placepage/LoadingCatalogPromoListener.java diff --git a/android/res/layout/catalog_promo_container.xml b/android/res/layout/catalog_promo_container.xml index 6ac97de775..d770b2ff64 100644 --- a/android/res/layout/catalog_promo_container.xml +++ b/android/res/layout/catalog_promo_container.xml @@ -12,11 +12,9 @@ android:layout_marginEnd="@dimen/margin_base" android:layout_marginBottom="@dimen/margin_half_plus" android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:visibility="gone"/> + android:layout_height="wrap_content"/> diff --git a/android/res/layout/catalog_promo_container_wrapper.xml b/android/res/layout/catalog_promo_container_wrapper.xml index a1bf9fdf02..af9fb2732d 100644 --- a/android/res/layout/catalog_promo_container_wrapper.xml +++ b/android/res/layout/catalog_promo_container_wrapper.xml @@ -1,9 +1,10 @@ - + diff --git a/android/src/com/mapswithme/maps/discovery/DiscoveryFragment.java b/android/src/com/mapswithme/maps/discovery/DiscoveryFragment.java index 667307767a..fbe2fdc2e4 100644 --- a/android/src/com/mapswithme/maps/discovery/DiscoveryFragment.java +++ b/android/src/com/mapswithme/maps/discovery/DiscoveryFragment.java @@ -26,6 +26,7 @@ import com.mapswithme.maps.bookmarks.data.MapObject; import com.mapswithme.maps.gallery.GalleryAdapter; import com.mapswithme.maps.gallery.ItemSelectedListener; 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.LoggableItemSelectedListener; import com.mapswithme.maps.metrics.UserActionsLogger; @@ -34,9 +35,8 @@ import com.mapswithme.maps.promo.PromoEntity; import com.mapswithme.maps.search.SearchResult; import com.mapswithme.maps.widget.PlaceholderView; import com.mapswithme.maps.widget.ToolbarController; -import com.mapswithme.maps.widget.placepage.LoadingCatalogPromoListener; import com.mapswithme.maps.widget.placepage.PlacePageView; -import com.mapswithme.maps.widget.placepage.RegularCatalogPromoListener; +import com.mapswithme.maps.gallery.impl.RegularCatalogPromoListener; import com.mapswithme.maps.widget.recycler.ItemDecoratorFactory; import com.mapswithme.util.ConnectionState; import com.mapswithme.util.Language; @@ -128,6 +128,12 @@ public class DiscoveryFragment extends BaseMwmToolbarFragment implements Discove setLayoutManagerAndItemDecoration(getContext(), getGallery(R.id.food)); } + private void initCatalogPromoGallery() + { + RecyclerView catalogPromoRecycler = getGallery(R.id.catalog_promo_recycler); + setLayoutManagerAndItemDecoration(requireContext(), catalogPromoRecycler); + } + private void initLocalExpertsGallery() { setLayoutManagerAndItemDecoration(getContext(), getGallery(R.id.localGuides)); @@ -212,7 +218,7 @@ public class DiscoveryFragment extends BaseMwmToolbarFragment implements Discove RecyclerView localGuides = getGallery(R.id.localGuides); localGuides.setAdapter(Factory.createLocalExpertsLoadingAdapter()); RecyclerView promoRecycler = getGallery(R.id.catalog_promo_recycler); - LoadingCatalogPromoListener listener = new LoadingCatalogPromoListener<>(requireActivity()); + BaseItemSelectedListener listener = new BaseItemSelectedListener<>(requireActivity(), /* FIXME */ItemType.CAFES); promoRecycler.setAdapter(Factory.createCatalogPromoLoadingAdapter(listener)); return; } @@ -223,17 +229,6 @@ public class DiscoveryFragment extends BaseMwmToolbarFragment implements Discove R.id.localGuides); } - - private void initCatalogPromoGallery() - { - View root = getRootView(); - RecyclerView catalogPromoRecycler = root.findViewById(R.id.catalog_promo_recycler); - setLayoutManagerAndItemDecoration(requireContext(), catalogPromoRecycler); - View titleView = root.findViewById(R.id.catalog_promo_title); - UiUtils.show(titleView); - UiUtils.show(catalogPromoRecycler); - } - private void requestDiscoveryInfo() { DiscoveryParams params; diff --git a/android/src/com/mapswithme/maps/discovery/DiscoveryManager.java b/android/src/com/mapswithme/maps/discovery/DiscoveryManager.java index ee3b9ae692..0dd47b932a 100644 --- a/android/src/com/mapswithme/maps/discovery/DiscoveryManager.java +++ b/android/src/com/mapswithme/maps/discovery/DiscoveryManager.java @@ -12,7 +12,7 @@ import com.mapswithme.util.log.LoggerFactory; import java.util.EnumSet; -enum DiscoveryManager +public enum DiscoveryManager { INSTANCE; private static final Logger LOGGER = LoggerFactory.INSTANCE.getLogger(LoggerFactory.Type.MISC); diff --git a/android/src/com/mapswithme/maps/gallery/AbstractActionButtonListener.java b/android/src/com/mapswithme/maps/gallery/AbstractActionButtonListener.java deleted file mode 100644 index 63803f4105..0000000000 --- a/android/src/com/mapswithme/maps/gallery/AbstractActionButtonListener.java +++ /dev/null @@ -1,31 +0,0 @@ -package com.mapswithme.maps.gallery; - -import android.app.Activity; -import android.support.annotation.NonNull; - -public abstract class AbstractActionButtonListener implements ItemSelectedListener -{ - @NonNull - private final Activity mActivity; - - public AbstractActionButtonListener(@NonNull Activity activity) - { - mActivity = activity; - } - - @Override - public void onMoreItemSelected(@NonNull T item) - { - } - - @Override - public void onActionButtonSelected(@NonNull T item, int position) - { - } - - @NonNull - protected Activity getActivity() - { - return mActivity; - } -} diff --git a/android/src/com/mapswithme/maps/gallery/Holders.java b/android/src/com/mapswithme/maps/gallery/Holders.java index 04db7c9c3c..75cf574c06 100644 --- a/android/src/com/mapswithme/maps/gallery/Holders.java +++ b/android/src/com/mapswithme/maps/gallery/Holders.java @@ -417,35 +417,11 @@ public class Holders @Override protected void onItemSelected(@NonNull Items.Item item, int position) { - ItemSelectedListener listener = getListener(); - if (listener == null) - return; - listener.onActionButtonSelected(item, position); } } - public static class BaseEmptyCatalogHolder extends SimpleViewHolder - { - - public BaseEmptyCatalogHolder(@NonNull View itemView, @NonNull List items, - @Nullable ItemSelectedListener listener) - { - super(itemView, items, listener); - } - - @Override - protected void onItemSelected(@NonNull Items.Item item, int position) - { - ItemSelectedListener listener = getListener(); - if (listener == null) - return; - - listener.onItemSelected(item, position); - } - } - - public static class CrossPromoLoadingHolder extends BaseEmptyCatalogHolder + public static class CrossPromoLoadingHolder extends SimpleViewHolder { public CrossPromoLoadingHolder(@NonNull View itemView, @NonNull List items, @Nullable ItemSelectedListener listener) @@ -512,4 +488,28 @@ public class Holders mProLabel.setBackgroundDrawable(shapeDrawable); } } + + public static class CatalogErrorHolder extends SimpleViewHolder + { + + public CatalogErrorHolder(@NonNull View itemView, @NonNull List items, + @Nullable ItemSelectedListener listener) + { + super(itemView, items, listener); + View progress = itemView.findViewById(R.id.progress); + UiUtils.invisible(progress); + TextView subtitle = itemView.findViewById(R.id.subtitle); + subtitle.setText(""); + } + + @Override + protected void onItemSelected(@NonNull Items.Item item, int position) + { + ItemSelectedListener listener = getListener(); + if (listener == null) + return; + + listener.onItemSelected(item, position); + } + } } diff --git a/android/src/com/mapswithme/maps/gallery/SimpleSingleItemAdapterStrategy.java b/android/src/com/mapswithme/maps/gallery/SimpleSingleItemAdapterStrategy.java index 0504c96b4e..22da1f3173 100644 --- a/android/src/com/mapswithme/maps/gallery/SimpleSingleItemAdapterStrategy.java +++ b/android/src/com/mapswithme/maps/gallery/SimpleSingleItemAdapterStrategy.java @@ -12,9 +12,15 @@ import com.mapswithme.maps.MwmApplication; public abstract class SimpleSingleItemAdapterStrategy> extends SingleItemAdapterStrategy { + protected SimpleSingleItemAdapterStrategy(@Nullable ItemSelectedListener listener, + @Nullable String url) + { + super(url, listener); + } + protected SimpleSingleItemAdapterStrategy(@Nullable ItemSelectedListener listener) { - super(null, listener); + this(listener, null); } @Override diff --git a/android/src/com/mapswithme/maps/gallery/impl/CatalogPromoErrorAdapterStrategy.java b/android/src/com/mapswithme/maps/gallery/impl/CatalogPromoErrorAdapterStrategy.java index 567694e41d..c4fc9bead9 100644 --- a/android/src/com/mapswithme/maps/gallery/impl/CatalogPromoErrorAdapterStrategy.java +++ b/android/src/com/mapswithme/maps/gallery/impl/CatalogPromoErrorAdapterStrategy.java @@ -5,15 +5,12 @@ import android.support.annotation.Nullable; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; -import android.widget.TextView; import com.mapswithme.maps.R; import com.mapswithme.maps.gallery.Holders; import com.mapswithme.maps.gallery.ItemSelectedListener; import com.mapswithme.maps.gallery.Items; -import java.util.List; - class CatalogPromoErrorAdapterStrategy extends SimpleErrorAdapterStrategy { CatalogPromoErrorAdapterStrategy(@Nullable ItemSelectedListener listener) @@ -31,20 +28,6 @@ class CatalogPromoErrorAdapterStrategy extends SimpleErrorAdapterStrategy @Override protected Holders.SimpleViewHolder createViewHolder(@NonNull View itemView) { - return new ErrorHolder(itemView, mItems, getListener()); - } - - private class ErrorHolder extends Holders.BaseEmptyCatalogHolder - { - - public ErrorHolder(@NonNull View itemView, @NonNull List items, - @Nullable ItemSelectedListener listener) - { - super(itemView, items, listener); - View progress = itemView.findViewById(R.id.progress); - progress.setVisibility(View.INVISIBLE); - TextView subtitle = itemView.findViewById(R.id.subtitle); - subtitle.setText(""); - } + return new Holders.CatalogErrorHolder(itemView, mItems, getListener()); } } diff --git a/android/src/com/mapswithme/maps/gallery/impl/CatalogPromoLoadingAdapterStrategy.java b/android/src/com/mapswithme/maps/gallery/impl/CatalogPromoLoadingAdapterStrategy.java index 1dacbfc64c..f8159c6990 100644 --- a/android/src/com/mapswithme/maps/gallery/impl/CatalogPromoLoadingAdapterStrategy.java +++ b/android/src/com/mapswithme/maps/gallery/impl/CatalogPromoLoadingAdapterStrategy.java @@ -13,9 +13,10 @@ import com.mapswithme.maps.gallery.Items; class CatalogPromoLoadingAdapterStrategy extends SimpleLoadingAdapterStrategy { - CatalogPromoLoadingAdapterStrategy(@Nullable ItemSelectedListener listener) + CatalogPromoLoadingAdapterStrategy(@Nullable ItemSelectedListener listener, + @NonNull String url) { - super(listener); + super(listener, url); } @NonNull diff --git a/android/src/com/mapswithme/maps/gallery/impl/Factory.java b/android/src/com/mapswithme/maps/gallery/impl/Factory.java index eda1286bbf..9ef3f321ba 100644 --- a/android/src/com/mapswithme/maps/gallery/impl/Factory.java +++ b/android/src/com/mapswithme/maps/gallery/impl/Factory.java @@ -5,6 +5,7 @@ import android.support.annotation.NonNull; import android.support.annotation.Nullable; import com.mapswithme.maps.R; +import com.mapswithme.maps.discovery.DiscoveryManager; import com.mapswithme.maps.discovery.LocalExpert; import com.mapswithme.maps.gallery.Constants; import com.mapswithme.maps.gallery.GalleryAdapter; @@ -103,7 +104,9 @@ public class Factory @NonNull public static GalleryAdapter createCatalogPromoLoadingAdapter(@NonNull ItemSelectedListener listener) { - return new GalleryAdapter<>(new CatalogPromoLoadingAdapterStrategy(listener)); + CatalogPromoLoadingAdapterStrategy strategy = + new CatalogPromoLoadingAdapterStrategy(listener, DiscoveryManager.nativeGetLocalExpertsUrl()); + return new GalleryAdapter<>(strategy); } @NonNull diff --git a/android/src/com/mapswithme/maps/widget/placepage/RegularCatalogPromoListener.java b/android/src/com/mapswithme/maps/gallery/impl/RegularCatalogPromoListener.java similarity index 95% rename from android/src/com/mapswithme/maps/widget/placepage/RegularCatalogPromoListener.java rename to android/src/com/mapswithme/maps/gallery/impl/RegularCatalogPromoListener.java index 676ddf8643..627df70b4c 100644 --- a/android/src/com/mapswithme/maps/widget/placepage/RegularCatalogPromoListener.java +++ b/android/src/com/mapswithme/maps/gallery/impl/RegularCatalogPromoListener.java @@ -1,4 +1,4 @@ -package com.mapswithme.maps.widget.placepage; +package com.mapswithme.maps.gallery.impl; import android.app.Activity; import android.support.annotation.NonNull; diff --git a/android/src/com/mapswithme/maps/gallery/impl/SimpleLoadingAdapterStrategy.java b/android/src/com/mapswithme/maps/gallery/impl/SimpleLoadingAdapterStrategy.java index d30a88581f..bc7e0b5b93 100644 --- a/android/src/com/mapswithme/maps/gallery/impl/SimpleLoadingAdapterStrategy.java +++ b/android/src/com/mapswithme/maps/gallery/impl/SimpleLoadingAdapterStrategy.java @@ -17,7 +17,13 @@ public class SimpleLoadingAdapterStrategy { SimpleLoadingAdapterStrategy(@Nullable ItemSelectedListener listener) { - super(listener); + this(listener, null); + } + + public SimpleLoadingAdapterStrategy(@Nullable ItemSelectedListener listener, + @Nullable String url) + { + super(listener, url); } @Override diff --git a/android/src/com/mapswithme/maps/widget/placepage/BottomSheetPlacePageController.java b/android/src/com/mapswithme/maps/widget/placepage/BottomSheetPlacePageController.java index 13b1413d87..250bc60ab2 100644 --- a/android/src/com/mapswithme/maps/widget/placepage/BottomSheetPlacePageController.java +++ b/android/src/com/mapswithme/maps/widget/placepage/BottomSheetPlacePageController.java @@ -560,7 +560,7 @@ public class BottomSheetPlacePageController implements PlacePageController, Loca public void onActivityStarted(Activity activity) { mBannerController.attach(); - mPlacePage.attach(null); + mPlacePage.attach(activity); } @Override diff --git a/android/src/com/mapswithme/maps/widget/placepage/CatalogPromoListener.java b/android/src/com/mapswithme/maps/widget/placepage/CatalogPromoListener.java deleted file mode 100644 index 204f119560..0000000000 --- a/android/src/com/mapswithme/maps/widget/placepage/CatalogPromoListener.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.mapswithme.maps.widget.placepage; - -import android.support.annotation.NonNull; - -import com.mapswithme.maps.promo.Promo; -import com.mapswithme.maps.promo.PromoCityGallery; - -class CatalogPromoListener implements Promo.Listener -{ - @NonNull - private final PlacePageView mPlacePage; - - CatalogPromoListener(@NonNull PlacePageView placePage) - { - mPlacePage = placePage; - } - - @Override - public void onCityGalleryReceived(@NonNull PromoCityGallery gallery) - { - mPlacePage.setCatalogPromoGallery(gallery); - } - - @Override - public void onErrorReceived() - { - mPlacePage.setCatalogPromoGalleryError(); - } -} diff --git a/android/src/com/mapswithme/maps/widget/placepage/ErrorCatalogPromoListener.java b/android/src/com/mapswithme/maps/widget/placepage/ErrorCatalogPromoListener.java index 96547f2d3a..c2d6535faa 100644 --- a/android/src/com/mapswithme/maps/widget/placepage/ErrorCatalogPromoListener.java +++ b/android/src/com/mapswithme/maps/widget/placepage/ErrorCatalogPromoListener.java @@ -3,16 +3,27 @@ package com.mapswithme.maps.widget.placepage; import android.app.Activity; import android.support.annotation.NonNull; -import com.mapswithme.maps.gallery.AbstractActionButtonListener; import com.mapswithme.maps.gallery.Items; import com.mapswithme.util.Utils; -public class ErrorCatalogPromoListener extends AbstractActionButtonListener +public class ErrorCatalogPromoListener implements com.mapswithme.maps.gallery.ItemSelectedListener { + @NonNull + private final Activity mActivity; public ErrorCatalogPromoListener(@NonNull Activity activity) { - super(activity); + mActivity = activity; + } + + @Override + public void onMoreItemSelected(@NonNull T item) + { + } + + @Override + public void onActionButtonSelected(@NonNull T item, int position) + { } @Override @@ -20,4 +31,10 @@ public class ErrorCatalogPromoListener extends AbstractAct { Utils.showSystemSettings(getActivity()); } + + @NonNull + protected Activity getActivity() + { + return mActivity; + } } diff --git a/android/src/com/mapswithme/maps/widget/placepage/LoadingCatalogPromoListener.java b/android/src/com/mapswithme/maps/widget/placepage/LoadingCatalogPromoListener.java deleted file mode 100644 index cb27b147b4..0000000000 --- a/android/src/com/mapswithme/maps/widget/placepage/LoadingCatalogPromoListener.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.mapswithme.maps.widget.placepage; - -import android.app.Activity; -import android.support.annotation.NonNull; - -import com.mapswithme.maps.gallery.AbstractActionButtonListener; -import com.mapswithme.maps.gallery.Items; -import com.mapswithme.util.Utils; - -public class LoadingCatalogPromoListener extends AbstractActionButtonListener -{ - public LoadingCatalogPromoListener(@NonNull Activity activity) - { - super(activity); - } - - @Override - public void onItemSelected(@NonNull T item, int position) - { - Utils.openUrl(getActivity(), item.getUrl()); - } -} diff --git a/android/src/com/mapswithme/maps/widget/placepage/PlacePageView.java b/android/src/com/mapswithme/maps/widget/placepage/PlacePageView.java index 6718fe7609..fed9dd7e51 100644 --- a/android/src/com/mapswithme/maps/widget/placepage/PlacePageView.java +++ b/android/src/com/mapswithme/maps/widget/placepage/PlacePageView.java @@ -1,5 +1,6 @@ package com.mapswithme.maps.widget.placepage; +import android.app.Activity; import android.content.ActivityNotFoundException; import android.content.Context; import android.content.Intent; @@ -54,6 +55,7 @@ import com.mapswithme.maps.bookmarks.data.DistanceAndAzimut; import com.mapswithme.maps.bookmarks.data.MapObject; import com.mapswithme.maps.bookmarks.data.Metadata; import com.mapswithme.maps.bookmarks.data.RoadWarningMarkType; +import com.mapswithme.maps.discovery.ItemType; import com.mapswithme.maps.downloader.CountryItem; import com.mapswithme.maps.downloader.DownloaderStatusIcon; import com.mapswithme.maps.downloader.MapManager; @@ -65,7 +67,9 @@ 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; import com.mapswithme.maps.promo.Promo; import com.mapswithme.maps.promo.PromoCityGallery; @@ -125,7 +129,9 @@ public class PlacePageView extends NestedScrollView LineCountTextView.OnLineCountCalculatedListener, RecyclerClickListener, NearbyAdapter.OnItemClickListener, - EditBookmarkFragment.EditBookmarkListener, Detachable + EditBookmarkFragment.EditBookmarkListener, + Detachable, + Promo.Listener { private static final Logger LOGGER = LoggerFactory.INSTANCE.getLogger(LoggerFactory.Type.MISC); private static final String TAG = PlacePageView.class.getSimpleName(); @@ -361,9 +367,9 @@ public class PlacePageView extends NestedScrollView } @Override - public void attach(@NonNull Void object) + public void attach(@NonNull Activity object) { - Promo.INSTANCE.setListener(new CatalogPromoListener(this)); + Promo.INSTANCE.setListener(this); } @Override @@ -372,6 +378,28 @@ public class PlacePageView extends NestedScrollView Promo.INSTANCE.setListener(null); } + @Override + public void onCityGalleryReceived(@NonNull PromoCityGallery gallery) + { + String url = gallery.getMoreUrl(); + List items = toEntities(gallery); + RegularCatalogPromoListener promoListener = new RegularCatalogPromoListener(getActivity()); + com.mapswithme.maps.gallery.GalleryAdapter adapter = Factory.createCatalogPromoAdapter(getContext(), + items, + url, + promoListener, + GalleryPlacement.PLACEPAGE); + mCatalogPromoRecycler.setAdapter(adapter); + } + + @Override + public void onErrorReceived() + { + ErrorCatalogPromoListener listener = new ErrorCatalogPromoListener<>(getActivity()); + com.mapswithme.maps.gallery.GalleryAdapter adapter = Factory.createCatalogPromoErrorAdapter(listener); + mCatalogPromoRecycler.setAdapter(adapter); + } + public interface SetMapObjectListener { void onSetMapObjectComplete(@NonNull NetworkPolicy policy, boolean isSameObject); @@ -840,11 +868,9 @@ public class PlacePageView extends NestedScrollView private void initCatalogPromoView() { mCatalogPromoRecycler = findViewById(R.id.catalog_promo_recycler); - mCatalogPromoRecycler.setVisibility(VISIBLE); mCatalogPromoTitleView = findViewById(R.id.catalog_promo_title); - mCatalogPromoTitleView.setVisibility(VISIBLE); - LoadingCatalogPromoListener listener = - new LoadingCatalogPromoListener<>(getActivity()); + BaseItemSelectedListener listener = + new BaseItemSelectedListener<>(getActivity(), /* FIXME */ ItemType.CAFES); com.mapswithme.maps.gallery.GalleryAdapter adapter = Factory.createCatalogPromoLoadingAdapter(listener); mCatalogPromoRecycler.setNestedScrollingEnabled(false); @@ -2105,19 +2131,6 @@ public class PlacePageView extends NestedScrollView UiUtils.showIf(enabled, mCatalogPromoTitleView); } - public void setCatalogPromoGallery(@NonNull PromoCityGallery gallery) - { - String url = gallery.getMoreUrl(); - List items = toEntities(gallery); - RegularCatalogPromoListener promoListener = new RegularCatalogPromoListener(getActivity()); - com.mapswithme.maps.gallery.GalleryAdapter adapter = Factory.createCatalogPromoAdapter(getContext(), - items, - url, - promoListener, - GalleryPlacement.PLACEPAGE); - mCatalogPromoRecycler.setAdapter(adapter); - } - @NonNull public static List toEntities(@NonNull PromoCityGallery gallery) { @@ -2135,13 +2148,6 @@ public class PlacePageView extends NestedScrollView return items; } - public void setCatalogPromoGalleryError() - { - ErrorCatalogPromoListener listener = new ErrorCatalogPromoListener<>(getActivity()); - com.mapswithme.maps.gallery.GalleryAdapter adapter = Factory.createCatalogPromoErrorAdapter(listener); - mCatalogPromoRecycler.setAdapter(adapter); - } - private class EditBookmarkClickListener implements OnClickListener { @Override