Reworked ENTIRE UI (God help me) and cleaned up MyScreen.java (from 700 lines to 400)

This commit is contained in:
2026-07-13 20:29:03 +02:00
parent 0391cdd1ca
commit 11b223c562
@@ -206,7 +206,6 @@ public class MainUI extends BaseOwoScreen<FlowLayout> {
return tab; return tab;
} }
// --- Sidebar ---
private static int sidebarBtnFill() { return Config.get().darkMode ? 0x803a3a3a : 0x80FFFFFF; } private static int sidebarBtnFill() { return Config.get().darkMode ? 0x803a3a3a : 0x80FFFFFF; }
private static int sidebarBtnHover() { return Config.get().darkMode ? 0xA0505050 : 0xA0FFFFFF; } private static int sidebarBtnHover() { return Config.get().darkMode ? 0xA0505050 : 0xA0FFFFFF; }
private static int sidebarBtnOutline() { return Config.get().darkMode ? 0xFF888888 : 0xFFFFFFFF; } private static int sidebarBtnOutline() { return Config.get().darkMode ? 0xFF888888 : 0xFFFFFFFF; }
@@ -223,7 +222,6 @@ public class MainUI extends BaseOwoScreen<FlowLayout> {
sidebar.child(makeSidebarButton("+", 400)); sidebar.child(makeSidebarButton("+", 400));
sidebar.child(UIComponents.spacer()); sidebar.child(UIComponents.spacer());
// Edit button
FlowLayout editButton = UIContainers.verticalFlow(Sizing.fixed(36), Sizing.fixed(18)); FlowLayout editButton = UIContainers.verticalFlow(Sizing.fixed(36), Sizing.fixed(18));
editButton.horizontalAlignment(HorizontalAlignment.CENTER); editButton.horizontalAlignment(HorizontalAlignment.CENTER);
editButton.verticalAlignment(VerticalAlignment.CENTER); editButton.verticalAlignment(VerticalAlignment.CENTER);
@@ -255,7 +253,6 @@ public class MainUI extends BaseOwoScreen<FlowLayout> {
return button; return button;
} }
// --- Category bar ---
private FlowLayout buildCategoryBar(Runnable onFilterChanged) { private FlowLayout buildCategoryBar(Runnable onFilterChanged) {
FlowLayout bar = UIContainers.horizontalFlow(Sizing.fixed(CONTENT_WIDTH - 8), Sizing.fixed(18)); FlowLayout bar = UIContainers.horizontalFlow(Sizing.fixed(CONTENT_WIDTH - 8), Sizing.fixed(18));
bar.gap(4); bar.gap(4);
@@ -321,7 +318,6 @@ public class MainUI extends BaseOwoScreen<FlowLayout> {
return searchText.isEmpty() || moduleName.toLowerCase().contains(searchText.toLowerCase()); return searchText.isEmpty() || moduleName.toLowerCase().contains(searchText.toLowerCase());
} }
// --- General panel ---
private void buildGeneralPanel(FlowLayout content) { private void buildGeneralPanel(FlowLayout content) {
content.child(buildCategoryBar(() -> { content.clearChildren(); buildGeneralPanel(content); })); content.child(buildCategoryBar(() -> { content.clearChildren(); buildGeneralPanel(content); }));
@@ -342,21 +338,18 @@ public class MainUI extends BaseOwoScreen<FlowLayout> {
} }
} }
// --- Settings panel ---
private void buildSettingsPanel(FlowLayout content) { private void buildSettingsPanel(FlowLayout content) {
FlowLayout rows = UIContainers.verticalFlow(Sizing.fixed(CONTENT_WIDTH - 8), Sizing.content()); FlowLayout rows = UIContainers.verticalFlow(Sizing.fixed(CONTENT_WIDTH - 8), Sizing.content());
rows.gap(8); rows.gap(8);
rows.verticalAlignment(VerticalAlignment.TOP); rows.verticalAlignment(VerticalAlignment.TOP);
rows.horizontalAlignment(HorizontalAlignment.LEFT); rows.horizontalAlignment(HorizontalAlignment.LEFT);
// Blur slider
rows.child(makeSettingRow("Panel Blur", SettingsControls.makeSlider( rows.child(makeSettingRow("Panel Blur", SettingsControls.makeSlider(
FLAT, 80, 0.0, 15.0, Config.get().panelBlur, FLAT, 80, 0.0, 15.0, Config.get().panelBlur,
value -> (int) value + "px", value -> (int) value + "px",
value -> { Config.get().panelBlur = (float) (double) value; Config.get().save(); rebuildSurfaces(); } value -> { Config.get().panelBlur = (float) (double) value; Config.get().save(); rebuildSurfaces(); }
))); )));
// Dark mode toggle
rows.child(makeSettingRow("Dark Mode", SettingsControls.makeCheckbox( rows.child(makeSettingRow("Dark Mode", SettingsControls.makeCheckbox(
FLAT, GLASS_PANEL, Config.get().darkMode, value -> { FLAT, GLASS_PANEL, Config.get().darkMode, value -> {
Config.get().darkMode = value; Config.get().darkMode = value;
@@ -381,13 +374,11 @@ public class MainUI extends BaseOwoScreen<FlowLayout> {
return row; return row;
} }
// --- Module settings ---
private void openModuleSettings(String title, List<ModuleSettings.SettingRow> rows) { private void openModuleSettings(String title, List<ModuleSettings.SettingRow> rows) {
content.clearChildren(); content.clearChildren();
content.horizontalAlignment(HorizontalAlignment.LEFT); content.horizontalAlignment(HorizontalAlignment.LEFT);
content.verticalAlignment(VerticalAlignment.TOP); content.verticalAlignment(VerticalAlignment.TOP);
// Header with back button
FlowLayout header = UIContainers.horizontalFlow(Sizing.fixed(CONTENT_WIDTH - 8), Sizing.content()); FlowLayout header = UIContainers.horizontalFlow(Sizing.fixed(CONTENT_WIDTH - 8), Sizing.content());
header.verticalAlignment(VerticalAlignment.CENTER); header.verticalAlignment(VerticalAlignment.CENTER);
header.horizontalAlignment(HorizontalAlignment.LEFT); header.horizontalAlignment(HorizontalAlignment.LEFT);
@@ -397,7 +388,6 @@ public class MainUI extends BaseOwoScreen<FlowLayout> {
.color(Color.ofRgb(bright()))); .color(Color.ofRgb(bright())));
content.child(header); content.child(header);
// Setting rows
FlowLayout rowsContainer = UIContainers.verticalFlow(Sizing.fixed(CONTENT_WIDTH - 8), Sizing.content()); FlowLayout rowsContainer = UIContainers.verticalFlow(Sizing.fixed(CONTENT_WIDTH - 8), Sizing.content());
rowsContainer.gap(1); rowsContainer.gap(1);
rowsContainer.verticalAlignment(VerticalAlignment.TOP); rowsContainer.verticalAlignment(VerticalAlignment.TOP);