forked from Clones/Controlify
➕ Battery level warning + update SDL with macOS ARM support
This commit is contained in:
@ -46,7 +46,18 @@ public class YACLHelper {
|
||||
private static final Function<Float, Component> percentFormatter = v -> Component.literal(String.format("%.0f%%", v*100));
|
||||
private static final Function<Float, Component> percentOrOffFormatter = v -> v == 0 ? CommonComponents.OPTION_OFF : percentFormatter.apply(v);
|
||||
|
||||
public static Screen generateConfigScreen(Screen parent) {
|
||||
public static Screen openConfigScreen(Screen parent) {
|
||||
Screen configScreen = generateConfigScreen(parent);
|
||||
if (!Controlify.instance().config().globalSettings().vibrationOnboarded)
|
||||
configScreen = new SDLOnboardingScreen(configScreen, yes -> {
|
||||
if (yes) {
|
||||
SDL2NativesManager.initialise();
|
||||
}
|
||||
});
|
||||
return configScreen;
|
||||
}
|
||||
|
||||
private static Screen generateConfigScreen(Screen parent) {
|
||||
var controlify = Controlify.instance();
|
||||
|
||||
var yacl = YetAnotherConfigLib.createBuilder()
|
||||
@ -86,6 +97,12 @@ public class YACLHelper {
|
||||
.binding(GlobalSettings.DEFAULT.uiSounds, () -> globalSettings.uiSounds, v -> globalSettings.uiSounds = v)
|
||||
.controller(TickBoxController::new)
|
||||
.build())
|
||||
.option(Option.createBuilder(boolean.class)
|
||||
.name(Component.translatable("controlify.gui.notify_low_battery"))
|
||||
.tooltip(Component.translatable("controlify.gui.notify_low_battery.tooltip"))
|
||||
.binding(GlobalSettings.DEFAULT.notifyLowBattery, () -> globalSettings.notifyLowBattery, v -> globalSettings.notifyLowBattery = v)
|
||||
.controller(TickBoxController::new)
|
||||
.build())
|
||||
.option(Option.createBuilder(boolean.class)
|
||||
.name(Component.translatable("controlify.gui.out_of_focus_input"))
|
||||
.tooltip(Component.translatable("controlify.gui.out_of_focus_input.tooltip"))
|
||||
@ -126,6 +143,10 @@ public class YACLHelper {
|
||||
|
||||
category.name(Component.literal(controller.name()));
|
||||
|
||||
if (controller.batteryLevel() != BatteryLevel.UNKNOWN) {
|
||||
category.option(LabelOption.create(Component.translatable("controlify.gui.battery_level", controller.batteryLevel().getFriendlyName())));
|
||||
}
|
||||
|
||||
var config = controller.config();
|
||||
var def = controller.defaultConfig();
|
||||
|
||||
|
Reference in New Issue
Block a user