2022-08-22 17:54:01 +00:00
|
|
|
#include "power_unplug_usb.h"
|
|
|
|
#include <furi.h>
|
|
|
|
#include <gui/elements.h>
|
2022-10-28 14:08:50 +00:00
|
|
|
#include <assets_icons.h>
|
2022-08-22 17:54:01 +00:00
|
|
|
|
|
|
|
struct PowerUnplugUsb {
|
|
|
|
View* view;
|
|
|
|
};
|
|
|
|
|
|
|
|
static void power_unplug_usb_draw_callback(Canvas* canvas, void* _model) {
|
|
|
|
UNUSED(_model);
|
|
|
|
|
|
|
|
canvas_set_color(canvas, ColorBlack);
|
|
|
|
canvas_draw_icon(canvas, 0, 0, &I_Unplug_bg_top_128x14);
|
|
|
|
canvas_draw_box(canvas, 0, 14, 128, (64 - 10 - 14));
|
|
|
|
canvas_draw_icon(canvas, 0, (64 - 10), &I_Unplug_bg_bottom_128x10);
|
|
|
|
|
|
|
|
canvas_set_color(canvas, ColorWhite);
|
|
|
|
canvas_set_font(canvas, FontPrimary);
|
|
|
|
elements_multiline_text_aligned(
|
2022-08-23 16:18:28 +00:00
|
|
|
canvas, 64, 32, AlignCenter, AlignCenter, "It's now safe to unplug\nthe USB cable");
|
2022-08-22 17:54:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
PowerUnplugUsb* power_unplug_usb_alloc() {
|
|
|
|
PowerUnplugUsb* power_unplug_usb = malloc(sizeof(PowerUnplugUsb));
|
|
|
|
|
|
|
|
power_unplug_usb->view = view_alloc();
|
|
|
|
view_set_context(power_unplug_usb->view, power_unplug_usb);
|
|
|
|
view_set_draw_callback(power_unplug_usb->view, power_unplug_usb_draw_callback);
|
|
|
|
view_set_input_callback(power_unplug_usb->view, NULL);
|
|
|
|
|
|
|
|
return power_unplug_usb;
|
|
|
|
}
|
|
|
|
|
|
|
|
void power_unplug_usb_free(PowerUnplugUsb* power_unplug_usb) {
|
|
|
|
furi_assert(power_unplug_usb);
|
|
|
|
view_free(power_unplug_usb->view);
|
|
|
|
free(power_unplug_usb);
|
|
|
|
}
|
|
|
|
|
|
|
|
View* power_unplug_usb_get_view(PowerUnplugUsb* power_unplug_usb) {
|
|
|
|
furi_assert(power_unplug_usb);
|
|
|
|
return power_unplug_usb->view;
|
|
|
|
}
|