-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #62 from darmiel/feat/playlist
feat: .sub playlist plugin
- Loading branch information
Showing
7 changed files
with
875 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -79,5 +79,6 @@ App( | |
"multi_converter", | ||
"flipfrid", | ||
"subbrute", | ||
"sub_playlist", | ||
], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
App( | ||
appid="sub_playlist", | ||
name=".sub Playlist", | ||
apptype=FlipperAppType.PLUGIN, | ||
entry_point="playlist_app", | ||
cdefines=["APP_PLAYLIST"], | ||
requires=["storage", "gui", "dialogs", "subghz"], | ||
stack_size=2 * 1024, | ||
order=14, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
#include <gui/gui.h> | ||
|
||
#define WIDTH 128 | ||
#define HEIGHT 64 | ||
|
||
void draw_centered_boxed_str(Canvas* canvas, int x, int y, int height, int pad, const char* text) { | ||
// get width of text | ||
int w = canvas_string_width(canvas, text); | ||
canvas_draw_rframe(canvas, x, y, w + pad, height, 2); | ||
canvas_draw_str_aligned(canvas, x + pad / 2, y + height / 2, AlignLeft, AlignCenter, text); | ||
} | ||
|
||
void draw_corner_aligned(Canvas* canvas, int width, int height, Align horizontal, Align vertical) { | ||
canvas_set_color(canvas, ColorBlack); | ||
switch(horizontal) { | ||
case AlignLeft: | ||
switch(vertical) { | ||
case AlignTop: | ||
canvas_draw_rbox(canvas, 0, 0, width, height, 3); | ||
canvas_draw_box(canvas, 0, 0, width, 3); | ||
canvas_draw_box(canvas, 0, 0, 3, height); | ||
break; | ||
case AlignCenter: | ||
canvas_draw_rbox(canvas, 0, HEIGHT - height / 2, width, height, 3); | ||
canvas_draw_box(canvas, 0, HEIGHT - height / 2, 3, height); | ||
break; | ||
case AlignBottom: | ||
canvas_draw_rbox(canvas, 0, HEIGHT - height, width, height, 3); | ||
canvas_draw_box(canvas, 0, HEIGHT - height, 3, height); | ||
canvas_draw_box(canvas, 0, HEIGHT - 3, width, 3); | ||
break; | ||
default: | ||
break; | ||
} | ||
break; | ||
case AlignRight: | ||
switch(vertical) { | ||
case AlignTop: | ||
canvas_draw_rbox(canvas, WIDTH - width, 0, width, height, 3); | ||
canvas_draw_box(canvas, WIDTH - width, 0, width, 3); // bottom corner | ||
canvas_draw_box(canvas, WIDTH - 3, 0, 3, height); // right corner | ||
break; | ||
case AlignCenter: | ||
canvas_draw_rbox(canvas, WIDTH - width, HEIGHT / 2 - height / 2, width, height, 3); | ||
canvas_draw_box(canvas, WIDTH - 3, HEIGHT / 2 - height / 2, 3, height); // right corner | ||
break; | ||
case AlignBottom: | ||
canvas_draw_rbox(canvas, WIDTH - width, HEIGHT - height, width, height, 3); | ||
canvas_draw_box(canvas, WIDTH - 3, HEIGHT - height, 3, height); // right corner | ||
canvas_draw_box(canvas, WIDTH - width, HEIGHT - 3, width, 3); // bottom corner | ||
break; | ||
default: | ||
break; | ||
} | ||
break; | ||
case AlignCenter: | ||
switch(vertical) { | ||
case AlignTop: | ||
canvas_draw_rbox(canvas, WIDTH / 2 - width / 2, 0, width, height, 3); | ||
canvas_draw_box(canvas, WIDTH / 2 - width / 2, 0, width, 3); // bottom corner | ||
canvas_draw_box(canvas, WIDTH / 2 - 3, 0, 3, height); // right corner | ||
break; | ||
case AlignCenter: | ||
canvas_draw_rbox( | ||
canvas, WIDTH / 2 - width / 2, HEIGHT / 2 - height / 2, width, height, 3); | ||
canvas_draw_box( | ||
canvas, WIDTH / 2 - 3, HEIGHT / 2 - height / 2, 3, height); // right corner | ||
break; | ||
case AlignBottom: | ||
canvas_draw_rbox(canvas, WIDTH / 2 - width / 2, HEIGHT - height, width, height, 3); | ||
canvas_draw_box(canvas, WIDTH / 2 - 3, HEIGHT - height, 3, height); // right corner | ||
canvas_draw_box(canvas, WIDTH / 2 - width / 2, HEIGHT - 3, width, 3); // bottom corner | ||
break; | ||
default: | ||
break; | ||
} | ||
break; | ||
default: | ||
break; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#include <gui/gui.h> | ||
|
||
void draw_centered_boxed_str(Canvas* canvas, int x, int y, int height, int pad, const char* text); | ||
|
||
void draw_corner_aligned(Canvas* canvas, int width, int height, Align horizontal, Align vertical); |
Oops, something went wrong.