forked from organicmaps/organicmaps
[android] Fixed review notes https://github.com/mapsme/omim/pull/10679
from here https://github.com/mapsme/omim/pull/10679#discussion_r275445797
This commit is contained in:
parent
c8ab7fb203
commit
216a9961e6
2 changed files with 17 additions and 36 deletions
|
@ -1532,6 +1532,22 @@ public class PlacePageView extends NestedScrollView
|
|||
}
|
||||
}
|
||||
|
||||
@NonNull
|
||||
private static PlacePageButtons.Item toPlacePageButton(@NonNull RoadWarningMarkType type)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case DIRTY:
|
||||
return PlacePageButtons.Item.ROUTE_AVOID_UNPAVED;
|
||||
case FERRY:
|
||||
return PlacePageButtons.Item.ROUTE_AVOID_FERRY;
|
||||
case TOLL:
|
||||
return PlacePageButtons.Item.ROUTE_AVOID_TOLL;
|
||||
default:
|
||||
throw new AssertionError("Unsupported road warning type: " + type);
|
||||
}
|
||||
}
|
||||
|
||||
private void setButtons(@NonNull MapObject mapObject, boolean showBackButton, boolean showRoutingButton)
|
||||
{
|
||||
List<PlacePageButtons.PlacePageButton> buttons = new ArrayList<>();
|
||||
|
@ -1539,7 +1555,7 @@ public class PlacePageView extends NestedScrollView
|
|||
if (mapObject.getRoadWarningMarkType() != RoadWarningMarkType.UNKNOWN)
|
||||
{
|
||||
RoadWarningMarkType markType = mapObject.getRoadWarningMarkType();
|
||||
PlacePageButtons.Item roadType = RoadWarningTypeToRoadTypeMap.get(markType);
|
||||
PlacePageButtons.Item roadType = toPlacePageButton(markType);
|
||||
buttons.add(roadType);
|
||||
mButtons.setItems(buttons);
|
||||
return;
|
||||
|
|
|
@ -1,35 +0,0 @@
|
|||
package com.mapswithme.maps.widget.placepage;
|
||||
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
|
||||
import com.mapswithme.maps.bookmarks.data.RoadWarningMarkType;
|
||||
import com.mapswithme.maps.widget.placepage.PlacePageButtons;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class RoadWarningTypeToRoadTypeMap
|
||||
{
|
||||
private final static Map<RoadWarningMarkType, PlacePageButtons.Item> sMap = Collections.unmodifiableMap(createEntries());
|
||||
|
||||
@Nullable
|
||||
public static PlacePageButtons.Item get(@NonNull RoadWarningMarkType key)
|
||||
{
|
||||
return sMap.get(key);
|
||||
}
|
||||
|
||||
@NonNull
|
||||
private static Map<RoadWarningMarkType, PlacePageButtons.Item> createEntries()
|
||||
{
|
||||
return new HashMap<RoadWarningMarkType, PlacePageButtons.Item>(){
|
||||
private static final long serialVersionUID = -5608368159273229727L;
|
||||
{
|
||||
put(RoadWarningMarkType.DIRTY, PlacePageButtons.Item.ROUTE_AVOID_UNPAVED);
|
||||
put(RoadWarningMarkType.FERRY, PlacePageButtons.Item.ROUTE_AVOID_FERRY);
|
||||
put(RoadWarningMarkType.TOLL, PlacePageButtons.Item.ROUTE_AVOID_TOLL);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue