diff --git a/OsmAnd/res/layout/bottom_sheet_menu_base.xml b/OsmAnd/res/layout/bottom_sheet_menu_base.xml
index 8a575be9ee..7e98ba5ca1 100644
--- a/OsmAnd/res/layout/bottom_sheet_menu_base.xml
+++ b/OsmAnd/res/layout/bottom_sheet_menu_base.xml
@@ -1,6 +1,7 @@
+
+
-
+ android:layout_height="@dimen/bottom_sheet_cancel_button_height">
-
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/OsmAnd/res/values/phrases.xml b/OsmAnd/res/values/phrases.xml
index 8bc71187b8..2a9d4217de 100644
--- a/OsmAnd/res/values/phrases.xml
+++ b/OsmAnd/res/values/phrases.xml
@@ -3761,6 +3761,6 @@
Name of the river rapids
- Shop's delivery point
+ Shop\'s delivery point
diff --git a/OsmAnd/src/net/osmand/plus/MapMarkersHelper.java b/OsmAnd/src/net/osmand/plus/MapMarkersHelper.java
index 2ae81bed21..7feafe89d3 100644
--- a/OsmAnd/src/net/osmand/plus/MapMarkersHelper.java
+++ b/OsmAnd/src/net/osmand/plus/MapMarkersHelper.java
@@ -939,7 +939,7 @@ public class MapMarkersHelper {
}
private void updateSyncGroupDisabled(@NonNull MapMarkersGroup group, boolean disabled) {
- List groupMarkers = group.getMarkers();
+ List groupMarkers = new ArrayList<>(group.getMarkers());
for (MapMarker marker : groupMarkers) {
if (marker.history) {
if (disabled) {
diff --git a/OsmAnd/src/net/osmand/plus/audionotes/ItemMenuBottomSheetDialogFragment.java b/OsmAnd/src/net/osmand/plus/audionotes/ItemMenuBottomSheetDialogFragment.java
index 26014c4cb7..35bec8bcb0 100644
--- a/OsmAnd/src/net/osmand/plus/audionotes/ItemMenuBottomSheetDialogFragment.java
+++ b/OsmAnd/src/net/osmand/plus/audionotes/ItemMenuBottomSheetDialogFragment.java
@@ -127,7 +127,7 @@ public class ItemMenuBottomSheetDialogFragment extends MenuBottomSheetDialogFrag
}
@Override
- protected int getCloseRowTextId() {
+ protected int getDismissButtonTextId() {
return R.string.shared_string_close;
}
diff --git a/OsmAnd/src/net/osmand/plus/base/MenuBottomSheetDialogFragment.java b/OsmAnd/src/net/osmand/plus/base/MenuBottomSheetDialogFragment.java
index 5a530f6158..a80d28f5a7 100644
--- a/OsmAnd/src/net/osmand/plus/base/MenuBottomSheetDialogFragment.java
+++ b/OsmAnd/src/net/osmand/plus/base/MenuBottomSheetDialogFragment.java
@@ -4,6 +4,7 @@ import android.app.Activity;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.os.Bundle;
+import android.support.annotation.ColorInt;
import android.support.annotation.ColorRes;
import android.support.annotation.DrawableRes;
import android.support.annotation.Nullable;
@@ -61,25 +62,49 @@ public abstract class MenuBottomSheetDialogFragment extends BottomSheetDialogFra
final int themeRes = nightMode ? R.style.OsmandDarkTheme : R.style.OsmandLightTheme;
View mainView = View.inflate(new ContextThemeWrapper(app, themeRes), R.layout.bottom_sheet_menu_base, null);
- itemsContainer = (LinearLayout) mainView.findViewById(R.id.items_container);
+ if (useScrollableItemsContainer()) {
+ itemsContainer = (LinearLayout) mainView.findViewById(R.id.scrollable_items_container);
+ } else {
+ mainView.findViewById(R.id.scroll_view).setVisibility(View.GONE);
+ itemsContainer = (LinearLayout) mainView.findViewById(R.id.non_scrollable_items_container);
+ itemsContainer.setVisibility(View.VISIBLE);
+ }
for (BaseBottomSheetItem item : items) {
item.inflate(app, itemsContainer, nightMode);
}
- int closeRowDividerColorId = getCloseRowDividerColorId();
- if (closeRowDividerColorId != -1) {
- mainView.findViewById(R.id.close_row_divider)
- .setBackgroundColor(ContextCompat.getColor(getContext(), closeRowDividerColorId));
+ int bottomDividerColorId = getBottomDividerColorId();
+ if (bottomDividerColorId != -1) {
+ mainView.findViewById(R.id.bottom_row_divider).setBackgroundColor(getResolvedColor(bottomDividerColorId));
}
- mainView.findViewById(R.id.close_row).setOnClickListener(new View.OnClickListener() {
+
+ mainView.findViewById(R.id.dismiss_button).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
- onCloseRowClickAction();
+ onDismissButtonClickAction();
dismiss();
}
});
- ((TextView) mainView.findViewById(R.id.close_row_text)).setText(getCloseRowTextId());
+ ((TextView) mainView.findViewById(R.id.dismiss_button_text)).setText(getDismissButtonTextId());
+
+ int rightBottomButtonTextId = getRightBottomButtonTextId();
+ if (rightBottomButtonTextId != -1) {
+ View buttonsDivider = mainView.findViewById(R.id.bottom_buttons_divider);
+ buttonsDivider.setVisibility(View.VISIBLE);
+ if (bottomDividerColorId != -1) {
+ buttonsDivider.setBackgroundColor(getResolvedColor(bottomDividerColorId));
+ }
+ View rightButton = mainView.findViewById(R.id.right_bottom_button);
+ rightButton.setVisibility(View.VISIBLE);
+ rightButton.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ onRightBottomButtonClick();
+ }
+ });
+ ((TextView) rightButton.findViewById(R.id.right_bottom_button_text)).setText(rightBottomButtonTextId);
+ }
setupHeightAndBackground(mainView);
@@ -123,23 +148,27 @@ public abstract class MenuBottomSheetDialogFragment extends BottomSheetDialogFra
return getIcon(id, nightMode ? R.color.osmand_orange : R.color.color_myloc_distance);
}
+ @ColorInt
+ protected int getResolvedColor(@ColorRes int colorId) {
+ return ContextCompat.getColor(getContext(), colorId);
+ }
+
protected void setupHeightAndBackground(final View mainView) {
final Activity activity = getActivity();
+
final int screenHeight = AndroidUtils.getScreenHeight(activity);
final int statusBarHeight = AndroidUtils.getStatusBarHeight(activity);
- final int navBarHeight = AndroidUtils.getNavBarHeight(activity);
+ final int availableHeight = screenHeight - statusBarHeight - AndroidUtils.getNavBarHeight(activity)
+ - AndroidUtils.dpToPx(getContext(), 1) // divider height
+ - getResources().getDimensionPixelSize(R.dimen.bottom_sheet_cancel_button_height); // bottom row height
mainView.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
@Override
public void onGlobalLayout() {
- final View scrollView = mainView.findViewById(R.id.scroll_view);
- int scrollViewHeight = scrollView.getHeight();
- int dividerHeight = AndroidUtils.dpToPx(getContext(), 1);
- int cancelButtonHeight = getContext().getResources().getDimensionPixelSize(R.dimen.bottom_sheet_cancel_button_height);
- int spaceForScrollView = screenHeight - statusBarHeight - navBarHeight - dividerHeight - cancelButtonHeight;
- if (scrollViewHeight > spaceForScrollView) {
- scrollView.getLayoutParams().height = spaceForScrollView;
- scrollView.requestLayout();
+ final View viewToAdjust = useScrollableItemsContainer() ? mainView.findViewById(R.id.scroll_view) : itemsContainer;
+ if (viewToAdjust.getHeight() > availableHeight) {
+ viewToAdjust.getLayoutParams().height = availableHeight;
+ viewToAdjust.requestLayout();
}
// 8dp is the shadow height
@@ -160,17 +189,30 @@ public abstract class MenuBottomSheetDialogFragment extends BottomSheetDialogFra
});
}
+ protected boolean useScrollableItemsContainer() {
+ return true;
+ }
+
@ColorRes
- protected int getCloseRowDividerColorId() {
+ protected int getBottomDividerColorId() {
return -1;
}
@StringRes
- protected int getCloseRowTextId() {
+ protected int getDismissButtonTextId() {
return R.string.shared_string_cancel;
}
- protected void onCloseRowClickAction() {
+ protected void onDismissButtonClickAction() {
+
+ }
+
+ @StringRes
+ protected int getRightBottomButtonTextId() {
+ return -1;
+ }
+
+ protected void onRightBottomButtonClick() {
}
diff --git a/OsmAnd/src/net/osmand/plus/dialogs/AddWaypointBottomSheetDialogFragment.java b/OsmAnd/src/net/osmand/plus/dialogs/AddWaypointBottomSheetDialogFragment.java
index 6d09efcfab..771f673ee5 100644
--- a/OsmAnd/src/net/osmand/plus/dialogs/AddWaypointBottomSheetDialogFragment.java
+++ b/OsmAnd/src/net/osmand/plus/dialogs/AddWaypointBottomSheetDialogFragment.java
@@ -75,7 +75,7 @@ public class AddWaypointBottomSheetDialogFragment extends MenuBottomSheetDialogF
.create();
items.add(replaceStartItem);
- items.add(new DividerHalfItem(getContext(), getCloseRowDividerColorId()));
+ items.add(new DividerHalfItem(getContext(), getBottomDividerColorId()));
BaseBottomSheetItem subsequentDestItem = new BottomSheetItemWithDescription.Builder()
.setDescription(getString(R.string.subsequent_dest_description))
@@ -135,7 +135,7 @@ public class AddWaypointBottomSheetDialogFragment extends MenuBottomSheetDialogF
}
@Override
- protected int getCloseRowDividerColorId() {
+ protected int getBottomDividerColorId() {
return nightMode ? R.color.route_info_bottom_view_bg_dark : -1;
}
diff --git a/OsmAnd/src/net/osmand/plus/helpers/ImportHelper.java b/OsmAnd/src/net/osmand/plus/helpers/ImportHelper.java
index 21f4f6a048..af4daaaf47 100644
--- a/OsmAnd/src/net/osmand/plus/helpers/ImportHelper.java
+++ b/OsmAnd/src/net/osmand/plus/helpers/ImportHelper.java
@@ -790,10 +790,5 @@ public class ImportHelper {
.create();
items.add(asGpxItem);
}
-
- @ColorInt
- private int getResolvedColor(@ColorRes int colorId) {
- return ContextCompat.getColor(getContext(), colorId);
- }
}
}
diff --git a/OsmAnd/src/net/osmand/plus/helpers/WaypointDialogHelper.java b/OsmAnd/src/net/osmand/plus/helpers/WaypointDialogHelper.java
index eada4a31e7..d0fdd7a19d 100644
--- a/OsmAnd/src/net/osmand/plus/helpers/WaypointDialogHelper.java
+++ b/OsmAnd/src/net/osmand/plus/helpers/WaypointDialogHelper.java
@@ -1068,7 +1068,7 @@ public class WaypointDialogHelper {
}
@Override
- protected int getCloseRowTextId() {
+ protected int getDismissButtonTextId() {
return R.string.shared_string_close;
}
diff --git a/OsmAnd/src/net/osmand/plus/mapmarkers/AddGroupBottomSheetDialogFragment.java b/OsmAnd/src/net/osmand/plus/mapmarkers/AddGroupBottomSheetDialogFragment.java
index 6dc530bef5..2c37c532c2 100644
--- a/OsmAnd/src/net/osmand/plus/mapmarkers/AddGroupBottomSheetDialogFragment.java
+++ b/OsmAnd/src/net/osmand/plus/mapmarkers/AddGroupBottomSheetDialogFragment.java
@@ -77,6 +77,11 @@ public abstract class AddGroupBottomSheetDialogFragment extends MenuBottomSheetD
super.onDestroyView();
}
+ @Override
+ protected boolean useScrollableItemsContainer() {
+ return false;
+ }
+
private void showProgressBar() {
mainView.findViewById(R.id.groups_recycler_view).setVisibility(View.GONE);
mainView.findViewById(R.id.progress_bar).setVisibility(View.VISIBLE);
diff --git a/OsmAnd/src/net/osmand/plus/mapmarkers/CoordinateInputBottomSheetDialogFragment.java b/OsmAnd/src/net/osmand/plus/mapmarkers/CoordinateInputBottomSheetDialogFragment.java
index 75472c3b3b..4cc678cfe2 100644
--- a/OsmAnd/src/net/osmand/plus/mapmarkers/CoordinateInputBottomSheetDialogFragment.java
+++ b/OsmAnd/src/net/osmand/plus/mapmarkers/CoordinateInputBottomSheetDialogFragment.java
@@ -6,7 +6,6 @@ import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.support.annotation.ColorRes;
import android.support.annotation.Nullable;
-import android.support.v4.content.ContextCompat;
import android.view.View;
import net.osmand.plus.OsmandSettings;
@@ -122,7 +121,7 @@ public class CoordinateInputBottomSheetDialogFragment extends MenuBottomSheetDia
BaseBottomSheetItem formatItem = new BottomSheetItemWithCompoundButton.Builder()
.setChecked(selectedItem)
.setButtonTintList(selectedItem
- ? ColorStateList.valueOf(ContextCompat.getColor(context, getActiveColorId()))
+ ? ColorStateList.valueOf(getResolvedColor(getActiveColorId()))
: null)
.setIcon(selectedItem ? getActiveIcon(R.drawable.ic_action_coordinates_latitude) : formatIcon)
.setTitle(CoordinateInputFormats.formatToHumanString(context, format))
@@ -142,7 +141,7 @@ public class CoordinateInputBottomSheetDialogFragment extends MenuBottomSheetDia
}
@Override
- protected int getCloseRowTextId() {
+ protected int getDismissButtonTextId() {
return R.string.shared_string_close;
}
diff --git a/OsmAnd/src/net/osmand/plus/mapmarkers/HistoryMarkerMenuBottomSheetDialogFragment.java b/OsmAnd/src/net/osmand/plus/mapmarkers/HistoryMarkerMenuBottomSheetDialogFragment.java
index 798729d301..01a7ac5d8f 100644
--- a/OsmAnd/src/net/osmand/plus/mapmarkers/HistoryMarkerMenuBottomSheetDialogFragment.java
+++ b/OsmAnd/src/net/osmand/plus/mapmarkers/HistoryMarkerMenuBottomSheetDialogFragment.java
@@ -92,7 +92,7 @@ public class HistoryMarkerMenuBottomSheetDialogFragment extends MenuBottomSheetD
}
@Override
- protected int getCloseRowTextId() {
+ protected int getDismissButtonTextId() {
return R.string.shared_string_close;
}
diff --git a/OsmAnd/src/net/osmand/plus/mapmarkers/OrderByBottomSheetDialogFragment.java b/OsmAnd/src/net/osmand/plus/mapmarkers/OrderByBottomSheetDialogFragment.java
index 7b786261ca..7239b76fcc 100644
--- a/OsmAnd/src/net/osmand/plus/mapmarkers/OrderByBottomSheetDialogFragment.java
+++ b/OsmAnd/src/net/osmand/plus/mapmarkers/OrderByBottomSheetDialogFragment.java
@@ -116,7 +116,7 @@ public class OrderByBottomSheetDialogFragment extends MenuBottomSheetDialogFragm
}
@Override
- protected int getCloseRowTextId() {
+ protected int getDismissButtonTextId() {
return R.string.shared_string_close;
}
diff --git a/OsmAnd/src/net/osmand/plus/mapmarkers/PlanRouteOptionsBottomSheetDialogFragment.java b/OsmAnd/src/net/osmand/plus/mapmarkers/PlanRouteOptionsBottomSheetDialogFragment.java
index 2386569c32..943f998302 100644
--- a/OsmAnd/src/net/osmand/plus/mapmarkers/PlanRouteOptionsBottomSheetDialogFragment.java
+++ b/OsmAnd/src/net/osmand/plus/mapmarkers/PlanRouteOptionsBottomSheetDialogFragment.java
@@ -121,7 +121,7 @@ public class PlanRouteOptionsBottomSheetDialogFragment extends MenuBottomSheetDi
}
@Override
- protected int getCloseRowTextId() {
+ protected int getDismissButtonTextId() {
return R.string.shared_string_close;
}
diff --git a/OsmAnd/src/net/osmand/plus/mapmarkers/SelectionMarkersGroupBottomSheetDialogFragment.java b/OsmAnd/src/net/osmand/plus/mapmarkers/SelectionMarkersGroupBottomSheetDialogFragment.java
index 2d6923d8d3..f0ad5db9e6 100644
--- a/OsmAnd/src/net/osmand/plus/mapmarkers/SelectionMarkersGroupBottomSheetDialogFragment.java
+++ b/OsmAnd/src/net/osmand/plus/mapmarkers/SelectionMarkersGroupBottomSheetDialogFragment.java
@@ -60,7 +60,7 @@ public class SelectionMarkersGroupBottomSheetDialogFragment extends MenuBottomSh
}
@Override
- protected int getCloseRowTextId() {
+ protected int getDismissButtonTextId() {
return R.string.shared_string_close;
}
diff --git a/OsmAnd/src/net/osmand/plus/measurementtool/OptionsBottomSheetDialogFragment.java b/OsmAnd/src/net/osmand/plus/measurementtool/OptionsBottomSheetDialogFragment.java
index c171c60f85..7bdba8dbf6 100644
--- a/OsmAnd/src/net/osmand/plus/measurementtool/OptionsBottomSheetDialogFragment.java
+++ b/OsmAnd/src/net/osmand/plus/measurementtool/OptionsBottomSheetDialogFragment.java
@@ -124,7 +124,7 @@ public class OptionsBottomSheetDialogFragment extends MenuBottomSheetDialogFragm
}
@Override
- protected int getCloseRowTextId() {
+ protected int getDismissButtonTextId() {
return R.string.shared_string_close;
}
diff --git a/OsmAnd/src/net/osmand/plus/measurementtool/SelectedPointBottomSheetDialogFragment.java b/OsmAnd/src/net/osmand/plus/measurementtool/SelectedPointBottomSheetDialogFragment.java
index 893dc62845..77b1a3f42d 100644
--- a/OsmAnd/src/net/osmand/plus/measurementtool/SelectedPointBottomSheetDialogFragment.java
+++ b/OsmAnd/src/net/osmand/plus/measurementtool/SelectedPointBottomSheetDialogFragment.java
@@ -130,12 +130,12 @@ public class SelectedPointBottomSheetDialogFragment extends MenuBottomSheetDialo
}
@Override
- protected int getCloseRowTextId() {
+ protected int getDismissButtonTextId() {
return R.string.shared_string_close;
}
@Override
- protected void onCloseRowClickAction() {
+ protected void onDismissButtonClickAction() {
if (listener != null) {
listener.onClearSelection();
}
diff --git a/OsmAnd/src/net/osmand/plus/osmedit/OsmEditOptionsBottomSheetDialogFragment.java b/OsmAnd/src/net/osmand/plus/osmedit/OsmEditOptionsBottomSheetDialogFragment.java
index d95f9e540f..9c1d396ca5 100644
--- a/OsmAnd/src/net/osmand/plus/osmedit/OsmEditOptionsBottomSheetDialogFragment.java
+++ b/OsmAnd/src/net/osmand/plus/osmedit/OsmEditOptionsBottomSheetDialogFragment.java
@@ -119,7 +119,7 @@ public class OsmEditOptionsBottomSheetDialogFragment extends MenuBottomSheetDial
}
@Override
- protected int getCloseRowTextId() {
+ protected int getDismissButtonTextId() {
return R.string.shared_string_close;
}
diff --git a/OsmAnd/src/net/osmand/plus/parkingpoint/ParkingTypeBottomSheetDialogFragment.java b/OsmAnd/src/net/osmand/plus/parkingpoint/ParkingTypeBottomSheetDialogFragment.java
index 3db8c6040b..eea40c96be 100644
--- a/OsmAnd/src/net/osmand/plus/parkingpoint/ParkingTypeBottomSheetDialogFragment.java
+++ b/OsmAnd/src/net/osmand/plus/parkingpoint/ParkingTypeBottomSheetDialogFragment.java
@@ -4,7 +4,6 @@ import android.app.Dialog;
import android.os.Bundle;
import android.view.View;
-import net.osmand.data.LatLon;
import net.osmand.plus.OsmandPlugin;
import net.osmand.plus.R;
import net.osmand.plus.activities.MapActivity;
@@ -23,6 +22,7 @@ public class ParkingTypeBottomSheetDialogFragment extends MenuBottomSheetDialogF
@Override
public void createMenuItems(Bundle savedInstanceState) {
items.add(new TitleItem(getString(R.string.parking_options)));
+
BaseBottomSheetItem byTypeItem = new SimpleBottomSheetItem.Builder()
.setIcon(getContentIcon(R.drawable.ic_action_time_start))
.setTitle(getString(R.string.osmand_parking_no_lim_text))
@@ -47,17 +47,18 @@ public class ParkingTypeBottomSheetDialogFragment extends MenuBottomSheetDialogF
}
})
.create();
+
items.add(byDateItem);
}
private void addParkingPosition(boolean limited) {
- Bundle args = getArguments();
- double latitude = args.getDouble(LAT_KEY);
- double longitude = args.getDouble(LON_KEY);
ParkingPositionPlugin plugin = OsmandPlugin.getEnabledPlugin(ParkingPositionPlugin.class);
- MapActivity mapActivity = (MapActivity) getActivity();
-
if (plugin != null) {
+ MapActivity mapActivity = (MapActivity) getActivity();
+ Bundle args = getArguments();
+ double latitude = args.getDouble(LAT_KEY);
+ double longitude = args.getDouble(LON_KEY);
+
if (plugin.isParkingEventAdded()) {
plugin.showDeleteEventWarning(mapActivity);
}