diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/editors/SelectCategoryDialogFragment.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/editors/SelectCategoryDialogFragment.java index 8875949d3f..2af96e1cb3 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/editors/SelectCategoryDialogFragment.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/editors/SelectCategoryDialogFragment.java @@ -93,6 +93,9 @@ public class SelectCategoryDialogFragment extends DialogFragment { if (category.isVisible()) { ll.addView(createCategoryItem(activity, nightMode, category.getDisplayName(getContext()), category.getColor())); + } else { + ll.addView(createCategoryItemHidden(activity, nightMode, category.getDisplayName(getContext()), + category.getColor())); } } } @@ -153,6 +156,32 @@ public class SelectCategoryDialogFragment extends DialogFragment { return itemView; } + private View createCategoryItemHidden(@NonNull final Activity activity, boolean nightMode, final String categoryName, final int categoryColor) { + View itemView = UiUtilities.getInflater(activity, nightMode).inflate(R.layout.favorite_category_dialog_item, null); + Button button = (Button)itemView.findViewById(R.id.button); + button.setCompoundDrawablesWithIntrinsicBounds(getIcon(activity, R.drawable.ic_action_hide), null, null, null); + button.setCompoundDrawablePadding(AndroidUtils.dpToPx(activity,15f)); + String name = categoryName.length() == 0 ? getString(R.string.shared_string_favorites) : categoryName; + button.setText(name); + button.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + FragmentActivity a = getActivity(); + if (a instanceof MapActivity) { + PointEditor pointEditor = ((MapActivity) a).getContextMenu().getPointEditor(editorTag); + if (pointEditor != null) { + pointEditor.setCategory(categoryName, categoryColor); + } + if (selectionListener != null) { + selectionListener.onCategorySelected(categoryName, categoryColor); + } + } + dismiss(); + } + }); + return itemView; + } + public static SelectCategoryDialogFragment createInstance(String editorTag) { SelectCategoryDialogFragment fragment = new SelectCategoryDialogFragment(); Bundle bundle = new Bundle();