Skip to content

Commit

Permalink
[android] Added guides gallery skeleton place page controller
Browse files Browse the repository at this point in the history
  • Loading branch information
alexzatsepin authored and devnullorthrow committed Apr 24, 2020
1 parent eadfe70 commit 3ffec15
Show file tree
Hide file tree
Showing 5 changed files with 107 additions and 3 deletions.
1 change: 1 addition & 0 deletions android/res/layout/activity_map.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
14 changes: 14 additions & 0 deletions android/res/layout/guides_gallery_bottom_sheet.xml
Original file line number Diff line number Diff line change
@@ -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>
Original file line number Diff line number Diff line change
@@ -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()
{

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,8 @@ public void initialize(@Nullable Activity activity)
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);

Expand All @@ -123,6 +123,11 @@ public void initialize(@Nullable Activity activity)
elevationProfileController.initialize(activity);
mControllers.add(elevationProfileController);

PlacePageController guidesGalleryController =
PlacePageFactory.createGuidesGalleryController(mSlideListener);
guidesGalleryController.initialize(activity);
mControllers.add(guidesGalleryController);

mActiveController = richController;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public static PlacePageController createCompositePlacePageController(
}

@NonNull
static PlacePageController createRichPlacePageController(
static PlacePageController createRichController(
@NonNull AdsRemovalPurchaseControllerProvider provider,
@NonNull PlacePageController.SlideListener listener,
@Nullable RoutingModeListener routingModeListener)
Expand All @@ -32,4 +32,13 @@ static PlacePageController createElevationProfilePlacePageController(
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);
}
}

0 comments on commit 3ffec15

Please sign in to comment.