Skip to content

Commit

Permalink
new save button behaviour
Browse files Browse the repository at this point in the history
  • Loading branch information
ix0rai committed May 25, 2024
1 parent c627586 commit 33a06e6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ public CustomModeScreen(Screen parent) {
sendNoColoursToast();
} else {
this.save();
this.closeScreen();
}
}).build();
this.saveButton.active = false;
Expand Down Expand Up @@ -72,6 +71,7 @@ private void save() {
}

Rainglow.CONFIG.save();
this.saveButton.active = false;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,7 @@ public RainglowConfigScreen(@Nullable Screen parent) {
super(TITLE);
this.parent = parent;
this.mode = RainglowMode.get(Rainglow.CONFIG.mode.getRealValue());
this.saveButton = ButtonWidget.builder(Rainglow.translatableText("config.save"), button -> {
this.save();
this.closeScreen(true);
}).build();
this.saveButton = ButtonWidget.builder(Rainglow.translatableText("config.save"), button -> this.save()).build();
this.saveButton.active = false;
}

Expand Down Expand Up @@ -158,6 +155,7 @@ private void save() {
}

Rainglow.CONFIG.mode.setValue(this.mode.getId());
this.saveButton.active = false;
}

private Tooltip createColourListLabel(RainglowMode mode) {
Expand Down Expand Up @@ -192,11 +190,7 @@ private Tooltip createColourListLabel(RainglowMode mode) {

@Override
public void closeScreen() {
this.closeScreen(false);
}

public void closeScreen(boolean saved) {
if (!saved && this.saveButton.active) {
if (this.saveButton.active) {
this.isConfirming = true;
this.clearAndInit();
} else {
Expand Down

0 comments on commit 33a06e6

Please sign in to comment.