This commit is contained in:
sergosm 2020-08-27 16:22:45 +03:00
parent ffde5da67a
commit b9119fb2b2

View file

@ -93,6 +93,9 @@ public class SelectCategoryDialogFragment extends DialogFragment {
if (category.isVisible()) { if (category.isVisible()) {
ll.addView(createCategoryItem(activity, nightMode, category.getDisplayName(getContext()), ll.addView(createCategoryItem(activity, nightMode, category.getDisplayName(getContext()),
category.getColor())); category.getColor()));
} else {
ll.addView(createCategoryItemHidden(activity, nightMode, category.getDisplayName(getContext()),
category.getColor()));
} }
} }
} }
@ -153,6 +156,32 @@ public class SelectCategoryDialogFragment extends DialogFragment {
return itemView; 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) { public static SelectCategoryDialogFragment createInstance(String editorTag) {
SelectCategoryDialogFragment fragment = new SelectCategoryDialogFragment(); SelectCategoryDialogFragment fragment = new SelectCategoryDialogFragment();
Bundle bundle = new Bundle(); Bundle bundle = new Bundle();