Use one pin PDC for all platforms
This commit is contained in:
20
package.json
20
package.json
@@ -44,25 +44,9 @@
|
||||
"targetPlatforms": [
|
||||
"basalt",
|
||||
"diorite",
|
||||
"chalk",
|
||||
"flint",
|
||||
"emery"
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "raw",
|
||||
"name": "PIN_ROUND_JELLYFIN_ICON",
|
||||
"file": "pin_round_jellyfin.pdc",
|
||||
"targetPlatforms": [
|
||||
"chalk",
|
||||
"gabbro"
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "raw",
|
||||
"name": "PIN_ROUND_PLEX_ICON",
|
||||
"file": "pin_round_plex.pdc",
|
||||
"targetPlatforms": [
|
||||
"chalk",
|
||||
"emery",
|
||||
"gabbro"
|
||||
]
|
||||
}
|
||||
|
||||
Binary file not shown.
Binary file not shown.
37
src/c/main.c
37
src/c/main.c
@@ -54,8 +54,30 @@ static void sleep_icon_update_proc(Layer *layer, GContext *ctx) {
|
||||
gdraw_command_image_draw(ctx, s_sleep_icon, GPoint(0, 0));
|
||||
}
|
||||
|
||||
#if PBL_ROUND
|
||||
static void format_pin_for_round(uint8_t stroke_width) {
|
||||
GDrawCommandList *command_list = gdraw_command_image_get_command_list(s_pin_icon);
|
||||
const uint32_t command_count = gdraw_command_list_get_num_commands(command_list);
|
||||
for (uint32_t i = 0; i < command_count; ++i) {
|
||||
GDrawCommand *command = gdraw_command_list_get_command(command_list, i);
|
||||
if (command) {
|
||||
if (s_is_jellyfin == 1) {
|
||||
gdraw_command_set_stroke_color(command, GColorPictonBlue);
|
||||
} else {
|
||||
gdraw_command_set_stroke_color(command, GColorLightGray);
|
||||
}
|
||||
gdraw_command_set_fill_color(command, GColorClear);
|
||||
gdraw_command_set_stroke_width(command, stroke_width);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
static void pin_icon_update_proc(Layer *layer, GContext *ctx) {
|
||||
graphics_context_set_antialiased(ctx, false);
|
||||
#if PBL_ROUND
|
||||
format_pin_for_round(2);
|
||||
#endif
|
||||
gdraw_command_image_draw(ctx, s_pin_icon, GPoint(0, 0));
|
||||
}
|
||||
|
||||
@@ -190,7 +212,6 @@ static void send_pin_to_pkjs() {
|
||||
}
|
||||
|
||||
static void select_single_click_handler(ClickRecognizerRef recognizer, void *context) {
|
||||
Window *window = (Window *)context;
|
||||
send_pin_to_pkjs();
|
||||
}
|
||||
|
||||
@@ -233,17 +254,11 @@ static void inbox_received_handler(DictionaryIterator *iter, void *context) {
|
||||
persist_write_int(0, 1);
|
||||
s_color_primary = GColorVividViolet;
|
||||
s_color_secondary = GColorPictonBlue;
|
||||
#if PBL_ROUND
|
||||
s_pin_icon = gdraw_command_image_create_with_resource(RESOURCE_ID_PIN_ROUND_JELLYFIN_ICON);
|
||||
#endif
|
||||
} else {
|
||||
s_is_jellyfin = 2;
|
||||
persist_write_int(0, 2);
|
||||
s_color_primary = GColorChromeYellow;
|
||||
s_color_secondary = GColorLightGray;
|
||||
#if PBL_ROUND
|
||||
s_pin_icon = gdraw_command_image_create_with_resource(RESOURCE_ID_PIN_ROUND_PLEX_ICON);
|
||||
#endif
|
||||
}
|
||||
layer_mark_dirty(s_sleep_bar_layer);
|
||||
#if PBL_ROUND
|
||||
@@ -284,21 +299,13 @@ static void init() {
|
||||
case 1:
|
||||
s_color_primary = GColorVividViolet;
|
||||
s_color_secondary = GColorPictonBlue;
|
||||
#if PBL_ROUND
|
||||
s_pin_icon = gdraw_command_image_create_with_resource(RESOURCE_ID_PIN_ROUND_JELLYFIN_ICON);
|
||||
#endif
|
||||
break;
|
||||
case 2:
|
||||
s_color_primary = GColorChromeYellow;
|
||||
s_color_secondary = GColorLightGray;
|
||||
#if PBL_ROUND
|
||||
s_pin_icon = gdraw_command_image_create_with_resource(RESOURCE_ID_PIN_ROUND_PLEX_ICON);
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
#if PBL_RECT
|
||||
s_pin_icon = gdraw_command_image_create_with_resource(RESOURCE_ID_PIN_ICON);
|
||||
#endif
|
||||
s_sleep_icon = gdraw_command_image_create_with_resource(RESOURCE_ID_SLEEP_ICON);
|
||||
|
||||
// initialize pkjs
|
||||
|
||||
Reference in New Issue
Block a user