This commit is contained in:
veliymolfar 2020-04-24 14:33:06 +03:00
parent 4fb1c7a077
commit 3c0bd48945
5 changed files with 53 additions and 17 deletions

View file

@ -27,17 +27,15 @@
<ImageButton
android:id="@+id/action_icon"
style="@style/Widget.AppCompat.ActionButton"
android:layout_width="@dimen/standard_icon_size"
android:layout_height="@dimen/standard_icon_size"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginLeft="@dimen/content_padding"
android:layout_marginTop="@dimen/bottom_sheet_icon_margin"
android:layout_marginRight="@dimen/content_padding"
android:layout_marginBottom="@dimen/bottom_sheet_icon_margin"
android:layout_marginStart="@dimen/content_padding_half"
android:layout_marginLeft="@dimen/content_padding_half"
tools:src="@drawable/ic_action_remove"
tools:tint="@color/icon_color_default_light"
android:layout_marginEnd="@dimen/content_padding"
android:layout_marginStart="@dimen/content_padding" />
android:layout_marginEnd="@dimen/content_padding_half"
android:layout_marginRight="@dimen/content_padding_half" />
<ImageView
android:id="@+id/icon"
@ -46,11 +44,9 @@
android:layout_gravity="center"
android:layout_marginLeft="@dimen/content_padding"
android:layout_marginTop="@dimen/bottom_sheet_icon_margin"
android:layout_marginRight="@dimen/content_padding"
android:layout_marginBottom="@dimen/bottom_sheet_icon_margin"
tools:src="@drawable/ic_action_car_dark"
tools:tint="@color/profile_icon_color_blue_light_default"
android:layout_marginEnd="@dimen/content_padding"
android:layout_marginStart="@dimen/content_padding" />
<LinearLayout

View file

@ -11,6 +11,7 @@
Thx - Hardy
-->
<string name="create_edit_poi">Create/Edit POI</string>
<string name="download_unsupported_action">Unsupported action %1$s</string>
<string name="extra_maps_menu_group">Extra maps</string>
<string name="custom_color">Custom color</string>

View file

@ -31,6 +31,7 @@ import net.osmand.GPXUtilities.WptPt;
import net.osmand.IndexConstants;
import net.osmand.Location;
import net.osmand.PlatformUtil;
import net.osmand.data.FavouritePoint;
import net.osmand.data.LatLon;
import net.osmand.data.PointDescription;
import net.osmand.data.QuadRect;
@ -346,7 +347,7 @@ public class MapActivityActions implements DialogProvider {
ItemBuilder itemBuilder = new ItemBuilder();
adapter.addItem(itemBuilder
.setTitleId(R.string.shared_string_add, mapActivity)
.setTitleId(selectedObj instanceof FavouritePoint ? R.string.favourites_context_menu_edit : R.string.shared_string_add, mapActivity)
.setId(MAP_CONTEXT_MENU_ADD_ID)
.setIcon(R.drawable.map_action_fav_dark)
.setOrder(0)
@ -477,7 +478,7 @@ public class MapActivityActions implements DialogProvider {
MeasurementToolFragment.showInstance(mapActivity.getSupportFragmentManager(), new LatLon(latitude, longitude));
} else if (standardId == R.string.avoid_road) {
getMyApplication().getAvoidSpecificRoads().addImpassableRoad(mapActivity, new LatLon(latitude, longitude), true, false, null);
} else if (standardId == R.string.shared_string_add) {
} else if (standardId == R.string.shared_string_add || standardId == R.string.favourites_context_menu_edit) {
mapActivity.getContextMenu().buttonFavoritePressed();
} else if (standardId == R.string.shared_string_marker) {
mapActivity.getContextMenu().buttonWaypointPressed();

View file

@ -668,7 +668,8 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
TextView title = view.findViewById(R.id.text);
icon.setImageDrawable(uiUtilities.getIcon(contextMenuItem.getIcon(), nightMode));
title.setText(contextMenuItem.getTitle());
if (contextMenuItem.getId().equals(MAP_CONTEXT_MENU_MORE_ID)) {
String id = contextMenuItem.getId();
if (Algorithms.stringsEqual(id, MAP_CONTEXT_MENU_MORE_ID)) {
item.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {

View file

@ -31,13 +31,27 @@ import net.osmand.plus.settings.ConfigureMenuRootFragment.ScreenType;
import java.util.Collections;
import java.util.List;
import static net.osmand.aidlapi.OsmAndCustomizationConstants.CONTOUR_LINES;
import static net.osmand.aidlapi.OsmAndCustomizationConstants.DRAWER_BUILDS_ID;
import static net.osmand.aidlapi.OsmAndCustomizationConstants.DRAWER_DIVIDER_ID;
import static net.osmand.aidlapi.OsmAndCustomizationConstants.GPX_FILES_ID;
import static net.osmand.aidlapi.OsmAndCustomizationConstants.MAP_CONTEXT_MENU_ADD_GPX_WAYPOINT;
import static net.osmand.aidlapi.OsmAndCustomizationConstants.MAP_CONTEXT_MENU_CREATE_POI;
import static net.osmand.aidlapi.OsmAndCustomizationConstants.MAP_CONTEXT_MENU_EDIT_GPX_WP;
import static net.osmand.aidlapi.OsmAndCustomizationConstants.MAP_CONTEXT_MENU_MODIFY_OSM_NOTE;
import static net.osmand.aidlapi.OsmAndCustomizationConstants.MAP_CONTEXT_MENU_MORE_ID;
import static net.osmand.aidlapi.OsmAndCustomizationConstants.MAP_CONTEXT_MENU_OPEN_OSM_NOTE;
import static net.osmand.aidlapi.OsmAndCustomizationConstants.MAP_RENDERING_CATEGORY_ID;
import static net.osmand.aidlapi.OsmAndCustomizationConstants.MAP_SOURCE_ID;
import static net.osmand.aidlapi.OsmAndCustomizationConstants.OSM_EDITS;
import static net.osmand.aidlapi.OsmAndCustomizationConstants.OSM_NOTES;
import static net.osmand.aidlapi.OsmAndCustomizationConstants.OVERLAY_MAP;
import static net.osmand.aidlapi.OsmAndCustomizationConstants.RECORDING_LAYER;
import static net.osmand.aidlapi.OsmAndCustomizationConstants.RENDERING_ITEMS_ID_SCHEME;
import static net.osmand.aidlapi.OsmAndCustomizationConstants.SHOW_CATEGORY_ID;
import static net.osmand.aidlapi.OsmAndCustomizationConstants.SHOW_ITEMS_ID_SCHEME;
import static net.osmand.aidlapi.OsmAndCustomizationConstants.TERRAIN;
import static net.osmand.aidlapi.OsmAndCustomizationConstants.UNDERLAY_MAP;
import static net.osmand.plus.settings.ConfigureMenuItemsFragment.MAIN_BUTTONS_QUANTITY;
public class RearrangeMenuItemsAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
@ -192,6 +206,9 @@ public class RearrangeMenuItemsAdapter extends RecyclerView.Adapter<RecyclerView
h.actionIcon.setImageDrawable(uiUtilities.getIcon(R.drawable.ic_action_remove, nightMode));
h.actionIcon.setOnClickListener(null);
}
if (id.equals(MAP_CONTEXT_MENU_CREATE_POI)) {
h.title.setText(R.string.create_edit_poi);
}
} else if (holder instanceof HeaderHolder) {
HeaderHolder h = (HeaderHolder) holder;
HeaderItem header = (HeaderItem) item.value;
@ -442,10 +459,30 @@ public class RearrangeMenuItemsAdapter extends RecyclerView.Adapter<RecyclerView
}
private int getDescription(String id) {
if (id.equals(DRAWER_BUILDS_ID)) {
return R.string.developer_plugin;
} else {
return R.string.app_name_osmand;
switch (id) {
case DRAWER_BUILDS_ID:
return R.string.developer_plugin;
case GPX_FILES_ID:
case MAP_CONTEXT_MENU_EDIT_GPX_WP:
case MAP_CONTEXT_MENU_ADD_GPX_WAYPOINT:
return R.string.shared_string_trip_recording;
case MAP_SOURCE_ID:
case OVERLAY_MAP:
case UNDERLAY_MAP:
return R.string.shared_string_online_maps;
case RECORDING_LAYER:
return R.string.audionotes_plugin_name;
case CONTOUR_LINES:
case TERRAIN:
return R.string.srtm_plugin_name;
case OSM_NOTES:
case OSM_EDITS:
case MAP_CONTEXT_MENU_CREATE_POI:
case MAP_CONTEXT_MENU_MODIFY_OSM_NOTE:
case MAP_CONTEXT_MENU_OPEN_OSM_NOTE:
return R.string.osm_settings;
default:
return R.string.app_name_osmand;
}
}
}