[android] Added guides gallery skeleton place page controller

This commit is contained in:
Александр Зацепин 2020-04-24 18:39:40 +03:00 committed by yoksnod
parent eadfe70581
commit 3ffec15df8
5 changed files with 107 additions and 3 deletions

View file

@ -98,6 +98,7 @@
</FrameLayout>
<include layout="@layout/elevation_profile_bottom_sheet" />
<include layout="@layout/main_menu_bottom_sheet" />
<include layout="@layout/guides_gallery_bottom_sheet" />
<com.google.android.material.appbar.AppBarLayout
android:id="@+id/app_bar"
app:layout_behavior="@string/placepage_toolbar_behavior"

View file

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/guides_gallery_bottom_sheet"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/red_cross_background"
app:behavior_defaultState="hidden"
app:behavior_hideable="true"
app:behavior_skipAnchored="true"
app:layout_behavior="@string/placepage_behavior">
</LinearLayout>

View file

@ -0,0 +1,75 @@
package com.mapswithme.maps.widget.placepage;
import android.os.Bundle;
import android.view.View;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.mapswithme.maps.guides.GuidesGallery;
public class GuidesGalleryViewRenderer implements PlacePageViewRenderer<PlacePageData>,
PlacePageStateObserver
{
@Nullable
private GuidesGallery mGallery;
@Override
public void render(@NonNull PlacePageData data)
{
mGallery = (GuidesGallery) data;
}
@Override
public void onHide()
{
}
@Override
public void initialize(@Nullable View view)
{
}
@Override
public void destroy()
{
}
@Override
public void onSave(@NonNull Bundle outState)
{
}
@Override
public void onRestore(@NonNull Bundle inState)
{
}
@Override
public boolean support(@NonNull PlacePageData data)
{
return data instanceof GuidesGallery;
}
@Override
public void onPlacePageDetails()
{
}
@Override
public void onPlacePagePreview()
{
}
@Override
public void onPlacePageClosed()
{
}
}

View file

@ -113,8 +113,8 @@ class PlacePageControllerComposite implements PlacePageController
throw new AssertionError("Place page controllers already initialized!");
PlacePageController richController =
PlacePageFactory.createRichPlacePageController(mAdsProvider, mSlideListener,
mRoutingModeListener);
PlacePageFactory.createRichController(mAdsProvider, mSlideListener,
mRoutingModeListener);
richController.initialize(activity);
mControllers.add(richController);
@ -123,6 +123,11 @@ class PlacePageControllerComposite implements PlacePageController
elevationProfileController.initialize(activity);
mControllers.add(elevationProfileController);
PlacePageController guidesGalleryController =
PlacePageFactory.createGuidesGalleryController(mSlideListener);
guidesGalleryController.initialize(activity);
mControllers.add(guidesGalleryController);
mActiveController = richController;
}

View file

@ -17,7 +17,7 @@ public class PlacePageFactory
}
@NonNull
static PlacePageController createRichPlacePageController(
static PlacePageController createRichController(
@NonNull AdsRemovalPurchaseControllerProvider provider,
@NonNull PlacePageController.SlideListener listener,
@Nullable RoutingModeListener routingModeListener)
@ -32,4 +32,13 @@ public class PlacePageFactory
ElevationProfileViewRenderer renderer = new ElevationProfileViewRenderer();
return new SimplePlacePageController(R.id.elevation_profile, renderer, renderer, listener);
}
@NonNull
static PlacePageController createGuidesGalleryController(
@NonNull PlacePageController.SlideListener listener)
{
GuidesGalleryViewRenderer renderer = new GuidesGalleryViewRenderer();
return new SimplePlacePageController(R.id.guides_gallery_bottom_sheet, renderer, renderer,
listener);
}
}