feat: add indicator to currently active style in map change ui

This commit is contained in:
2026-09-13 16:25:36 +02:00
parent 19d0a768fd
commit 85734fa98d
4 changed files with 59 additions and 31 deletions
@@ -55,17 +55,27 @@ public class GenericItem implements UIItem {
hasImage = true;
}
public static GenericItem fromStyle(StyleDocument style, AppController app, Runnable onClick) {
if(style == null) return new GenericItem("Unknown");
if(style.icon != null)
return new GenericItem(style.name, FileHelper.getIcon(style.icon, app), onClick);
return new GenericItem(style.name, onClick);
public GenericItem(StyleDocument style, AppController app, Runnable onClick) {
if (style == null) {
this.name = "Unknown";
return;
}
this.name = style.name;
this.image = style.icon != null ? FileHelper.getIcon(style.icon, app) : null;
this.onClick = onClick;
}
public static GenericItem fromStyle(StyleDocument style, AppController app, Runnable onClick, Runnable onLongClick) {
if(style == null) return new GenericItem("Unknown");
if(style.icon != null)
return new GenericItem(style.name, FileHelper.getIcon(style.icon, app), onClick, onLongClick);
return new GenericItem(style.name, onClick, onLongClick);
public GenericItem(StyleDocument style, AppController app, Runnable onClick, Runnable onLongClick) {
if (style == null) {
this.name = "Unknown";
return;
}
this.name = style.name;
this.image = style.icon != null ? FileHelper.getIcon(style.icon, app) : null;
this.onClick = onClick;
this.onLongClick = onLongClick;
}
@Override
@@ -58,6 +58,9 @@ public class FragmentMapChangePopup extends Fragment implements Popup {
app,
() -> this.setStyle(id),
() -> this.styleDetails(id)).makeView(ui);
if (Objects.equals(map.styleId, id)) item.findViewById(R.id.indicator)
.setVisibility(View.VISIBLE);
stylesLayout.addView(item);
});
Bitmap addNewIcon = BitmapFactory.decodeResource(app.getActivity().getResources(), android.R.drawable.ic_menu_add);
stylesLayout.addView(new GenericItem("",