diff --git a/OsmAnd/src/net/osmand/plus/OsmAndFormatter.java b/OsmAnd/src/net/osmand/plus/OsmAndFormatter.java index 1d5e38a458..d4b0d83cab 100644 --- a/OsmAnd/src/net/osmand/plus/OsmAndFormatter.java +++ b/OsmAnd/src/net/osmand/plus/OsmAndFormatter.java @@ -1,13 +1,11 @@ package net.osmand.plus; -import static net.osmand.data.PointDescription.getLocationOlcName; - import android.content.Context; import android.text.format.DateUtils; import com.jwetherell.openmap.common.LatLonPoint; import com.jwetherell.openmap.common.UTMPoint; -import java.text.DecimalFormatSymbols; + import net.osmand.LocationConvert; import net.osmand.data.Amenity; import net.osmand.data.City.CityType; @@ -22,12 +20,17 @@ import net.osmand.util.Algorithms; import java.text.DateFormatSymbols; import java.text.DecimalFormat; +import java.text.DecimalFormatSymbols; import java.text.MessageFormat; import java.text.SimpleDateFormat; import java.util.Calendar; +import java.util.LinkedHashMap; import java.util.Locale; +import java.util.Map; import java.util.Map.Entry; +import static net.osmand.data.PointDescription.getLocationOlcName; + public class OsmAndFormatter { public final static float METERS_IN_KILOMETER = 1000f; public final static float METERS_IN_ONE_MILE = 1609.344f; // 1609.344 @@ -222,11 +225,14 @@ public class OsmAndFormatter { } public static String getFormattedDistance(float meters, OsmandApplication ctx, boolean forceTrailingZeros) { + MetricsConstants mc = ctx.getSettings().METRIC_SYSTEM.get(); + return getFormattedDistance(meters, ctx, forceTrailingZeros, mc); + } + + public static String getFormattedDistance(float meters, OsmandApplication ctx, boolean forceTrailingZeros, MetricsConstants mc) { String format1 = forceTrailingZeros ? "{0,number,0.0} " : "{0,number,0.#} "; String format2 = forceTrailingZeros ? "{0,number,0.00} " : "{0,number,0.##} "; - OsmandSettings settings = ctx.getSettings(); - MetricsConstants mc = settings.METRIC_SYSTEM.get(); int mainUnitStr; float mainUnitInMeters; if (mc == MetricsConstants.KILOMETERS_AND_METERS) { @@ -268,6 +274,24 @@ public class OsmAndFormatter { } } + public static Map getDistanceData(OsmandApplication app, float meters) { + Map results = new LinkedHashMap<>(); + + String kilometersAndMeters = getFormattedDistance(meters, app, true, MetricsConstants.KILOMETERS_AND_METERS); + String milesAndFeet = getFormattedDistance(meters, app, true, MetricsConstants.MILES_AND_FEET); + String milesAndMeters = getFormattedDistance(meters, app, true, MetricsConstants.MILES_AND_METERS); + String milesAndYards = getFormattedDistance(meters, app, true, MetricsConstants.MILES_AND_YARDS); + String nauticalMiles = getFormattedDistance(meters, app, true, MetricsConstants.NAUTICAL_MILES); + + results.put(MetricsConstants.KILOMETERS_AND_METERS, kilometersAndMeters); + results.put(MetricsConstants.MILES_AND_FEET, milesAndFeet); + results.put(MetricsConstants.MILES_AND_METERS, milesAndMeters); + results.put(MetricsConstants.MILES_AND_YARDS, milesAndYards); + results.put(MetricsConstants.NAUTICAL_MILES, nauticalMiles); + + return results; + } + public static String getFormattedAlt(double alt, OsmandApplication ctx) { OsmandSettings settings = ctx.getSettings(); MetricsConstants mc = settings.METRIC_SYSTEM.get(); diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/CollapsableView.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/CollapsableView.java new file mode 100644 index 0000000000..19c0d0983f --- /dev/null +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/CollapsableView.java @@ -0,0 +1,65 @@ +package net.osmand.plus.mapcontextmenu; + +import android.view.View; + +import androidx.annotation.NonNull; + +import net.osmand.plus.OsmandSettings.OsmandPreference; +import net.osmand.plus.mapcontextmenu.MenuBuilder.CollapseExpandListener; + +public class CollapsableView { + + private View contentView; + private MenuBuilder menuBuilder; + + private OsmandPreference collapsedPref; + private CollapseExpandListener collapseExpandListener; + private boolean collapsed; + + public CollapsableView(@NonNull View contentView, MenuBuilder menuBuilder, + @NonNull OsmandPreference collapsedPref) { + this.contentView = contentView; + this.menuBuilder = menuBuilder; + this.collapsedPref = collapsedPref; + } + + public CollapsableView(@NonNull View contentView, MenuBuilder menuBuilder, boolean collapsed) { + this.contentView = contentView; + this.collapsed = collapsed; + this.menuBuilder = menuBuilder; + } + + public View getContentView() { + return contentView; + } + + public boolean isCollapsed() { + if (collapsedPref != null) { + return collapsedPref.get(); + } else { + return collapsed; + } + } + + public void setCollapsed(boolean collapsed) { + if (collapsedPref != null) { + collapsedPref.set(collapsed); + } else { + this.collapsed = collapsed; + } + if (collapseExpandListener != null) { + collapseExpandListener.onCollapseExpand(collapsed); + } + if (menuBuilder != null && menuBuilder.getCollapseExpandListener() != null) { + menuBuilder.getCollapseExpandListener().onCollapseExpand(collapsed); + } + } + + public CollapseExpandListener getCollapseExpandListener() { + return collapseExpandListener; + } + + public void setCollapseExpandListener(MenuBuilder.CollapseExpandListener collapseExpandListener) { + this.collapseExpandListener = collapseExpandListener; + } +} \ No newline at end of file diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/MenuBuilder.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/MenuBuilder.java index aa2d5de59b..2263c43838 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/MenuBuilder.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/MenuBuilder.java @@ -44,7 +44,7 @@ import net.osmand.osm.PoiCategory; import net.osmand.plus.OsmAndFormatter; import net.osmand.plus.OsmandApplication; import net.osmand.plus.OsmandPlugin; -import net.osmand.plus.OsmandSettings.OsmandPreference; +import net.osmand.plus.OsmandSettings; import net.osmand.plus.R; import net.osmand.plus.UiUtilities; import net.osmand.plus.activities.MapActivity; @@ -108,118 +108,6 @@ public class MenuBuilder { void onCollapseExpand(boolean collapsed); } - public class PlainMenuItem { - private int iconId; - private String buttonText; - private String text; - private boolean needLinks; - private boolean url; - private boolean collapsable; - private CollapsableView collapsableView; - private OnClickListener onClickListener; - - public PlainMenuItem(int iconId, String buttonText, String text, boolean needLinks, boolean url, - boolean collapsable, CollapsableView collapsableView, - OnClickListener onClickListener) { - this.iconId = iconId; - this.buttonText = buttonText; - this.text = text; - this.needLinks = needLinks; - this.url = url; - this.collapsable = collapsable; - this.collapsableView = collapsableView; - this.onClickListener = onClickListener; - } - - public int getIconId() { - return iconId; - } - - public String getButtonText() { - return buttonText; - } - - public String getText() { - return text; - } - - public boolean isNeedLinks() { - return needLinks; - } - - public boolean isUrl() { - return url; - } - - public boolean isCollapsable() { - return collapsable; - } - - public CollapsableView getCollapsableView() { - return collapsableView; - } - - public OnClickListener getOnClickListener() { - return onClickListener; - } - } - - public static class CollapsableView { - - private View contenView; - private MenuBuilder menuBuilder; - private OsmandPreference collapsedPref; - private boolean collapsed; - private CollapseExpandListener collapseExpandListener; - - public CollapsableView(@NonNull View contenView, MenuBuilder menuBuilder, - @NonNull OsmandPreference collapsedPref) { - this.contenView = contenView; - this.menuBuilder = menuBuilder; - this.collapsedPref = collapsedPref; - } - - public CollapsableView(@NonNull View contenView, MenuBuilder menuBuilder, boolean collapsed) { - this.contenView = contenView; - this.collapsed = collapsed; - this.menuBuilder = menuBuilder; - } - - public View getContenView() { - return contenView; - } - - public boolean isCollapsed() { - if (collapsedPref != null) { - return collapsedPref.get(); - } else { - return collapsed; - } - } - - public void setCollapsed(boolean collapsed) { - if (collapsedPref != null) { - collapsedPref.set(collapsed); - } else { - this.collapsed = collapsed; - } - if (collapseExpandListener != null) { - collapseExpandListener.onCollapseExpand(collapsed); - } - if (menuBuilder != null && menuBuilder.collapseExpandListener != null) { - menuBuilder.collapseExpandListener.onCollapseExpand(collapsed); - } - } - - public CollapseExpandListener getCollapseExpandListener() { - return collapseExpandListener; - } - - public void setCollapseExpandListener(CollapseExpandListener collapseExpandListener) { - this.collapseExpandListener = collapseExpandListener; - } - } - public MenuBuilder(@NonNull MapActivity mapActivity) { this.mapActivity = mapActivity; this.app = mapActivity.getMyApplication(); @@ -233,6 +121,10 @@ public class MenuBuilder { transliterateNames = app.getSettings().MAP_TRANSLITERATE_NAMES.get(); } + public CollapseExpandListener getCollapseExpandListener() { + return collapseExpandListener; + } + public void setCollapseExpandListener(CollapseExpandListener collapseExpandListener) { this.collapseExpandListener = collapseExpandListener; } @@ -354,7 +246,7 @@ public class MenuBuilder { protected void buildPlainMenuItems(View view) { for (PlainMenuItem item : plainMenuItems) { - buildRow(view, item.getIconId(), item.getButtonText(), item.getText(), 0, item.collapsable, item.collapsableView, + buildRow(view, item.getIconId(), item.getButtonText(), item.getText(), 0, item.isCollapsable(), item.getCollapsableView(), item.isNeedLinks(), 0, item.isUrl(), item.getOnClickListener(), false); } } @@ -667,31 +559,31 @@ public class MenuBuilder { llIconCollapseParams.gravity = Gravity.CENTER_VERTICAL; iconViewCollapse.setLayoutParams(llIconCollapseParams); iconViewCollapse.setScaleType(ImageView.ScaleType.CENTER_INSIDE); - iconViewCollapse.setImageDrawable(getCollapseIcon(collapsableView.getContenView().getVisibility() == View.GONE)); + iconViewCollapse.setImageDrawable(getCollapseIcon(collapsableView.getContentView().getVisibility() == View.GONE)); llIconCollapse.addView(iconViewCollapse); ll.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { - if (collapsableView.getContenView().getVisibility() == View.VISIBLE) { - collapsableView.getContenView().setVisibility(View.GONE); + if (collapsableView.getContentView().getVisibility() == View.VISIBLE) { + collapsableView.getContentView().setVisibility(View.GONE); iconViewCollapse.setImageDrawable(getCollapseIcon(true)); collapsableView.setCollapsed(true); } else { - collapsableView.getContenView().setVisibility(View.VISIBLE); + collapsableView.getContentView().setVisibility(View.VISIBLE); iconViewCollapse.setImageDrawable(getCollapseIcon(false)); collapsableView.setCollapsed(false); } } }); if (collapsableView.isCollapsed()) { - collapsableView.getContenView().setVisibility(View.GONE); + collapsableView.getContentView().setVisibility(View.GONE); iconViewCollapse.setImageDrawable(getCollapseIcon(true)); } - if (collapsableView.getContenView().getParent() != null) { - ((ViewGroup) collapsableView.getContenView().getParent()) - .removeView(collapsableView.getContenView()); + if (collapsableView.getContentView().getParent() != null) { + ((ViewGroup) collapsableView.getContentView().getParent()) + .removeView(collapsableView.getContentView()); } - baseView.addView(collapsableView.getContenView()); + baseView.addView(collapsableView.getContentView()); } if (onClickListener != null) { @@ -805,6 +697,22 @@ public class MenuBuilder { } + protected CollapsableView getDistanceCollapsableView(Map distanceData) { + LinearLayout llv = buildCollapsableContentView(mapActivity, true, true); + for (final Map.Entry line : distanceData.entrySet()) { + TextView button = buildButtonInCollapsableView(mapActivity, false, false); + button.setText(line.getValue()); + button.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + copyToClipboard(line.getValue(), mapActivity); + } + }); + llv.addView(button); + } + return new CollapsableView(llv, this, true); + } + protected void buildButtonRow(final View view, Drawable buttonIcon, String text, OnClickListener onClickListener) { LinearLayout ll = new LinearLayout(view.getContext()); ll.setOrientation(LinearLayout.HORIZONTAL); @@ -1162,4 +1070,4 @@ public class MenuBuilder { public static

void execute(AsyncTask task, P... requests) { task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, requests); } -} +} \ No newline at end of file diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/MenuController.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/MenuController.java index 8f1a762e0e..5ce2472c63 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/MenuController.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/MenuController.java @@ -15,7 +15,6 @@ import androidx.annotation.DrawableRes; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.appcompat.content.res.AppCompatResources; -import androidx.core.content.ContextCompat; import net.osmand.GPXUtilities.WptPt; import net.osmand.IndexConstants; @@ -48,7 +47,6 @@ import net.osmand.plus.download.DownloadValidationManager; import net.osmand.plus.download.IndexItem; import net.osmand.plus.helpers.AvoidSpecificRoads; import net.osmand.plus.helpers.SearchHistoryHelper; -import net.osmand.plus.mapcontextmenu.MenuBuilder.CollapsableView; import net.osmand.plus.mapcontextmenu.MenuBuilder.CollapseExpandListener; import net.osmand.plus.mapcontextmenu.controllers.AMapPointMenuController; import net.osmand.plus.mapcontextmenu.controllers.AmenityMenuController; diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/PlainMenuItem.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/PlainMenuItem.java new file mode 100644 index 0000000000..383cdf6fb6 --- /dev/null +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/PlainMenuItem.java @@ -0,0 +1,60 @@ +package net.osmand.plus.mapcontextmenu; + +import android.view.View; + +public class PlainMenuItem { + + private int iconId; + private String buttonText; + private String text; + private boolean needLinks; + private boolean url; + private boolean collapsable; + private CollapsableView collapsableView; + private View.OnClickListener onClickListener; + + public PlainMenuItem(int iconId, String buttonText, String text, boolean needLinks, boolean url, + boolean collapsable, CollapsableView collapsableView, + View.OnClickListener onClickListener) { + this.iconId = iconId; + this.buttonText = buttonText; + this.text = text; + this.needLinks = needLinks; + this.url = url; + this.collapsable = collapsable; + this.collapsableView = collapsableView; + this.onClickListener = onClickListener; + } + + public int getIconId() { + return iconId; + } + + public String getButtonText() { + return buttonText; + } + + public String getText() { + return text; + } + + public boolean isNeedLinks() { + return needLinks; + } + + public boolean isUrl() { + return url; + } + + public boolean isCollapsable() { + return collapsable; + } + + public CollapsableView getCollapsableView() { + return collapsableView; + } + + public View.OnClickListener getOnClickListener() { + return onClickListener; + } +} \ No newline at end of file diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/builders/AmenityMenuBuilder.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/builders/AmenityMenuBuilder.java index 1e381b63cd..4791e401d0 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/builders/AmenityMenuBuilder.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/builders/AmenityMenuBuilder.java @@ -35,6 +35,7 @@ import net.osmand.plus.Version; import net.osmand.plus.activities.MapActivity; import net.osmand.plus.helpers.FontCache; import net.osmand.plus.mapcontextmenu.MenuBuilder; +import net.osmand.plus.mapcontextmenu.CollapsableView; import net.osmand.plus.osmedit.OsmEditingPlugin; import net.osmand.plus.poi.PoiUIFilter; import net.osmand.plus.views.POIMapLayer; @@ -223,27 +224,27 @@ public class AmenityMenuBuilder extends MenuBuilder { llIconCollapseParams.gravity = Gravity.CENTER_VERTICAL; iconViewCollapse.setLayoutParams(llIconCollapseParams); iconViewCollapse.setScaleType(ImageView.ScaleType.CENTER_INSIDE); - iconViewCollapse.setImageDrawable(getCollapseIcon(collapsableView.getContenView().getVisibility() == View.GONE)); + iconViewCollapse.setImageDrawable(getCollapseIcon(collapsableView.getContentView().getVisibility() == View.GONE)); llIconCollapse.addView(iconViewCollapse); ll.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { - if (collapsableView.getContenView().getVisibility() == View.VISIBLE) { - collapsableView.getContenView().setVisibility(View.GONE); + if (collapsableView.getContentView().getVisibility() == View.VISIBLE) { + collapsableView.getContentView().setVisibility(View.GONE); iconViewCollapse.setImageDrawable(getCollapseIcon(true)); collapsableView.setCollapsed(true); } else { - collapsableView.getContenView().setVisibility(View.VISIBLE); + collapsableView.getContentView().setVisibility(View.VISIBLE); iconViewCollapse.setImageDrawable(getCollapseIcon(false)); collapsableView.setCollapsed(false); } } }); if (collapsableView.isCollapsed()) { - collapsableView.getContenView().setVisibility(View.GONE); + collapsableView.getContentView().setVisibility(View.GONE); iconViewCollapse.setImageDrawable(getCollapseIcon(true)); } - baseView.addView(collapsableView.getContenView()); + baseView.addView(collapsableView.getContentView()); } if (isWiki) { @@ -426,8 +427,7 @@ public class AmenityMenuBuilder extends MenuBuilder { } else if (Amenity.COLLECTION_TIMES.equals(key) || Amenity.SERVICE_TIMES.equals(key)) { iconId = R.drawable.ic_action_time; needLinks = false; - } else if (Amenity.OPENING_HOURS.equals(key) || - Amenity.COLLECTION_TIMES.equals(key) || Amenity.SERVICE_TIMES.equals(key)) { + } else if (Amenity.OPENING_HOURS.equals(key)) { iconId = R.drawable.ic_action_time; collapsableView = getCollapsableTextView(view.getContext(), true, amenity.getAdditionalInfo(key).replace("; ", "\n").replace(",", ", ")); @@ -526,6 +526,19 @@ public class AmenityMenuBuilder extends MenuBuilder { textPrefix = formattedPrefixAndText[0]; vl = formattedPrefixAndText[1]; + if ("ele".equals(key)) { + try { + float distance = Float.parseFloat(vl); + Map distanceData = OsmAndFormatter.getDistanceData(app, distance); + MetricsConstants currentFormat = app.getSettings().METRIC_SYSTEM.get(); + vl = OsmAndFormatter.getFormattedDistance(distance, app, true, currentFormat); + collapsableView = getDistanceCollapsableView(distanceData); + collapsable = true; + } catch (NumberFormatException ex) { + LOG.error(ex); + } + } + boolean matchWidthDivider = !isDescription && isWiki; AmenityInfoRow row; if (isDescription) { @@ -565,8 +578,8 @@ public class AmenityMenuBuilder extends MenuBuilder { Drawable icon; PoiType pType = categoryTypes.get(0); String poiAdditionalCategoryName = pType.getPoiAdditionalCategory(); - String poiAddidionalIconName = poiTypes.getPoiAdditionalCategoryIconName(poiAdditionalCategoryName); - icon = getRowIcon(view.getContext(), poiAddidionalIconName); + String poiAdditionalIconName = poiTypes.getPoiAdditionalCategoryIconName(poiAdditionalCategoryName); + icon = getRowIcon(view.getContext(), poiAdditionalIconName); if (icon == null) { icon = getRowIcon(view.getContext(), poiAdditionalCategoryName); } @@ -627,7 +640,7 @@ public class AmenityMenuBuilder extends MenuBuilder { AmenityInfoRow descInPrefLang = null; for (AmenityInfoRow desc : descriptions) { if (desc.key.length() > langSuffix.length() - && desc.key.substring(desc.key.length() - langSuffix.length(), desc.key.length()).equals(langSuffix)) { + && desc.key.substring(desc.key.length() - langSuffix.length()).equals(langSuffix)) { descInPrefLang = desc; break; } @@ -690,7 +703,7 @@ public class AmenityMenuBuilder extends MenuBuilder { } case "depth": case "seamark_height": - if(Algorithms.isFloat(value)) { + if (Algorithms.isFloat(value)) { double valueAsDouble = Double.valueOf(value); if (metricSystem == OsmandSettings.MetricsConstants.MILES_AND_FEET) { formattedValue = String.valueOf(DF.format(valueAsDouble * OsmAndFormatter.FEET_IN_ONE_METER)) diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/builders/FavouritePointMenuBuilder.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/builders/FavouritePointMenuBuilder.java index a2eb9efe1c..1e6df280a3 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/builders/FavouritePointMenuBuilder.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/builders/FavouritePointMenuBuilder.java @@ -20,6 +20,7 @@ import net.osmand.plus.FavouritesDbHelper.FavoriteGroup; import net.osmand.plus.R; import net.osmand.plus.activities.MapActivity; import net.osmand.plus.mapcontextmenu.MenuBuilder; +import net.osmand.plus.mapcontextmenu.CollapsableView; import net.osmand.plus.myplaces.FavoritesActivity; import net.osmand.plus.widgets.TextViewEx; import net.osmand.util.Algorithms; diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/builders/WptPtMenuBuilder.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/builders/WptPtMenuBuilder.java index d9b2f6c7b9..a25a1d8326 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/builders/WptPtMenuBuilder.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/builders/WptPtMenuBuilder.java @@ -22,6 +22,7 @@ import net.osmand.plus.R; import net.osmand.plus.activities.MapActivity; import net.osmand.plus.activities.TrackActivity; import net.osmand.plus.mapcontextmenu.MenuBuilder; +import net.osmand.plus.mapcontextmenu.CollapsableView; import net.osmand.plus.views.POIMapLayer; import net.osmand.plus.widgets.TextViewEx; import net.osmand.util.Algorithms; diff --git a/OsmAnd/src/net/osmand/plus/routepreparationmenu/RouteDetailsFragment.java b/OsmAnd/src/net/osmand/plus/routepreparationmenu/RouteDetailsFragment.java index f0a0550400..3b628dae68 100644 --- a/OsmAnd/src/net/osmand/plus/routepreparationmenu/RouteDetailsFragment.java +++ b/OsmAnd/src/net/osmand/plus/routepreparationmenu/RouteDetailsFragment.java @@ -68,7 +68,7 @@ import net.osmand.plus.helpers.GpxUiHelper; import net.osmand.plus.helpers.GpxUiHelper.GPXDataSetType; import net.osmand.plus.helpers.GpxUiHelper.OrderedLineDataSet; import net.osmand.plus.mapcontextmenu.InterceptorLinearLayout; -import net.osmand.plus.mapcontextmenu.MenuBuilder.CollapsableView; +import net.osmand.plus.mapcontextmenu.CollapsableView; import net.osmand.plus.mapcontextmenu.other.TrackDetailsMenu; import net.osmand.plus.render.MapRenderRepositories; import net.osmand.plus.routepreparationmenu.cards.BaseCard; @@ -870,12 +870,12 @@ public class RouteDetailsFragment extends ContextMenuFragment implements PublicT llIconCollapseParams.gravity = Gravity.CENTER_VERTICAL|Gravity.START; iconViewCollapse.setLayoutParams(llIconCollapseParams); iconViewCollapse.setScaleType(ImageView.ScaleType.CENTER_INSIDE); - iconViewCollapse.setImageDrawable(getCollapseIcon(collapsableView.getContenView().getVisibility() == View.GONE)); + iconViewCollapse.setImageDrawable(getCollapseIcon(collapsableView.getContentView().getVisibility() == View.GONE)); llIconCollapse.addView(iconViewCollapse); ll.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { - LinearLayout contentView = (LinearLayout) collapsableView.getContenView(); + LinearLayout contentView = (LinearLayout) collapsableView.getContentView(); if (contentView.getVisibility() == View.VISIBLE) { contentView.setVisibility(View.GONE); iconViewCollapse.setImageDrawable(getCollapseIcon(true)); @@ -890,10 +890,10 @@ public class RouteDetailsFragment extends ContextMenuFragment implements PublicT } }); if (collapsableView.isCollapsed()) { - collapsableView.getContenView().setVisibility(View.GONE); + collapsableView.getContentView().setVisibility(View.GONE); iconViewCollapse.setImageDrawable(getCollapseIcon(true)); } - baseView.addView(collapsableView.getContenView()); + baseView.addView(collapsableView.getContentView()); } if (onClickListener != null) {