diff --git a/android/src/com/mapswithme/maps/MwmActivity.java b/android/src/com/mapswithme/maps/MwmActivity.java index 02d4793b23..3f844a6076 100644 --- a/android/src/com/mapswithme/maps/MwmActivity.java +++ b/android/src/com/mapswithme/maps/MwmActivity.java @@ -62,6 +62,7 @@ import com.mapswithme.maps.editor.EditorHostFragment; import com.mapswithme.maps.editor.FeatureCategoryActivity; import com.mapswithme.maps.editor.ReportFragment; import com.mapswithme.maps.gallery.Items; +import com.mapswithme.maps.guides.GuidesGalleryListener; import com.mapswithme.maps.intent.Factory; import com.mapswithme.maps.intent.MapTask; import com.mapswithme.maps.location.CompassData; @@ -184,7 +185,8 @@ public class MwmActivity extends BaseMwmFragmentActivity MaterialTapTargetPrompt.PromptStateChangeListener, WelcomeDialogFragment.OnboardingStepPassedListener, OnIsolinesLayerToggleListener, - OnGuidesLayerToggleListener + OnGuidesLayerToggleListener, + GuidesGalleryListener { private static final Logger LOGGER = LoggerFactory.INSTANCE.getLogger(LoggerFactory.Type.MISC); private static final String TAG = MwmActivity.class.getSimpleName(); @@ -534,7 +536,8 @@ public class MwmActivity extends BaseMwmFragmentActivity setContentView(R.layout.activity_map); - mPlacePageController = PlacePageFactory.createCompositePlacePageController(this, this, this); + mPlacePageController = PlacePageFactory.createCompositePlacePageController( + this, this, this, this); mPlacePageController.initialize(this); mPlacePageController.onActivityCreated(this, savedInstanceState); @@ -2604,6 +2607,13 @@ public class MwmActivity extends BaseMwmFragmentActivity // Do nothing by default. } + @Override + public void onGalleryGuideSelected(@NonNull String url) + { + BookmarksCatalogActivity.startForResult( + this, BookmarkCategoriesActivity.REQ_CODE_DOWNLOAD_BOOKMARK_CATEGORY, url); + } + private class CurrentPositionClickListener implements OnClickListener { @Override diff --git a/android/src/com/mapswithme/maps/guides/GuidesGalleryListener.java b/android/src/com/mapswithme/maps/guides/GuidesGalleryListener.java new file mode 100644 index 0000000000..0e647929ab --- /dev/null +++ b/android/src/com/mapswithme/maps/guides/GuidesGalleryListener.java @@ -0,0 +1,8 @@ +package com.mapswithme.maps.guides; + +import androidx.annotation.NonNull; + +public interface GuidesGalleryListener +{ + void onGalleryGuideSelected(@NonNull String url); +} diff --git a/android/src/com/mapswithme/maps/widget/placepage/GuidesGalleryViewRenderer.java b/android/src/com/mapswithme/maps/widget/placepage/GuidesGalleryViewRenderer.java index 53e3f0b9bc..a3566975ae 100644 --- a/android/src/com/mapswithme/maps/widget/placepage/GuidesGalleryViewRenderer.java +++ b/android/src/com/mapswithme/maps/widget/placepage/GuidesGalleryViewRenderer.java @@ -2,8 +2,8 @@ package com.mapswithme.maps.widget.placepage; import android.content.res.Resources; import android.os.Bundle; +import android.text.TextUtils; import android.view.View; -import android.widget.Toast; import androidx.annotation.NonNull; import androidx.annotation.Nullable; @@ -19,6 +19,7 @@ import com.mapswithme.maps.gallery.ItemSelectedListener; import com.mapswithme.maps.gallery.impl.Factory; import com.mapswithme.maps.guides.GuidesGallery; import com.mapswithme.maps.guides.GuidesGallery.Item; +import com.mapswithme.maps.guides.GuidesGalleryListener; import com.mapswithme.maps.maplayer.guides.GuidesManager; import com.mapswithme.maps.maplayer.guides.OnGuidesGalleryChangedListener; import com.mapswithme.maps.widget.recycler.ItemDecoratorFactory; @@ -54,8 +55,9 @@ public class GuidesGalleryViewRenderer implements PlacePageViewRenderer mControllers = new ArrayList<>(); @SuppressWarnings("NullableProblems") @@ -26,11 +29,13 @@ class PlacePageControllerComposite implements PlacePageController PlacePageControllerComposite(@NonNull AdsRemovalPurchaseControllerProvider adsProvider, @NonNull SlideListener slideListener, - @Nullable RoutingModeListener routingModeListener) + @Nullable RoutingModeListener routingModeListener, + @Nullable GuidesGalleryListener galleryListener) { mAdsProvider = adsProvider; mSlideListener = slideListener; mRoutingModeListener = routingModeListener; + mGuidesGalleryListener = galleryListener; } @Override @@ -124,7 +129,7 @@ class PlacePageControllerComposite implements PlacePageController mControllers.add(elevationProfileController); PlacePageController guidesGalleryController = - PlacePageFactory.createGuidesGalleryController(mSlideListener); + PlacePageFactory.createGuidesGalleryController(mSlideListener, mGuidesGalleryListener); guidesGalleryController.initialize(activity); mControllers.add(guidesGalleryController); diff --git a/android/src/com/mapswithme/maps/widget/placepage/PlacePageFactory.java b/android/src/com/mapswithme/maps/widget/placepage/PlacePageFactory.java index 0d644d6b16..e9b4f96d04 100644 --- a/android/src/com/mapswithme/maps/widget/placepage/PlacePageFactory.java +++ b/android/src/com/mapswithme/maps/widget/placepage/PlacePageFactory.java @@ -3,6 +3,7 @@ package com.mapswithme.maps.widget.placepage; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import com.mapswithme.maps.R; +import com.mapswithme.maps.guides.GuidesGalleryListener; import com.mapswithme.maps.purchase.AdsRemovalPurchaseControllerProvider; public class PlacePageFactory @@ -11,9 +12,11 @@ public class PlacePageFactory public static PlacePageController createCompositePlacePageController( @NonNull AdsRemovalPurchaseControllerProvider provider, @NonNull PlacePageController.SlideListener slideListener, - @NonNull RoutingModeListener routingModeListener) + @NonNull RoutingModeListener routingModeListener, + @Nullable GuidesGalleryListener galleryListener) { - return new PlacePageControllerComposite(provider, slideListener, routingModeListener); + return new PlacePageControllerComposite(provider, slideListener, routingModeListener, + galleryListener); } @NonNull @@ -35,9 +38,10 @@ public class PlacePageFactory @NonNull static PlacePageController createGuidesGalleryController( - @NonNull PlacePageController.SlideListener listener) + @NonNull PlacePageController.SlideListener listener, + @Nullable GuidesGalleryListener galleryListener) { - GuidesGalleryViewRenderer renderer = new GuidesGalleryViewRenderer(); + GuidesGalleryViewRenderer renderer = new GuidesGalleryViewRenderer(galleryListener); return new SimplePlacePageController(R.id.guides_gallery_bottom_sheet, renderer, renderer, listener); }